From 9e6550139c2883257736e31f0cc140d82322b92a Mon Sep 17 00:00:00 2001 From: Hyunbin Seo <47051820+hyunbinseo@users.noreply.github.com> Date: Sat, 27 Sep 2025 13:56:52 +0900 Subject: [PATCH 1/2] chore: generate provenance statement --- .github/workflows/publish.yml | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ccdb282..f691913 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,24 +1,21 @@ -name: "Publish Package" +name: Publish Package to npmjs on: release: types: [published] jobs: - release: - name: publish + publish: runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: 20 - registry-url: https://registry.npmjs.org - - - name: Publish to npm - run: npm publish --access public + node-version: "20.x" + registry-url: "https://registry.npmjs.org" + - run: npm publish --provenance --access public env: - NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}} + NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} From 5654ec633c40f79338947073089a7a8cb9f755e1 Mon Sep 17 00:00:00 2001 From: Hyunbin Seo <47051820+hyunbinseo@users.noreply.github.com> Date: Sat, 27 Sep 2025 14:07:51 +0900 Subject: [PATCH 2/2] chore: delete browserlist on prepublish --- .github/workflows/publish.yml | 4 ++-- package-lock.json | 37 +++++++++++++++++++++++++++-------- package.json | 4 +++- prepublish.js | 6 ++++++ 4 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 prepublish.js diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f691913..1701952 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,8 +14,8 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: "20.x" + node-version: "22.x" registry-url: "https://registry.npmjs.org" - - run: npm publish --provenance --access public + - run: npm publish --force --provenance --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} diff --git a/package-lock.json b/package-lock.json index e895eed..8ecbe23 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "MIT", "devDependencies": { "@playwright/test": "^1.37.1", + "@types/node": "^22.18.6", "autoprefixer": "^10.4.14", "browserslist-config-baseline": "^0.4.0", "cssnano": "^6.0.1", @@ -226,10 +227,14 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.5.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.0.tgz", - "integrity": "sha512-Mgq7eCtoTjT89FqNoTzzXg2XvCi5VMhRV6+I2aYanc6kQCBImeNaAYRs/DyoVqk1YEUJK5gN9VO7HRIdz4Wo3Q==", - "dev": true + "version": "22.18.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.18.6.tgz", + "integrity": "sha512-r8uszLPpeIWbNKtvWRt/DbVi5zbqZyj1PTmhRMqBMvDnaz1QpmSKujUtJLrqGZeoM8v72MfYggDceY4K1itzWQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } }, "node_modules/@types/normalize-package-data": { "version": "2.4.1", @@ -4235,6 +4240,13 @@ "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", "dev": true }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, "node_modules/universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", @@ -4585,10 +4597,13 @@ "dev": true }, "@types/node": { - "version": "20.5.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.0.tgz", - "integrity": "sha512-Mgq7eCtoTjT89FqNoTzzXg2XvCi5VMhRV6+I2aYanc6kQCBImeNaAYRs/DyoVqk1YEUJK5gN9VO7HRIdz4Wo3Q==", - "dev": true + "version": "22.18.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.18.6.tgz", + "integrity": "sha512-r8uszLPpeIWbNKtvWRt/DbVi5zbqZyj1PTmhRMqBMvDnaz1QpmSKujUtJLrqGZeoM8v72MfYggDceY4K1itzWQ==", + "dev": true, + "requires": { + "undici-types": "~6.21.0" + } }, "@types/normalize-package-data": { "version": "2.4.1", @@ -7419,6 +7434,12 @@ "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", "dev": true }, + "undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true + }, "universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", diff --git a/package.json b/package.json index 78a67d4..67a29ec 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "test": "npm-run-all build test:copy-css test:run", "test:copy-css": "postcss dist/charts.min.css --use postcss-pseudo-element-colons --no-map --output tests/playwright/charts.min.css", "test:snapshots": "playwright test --update-snapshots --trace off", - "test:run": "playwright test -c tests/playwright.config.ts" + "test:run": "playwright test -c tests/playwright.config.ts", + "prepublishOnly": "node prepublish" }, "repository": { "type": "git", @@ -44,6 +45,7 @@ }, "devDependencies": { "@playwright/test": "^1.37.1", + "@types/node": "^22.18.6", "autoprefixer": "^10.4.14", "browserslist-config-baseline": "^0.4.0", "cssnano": "^6.0.1", diff --git a/prepublish.js b/prepublish.js new file mode 100644 index 0000000..47875b0 --- /dev/null +++ b/prepublish.js @@ -0,0 +1,6 @@ +import { writeFileSync } from 'node:fs'; +import _pkg from './package.json' with { type: 'json' }; + +const { browserslist, ...pkg } = _pkg; + +writeFileSync('./package.json', JSON.stringify(pkg, null, ' ') + '\n');