Remove npm token usage and update to latest standards. - #103
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
There are confirmed correctness issues in changed TypeScript (object spread typing) and coverage reporter base-file handling that can break compilation or runtime behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the repo to newer Node/npm and GitHub Actions standards while refactoring several internal utilities/tests and workflows as part of removing/limiting npm token usage (Fixes #102).
Changes:
- Modernize CI/coverage workflows (job splitting, concurrency/permissions, action version bumps, Node version updates).
- Refactor TypeScript/Node code to newer patterns (renames for clarity,
toSorted, small maintainability tweaks). - Update dependencies/scripts and adjust tests/fixtures used by npm package validation.
File summaries
| File | Description |
|---|---|
| src/validate-npm-package/validate-npm-package.ts | Adjusts generated test project package.json construction. |
| src/validate-npm-package/validate-npm-package.spec.ts | Updates mocked @actions/core module and package fixtures; tightens failure assertions. |
| src/perform-bundle/perform-bundle.ts | Renames metadata helper/variables for consistency. |
| src/github-api/index.ts | Refines comment-deletion filter logic, renames reviewer-count API, modernizes date sorting. |
| src/github-api/index.spec.ts | Uses delete process.env[...] for env cleanup. |
| src/github-api/index-reviews.spec.ts | Updates imports/calls to renamed reviewer-count function. |
| src/github-api/index-publish-comment.spec.ts | Improves async assertion style via assert.doesNotReject. |
| src/coverage-reporter/util.ts | Updates ESLint disable to match newer unicorn rule naming. |
| src/coverage-reporter/tabulate.ts | Renames params for clarity; uses toSorted and avoids re-sorting inside loops. |
| src/coverage-reporter/lcov.ts | Extracts line parsing into a helper for readability/maintainability. |
| src/coverage-reporter/html.ts | Simplifies attribute rendering via Object.entries. |
| src/coverage-reporter/delete-old-comments.ts | Renames loop control variable for clarity. |
| src/coverage-reporter/coverage-reporter.ts | Introduces readLcovFile helper and refactors file reads. |
| src/coverage-reporter/comment.ts | Avoids repeated table-row construction by storing rows in variables. |
| src/check-pr-reviews/check-pr-reviews.ts | Updates to renamed reviewer-count function. |
| src/check-pr-reviews/check-pr-reviews.spec.ts | Updates mocked @actions/core module shape. |
| src/check-label/check-label.ts | Renames exported version validation function for clearer intent. |
| src/check-label/check-label-compare-match-semver.spec.ts | Updates imports/calls to renamed version validation function. |
| src/check-imports/package-lock-file-util.ts | Renames helper to clarify boolean semantics and updates lint disable rule. |
| src/check-imports/package-lock-file-util.spec.ts | Updates imports/calls for renamed helper. |
| src/check-imports/check-imports.ts | Refactors loop for early-continue style and updates renamed helper usage. |
| package.json | Bumps deps, updates scripts, removes rimraf, updates prettier commands, adds allowScripts. |
| LICENSE.txt | Updates license header/copyright formatting. |
| .github/workflows/coverage.yml | Splits base/pr/report jobs, adds concurrency/permissions, updates action versions, still references NPM token secret. |
| .github/workflows/codeql-analysis.yml | Updates checkout and CodeQL action versions. |
| .github/workflows/ci.yml | Updates action versions, Node matrix, npm install approach, and removes NPM token env usage in tests. |
Review details
- Files reviewed: 26/27 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
le-cong
left a comment
There was a problem hiding this comment.
just a minor comment, otherwise looks great
| "build:dist-mjs": "node -e \"require('node:fs').rmSync('dist-mjs', { recursive: true, force: true })\" && npx builder --type=module --sourceMap --outDir=dist-mjs", | ||
| "ci:compile": "tsc --noEmit", | ||
| "ci:coverage": "rimraf coverage && mkdir coverage && node --experimental-test-module-mocks --disable-warning ExperimentalWarning --experimental-strip-types --test-timeout 600000 --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test-reporter spec --test-reporter-destination stdout --test \"src/**/*.spec.ts\"", | ||
| "ci:coverage": "node -e \"const fs = require('node:fs'); fs.rmSync('coverage', { recursive: true, force: true }); fs.mkdirSync('coverage')\" && node --experimental-test-module-mocks --disable-warning ExperimentalWarning --test-timeout 600000 --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test-reporter spec --test-reporter-destination stdout --test \"src/**/*.spec.ts\"", |
There was a problem hiding this comment.
remove "disable-warning ExperimentalWarning"?
Fixes #102