chore: replace grunt with npm scripts#6088
Conversation
|
Warning Review limit reached
Next review available in: 40 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (12)
📝 WalkthroughWalkthroughThe PR removes Grunt build configuration and replaces its build, test, packaging, cleanup, documentation, dependency-generation, and GA ID workflows with npm scripts and Node.js utilities. Release TypeScript settings and documentation template handling are also updated. ChangesBuild toolchain migration
Documentation pipeline
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant npm
participant TypeScript
participant generate-test-deps.js
participant pacote
npm->>TypeScript: compile sources
npm->>generate-test-deps.js: generate test dependency versions
generate-test-deps.js->>pacote: fetch missing versions
pacote-->>generate-test-deps.js: return package metadata
generate-test-deps.js-->>npm: write generated versions
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CONTRIBUTING.md`:
- Line 36: Update the setup-script instruction in CONTRIBUTING.md to accurately
describe the behavior of npm run setup: installing Node dependencies with
scripts ignored and initializing Husky hooks. Do not claim it initializes a Git
submodule, and only add submodule or post-install behavior if the repository
actually requires it.
In `@package.json`:
- Around line 40-41: Update the package lifecycle scripts around prepack and
postpack so the original config/config.json.GA_TRACKING_ID is saved before
set-ga-id.js switches to live, then restored from that saved value afterward.
Ensure restoration also works when packing fails and does not hard-code the dev
tracking ID; reuse the existing set-ga-id.js mechanism or add the minimal
companion script needed to persist and restore the original value.
In `@scripts/build-docs.js`:
- Around line 30-46: Clear the generated documentation directory before the
render loop in the build-docs entrypoint, ensuring stale files from deleted or
renamed Markdown sources are removed while preserving the existing rendering and
write behavior for current files.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f8733143-0b6b-4df3-9b8e-7be602d6389a
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (12)
.gitignoreBuildPackage.cmdCONTRIBUTING.mdGruntfile.jsdocs/build-jekyll-md.shdocs/man_pages/config/config-set.mdpackage.jsonscripts/build-docs.jsscripts/clean.jsscripts/generate-test-deps.jsscripts/set-ga-id.jstsconfig.release.json
💤 Files with no reviewable changes (2)
- BuildPackage.cmd
- Gruntfile.js
The Related Commands section had a closing <% } %> with no matching opening tag, which made the man page fail to render as a lodash template. Introduced when the page was copied from config-get.md.
Grunt's remaining tasks were mostly thin wrappers around tsc, npm test and npm pack; the rest were small file-manipulation tasks that now live in scripts/: - ts:* -> tsc (+ tsconfig.release.json) - clean -> scripts/clean.js - generate/verify unit test deps -> scripts/generate-test-deps.js - set_live_ga_id/set_dev_ga_id/... -> scripts/set-ga-id.js - template (docs-jekyll) -> scripts/build-docs.js prepack now runs the release compile after the tests rather than before, so removeComments and sourceMap are no longer overwritten by the dev compile that npm test performs. Also drops BuildPackage.cmd, last changed in 2014 and calling a grunt task that no longer exists, and the grunt/globule minimatch overrides, which no longer resolve to anything in the tree.
61d4d40 to
c856ff3
Compare
PR Checklist
npm packwere used to verify)What is the current behavior?
The build runs through Grunt, but most of what the Gruntfile does is already available as plain npm scripts, and some of it no longer works at all:
grunt lintandgrunt allcallnpm run tslint, a script that does not exist — both tasks are broken today.grunt-tsis pinned to6.0.0-beta.22.ts:devlib/ts:devallreference adefinitions/directory that no longer exists.prepackrunsts:release_build(removeComments: true) and thenshell:npm_test, which re-runstscwith the dev config — silently undoing the release compile. You can see the result in the published tarball:lib/*.jsstill contains comments.BuildPackage.cmdlast changed in 2014 and callsgrunt enableScripts, a task that no longer exists anywhere.What is the new behavior?
Grunt is removed. Its remaining tasks map to npm scripts and four small node scripts:
ts:*tsc, plustsconfig.release.jsonfor the packed buildwatchtsc --watch(alreadynpm run dev)cleanscripts/clean.jsgenerate/verify_unit_testing_dependenciesscripts/generate-test-deps.jsset_live_ga_id/set_dev_ga_id/verify_live_ga_idscripts/set-ga-id.jstemplate(docs-jekyll)scripts/build-docs.jsshell:build_package/shell:npm_testnpm pack/npm testtslint:buildprepacknow runs the release compile after the tests instead of before, soremoveComments/sourceMapare no longer clobbered. Verified against a realnpm pack: the produced tarball is identical to the published9.1.0-alpha.15except that shippedlib/*.jsno longer carries comments, and the obsolete grunt-ts-generatedlib/.d.tsis gone (it referenced.tssources the package never shipped).scripts/clean.jsdelegates togit clean -Xdf lib test, since.gitignorealready encodes exactly which files under those directories are compiler output — including the negations protecting vendored, hook and fixture.js. Verified equivalent to the old glob list: 450 emitted files removed, the 11 protected ones untouched.Also included is a one-line fix to
docs/man_pages/config/config-set.md, which had a stray<% } %>with no opening tag. It made the page fail to render as a lodash template, sodocs-jekyllwas already broken before this change — the ported script can't work without it.Side effect worth flagging: dropping the grunt toolchain removes
js-yaml,micromatch,braces,csproj2tsandtslintfrom the tree, along with the now-deadgruntandglobuleminimatch overrides.Summary by CodeRabbit
Documentation
Build & Release
Maintenance