diff --git a/scripts/clean-package-json.mjs b/scripts/clean-package-json.mjs index 0ae7fccd49..ead9c8fc12 100644 --- a/scripts/clean-package-json.mjs +++ b/scripts/clean-package-json.mjs @@ -14,10 +14,11 @@ import fs from 'node:fs' import path from 'node:path' -import { createRequire } from 'node:module' const __dirname = path.dirname(new URL(import.meta.url).pathname) -const pkgJsonFile = path.join(__dirname, '../package.json') +const root = path.resolve(__dirname, '..') +const pkgJsonFile = path.join(root, 'package.json') +const _pkgJson = JSON.parse(fs.readFileSync(pkgJsonFile, 'utf-8')) const whitelist = new Set([ 'name', @@ -41,9 +42,7 @@ const whitelist = new Set([ 'license', ]) -const _pkgJson = createRequire(import.meta.url)('../package.json') const pkgJson = Object.fromEntries( Object.entries(_pkgJson).filter(([k]) => whitelist.has(k)) ) - fs.writeFileSync(pkgJsonFile, JSON.stringify(pkgJson, null, 2)) diff --git a/test/export.test.js b/test/export.test.js index a2a0e5f5c1..c7dfd0e57b 100644 --- a/test/export.test.js +++ b/test/export.test.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License.