Skip to content

Commit af7dabe

Browse files
committed
ci: tweak up clean-pkg script
1 parent 2bf873d commit af7dabe

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

scripts/clean-package-json.mjs

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414

1515
import fs from 'node:fs'
1616
import path from 'node:path'
17-
import { createRequire } from 'node:module'
1817

1918
const __dirname = path.dirname(new URL(import.meta.url).pathname)
20-
const pkgJsonFile = path.join(__dirname, '../package.json')
19+
const root = path.resolve(__dirname, '..')
20+
const pkgJsonFile = path.join(root, 'package.json')
21+
const _pkgJson = JSON.parse(fs.readFileSync(pkgJsonFile, 'utf-8'))
2122

2223
const whitelist = new Set([
2324
'name',
@@ -41,9 +42,7 @@ const whitelist = new Set([
4142
'license',
4243
])
4344

44-
const _pkgJson = createRequire(import.meta.url)('../package.json')
4545
const pkgJson = Object.fromEntries(
4646
Object.entries(_pkgJson).filter(([k]) => whitelist.has(k))
4747
)
48-
4948
fs.writeFileSync(pkgJsonFile, JSON.stringify(pkgJson, null, 2))

test/export.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Google LLC
1+
// Copyright 2025 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)