fix: pin dependency versions and remove unused core-js#3697
fix: pin dependency versions and remove unused core-js#3697
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reduces dependency drift risk for published npm packages by pinning runtime dependency versions (removing ^ ranges) and cleaning up unused core-js, while adding tooling/config to keep dependencies pinned going forward.
Changes:
- Pin all
dependenciesversions across packages (remove^/~ranges for runtime deps). - Remove unused
core-jsfrom@kintone/rest, and movecore-jstodevDependenciesin@kintone/rest-api-client. - Add
lint:package-jsonand ESLint config to enforce pinneddependencies, plus Renovate grouping/bump settings.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| renovate.json5 | Adds Renovate rules intended to bump/group pinned runtime dependencies. |
| pnpm-lock.yaml | Updates lockfile to reflect pinned specifiers and core-js dependency changes. |
| package.json | Adds lint:package-json script for package manifest linting. |
| eslint.config.mjs | Enforces pinned ranges for dependencies via package-json/restrict-dependency-ranges, with a templates override. |
| packages/webpack-plugin-kintone-plugin/package.json | Pins mkdirp in runtime dependencies. |
| packages/rest/package.json | Removes core-js and pins runtime dependency versions. |
| packages/rest-api-client/package.json | Moves core-js to devDependencies and pins runtime dependency versions. |
| packages/profile-loader/package.json | Pins toml in runtime dependencies. |
| packages/plugin-uploader/package.json | Pins runtime dependency versions. |
| packages/plugin-packer/package.json | Pins runtime dependency versions (including node-rsa). |
| packages/plugin-manifest-validator/package.json | Pins runtime dependency versions. |
| packages/eslint-plugin/package.json | Pins runtime dependency versions. |
| packages/dts-gen/package.json | Pins runtime dependency versions. |
| packages/customize-uploader/package.json | Pins runtime dependency versions. |
| packages/create-plugin/package.json | Pins runtime dependency versions. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
renovate.json5
Outdated
| { | ||
| // runtime dependencies use bump strategy (update pinned versions) | ||
| matchDepTypes: ["dependencies"], | ||
| rangeStrategy: "bump", | ||
| }, | ||
| { | ||
| // group transitive-duplicate-risk deps to update together | ||
| groupName: "axios and related deps", | ||
| matchPackageNames: ["axios", "form-data"], | ||
| matchDepTypes: ["dependencies"], | ||
| }, | ||
| { | ||
| groupName: "openapi ecosystem deps", | ||
| matchPackageNames: ["openapi-fetch", "openapi-typescript", "openapi-typescript-helpers"], | ||
| matchDepTypes: ["dependencies"], | ||
| }, | ||
| { | ||
| groupName: "ajv ecosystem deps", | ||
| matchPackageNames: ["ajv", "ajv-formats"], | ||
| matchDepTypes: ["dependencies"], | ||
| }, |
There was a problem hiding this comment.
The new Renovate rules for bumping/grouping runtime dependencies are added under npm.packageRules, but this npm manager is configured with a very narrow fileMatch (only packages/create-plugin/templates/**/with-plugin-uploader\.json). As a result, these rules won’t apply to the actual packages/*/package.json dependencies you just pinned. Consider moving these rules to top-level packageRules (or broadening npm.fileMatch to include normal package.json patterns) so Renovate updates pinned runtime deps in published packages as intended.
package.json
Outdated
| "fix:workspace": "pnpm -r --parallel run fix", | ||
| "license:analyze": "license-manager analyze -c license-manager.config.js", | ||
| "lint": "run-s lint:*", | ||
| "lint:package-json": "eslint 'packages/*/package.json' --max-warnings 0", |
There was a problem hiding this comment.
lint:package-json only targets packages/*/package.json, but this PR also adds an ESLint override for **/templates/**/package.json (and the PR description calls out excluding templates). If templates are intended to be linted too, expand the glob(s) here to include template package.json files; otherwise the templates override is dead code and template manifests won’t be checked by this lint task.
| "lint:package-json": "eslint 'packages/*/package.json' --max-warnings 0", | |
| "lint:package-json": "eslint 'packages/*/package.json' '**/templates/**/package.json' --max-warnings 0", |
48d4a0f to
efb71a1
Compare
nameless-mc
left a comment
There was a problem hiding this comment.
packages/create-plugin/templates/**/package.json も対応してください
| "@rollup/plugin-json": "6.1.0", | ||
| "@rollup/plugin-node-resolve": "16.0.3", | ||
| "@rollup/plugin-terser": "0.4.4", | ||
| "@types/core-js": "2.5.8", |
Why
The OSS packages currently published to the npm registry have their dependency versions specified with ^ in package.json. This notation locks only the major version and installs the latest compatible versions for minor and patch, meaning that when installing without a pnpm-lock.yaml (i.e., installing directly from the npm registry), there is a high risk of unintended package versions being installed.
Additionally,
core-jswas listed independenciesfor both@kintone/rest-api-clientand@kintone/rest, but investigation revealed:core-jsis only used during the UMD build via Babel'suseBuiltIns: "usage". Thelib/andesm/outputs (used by bundlers and Node.js) contain zero references tocore-js. It is effectively a build-time dependency.core-jsis not referenced anywhere — not in source code, not in built output (lib/), and not even in the UMD bundle (which uses Vite'starget: "modules"instead of Babel polyfills). It is completely unused.What
dependenciesversions across all packages (remove^prefixes)package-json/restrict-dependency-rangesESLint rule to enforce pinned versions independenciesgoing forwardtemplates/package.json files from the pinning rule (end-user scaffolds)core-jsfromdependenciestodevDependenciesin@kintone/rest-api-clientcore-jsfromdependenciesin@kintone/restpnpm lint:package-jsoncommandrenovate.json5:rangeStrategy: "bump"fordependenciesto keep pinned versions up to dateHow to test
pnpm install && pnpm buildsucceedspnpm --filter @kintone/rest-api-client test— all 423 tests passpnpm --filter @kintone/rest test— all tests passpnpm lint:package-jsonpasses with no errorsrest-api-client:KintoneRestAPIClient.min.js= 245KBChecklist
pnpm lintandpnpm teston the root directory.