Skip to content

chore: replace grunt with npm scripts#6088

Merged
edusperoni merged 2 commits into
NativeScript:mainfrom
edusperoni:chore/remove-grunt
Jul 25, 2026
Merged

chore: replace grunt with npm scripts#6088
edusperoni merged 2 commits into
NativeScript:mainfrom
edusperoni:chore/remove-grunt

Conversation

@edusperoni

@edusperoni edusperoni commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

PR Checklist

  • The PR title follows our guidelines.
  • There is an issue for the bug/feature this PR is for. (no tracking issue — happy to open one)
  • You have signed the CLA.
  • All existing tests are passing (1513 passing, unchanged).
  • Tests for the changes are included. (build tooling change; the existing suite plus a real npm pack were 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 lint and grunt all call npm run tslint, a script that does not exist — both tasks are broken today.
  • grunt-ts is pinned to 6.0.0-beta.22.
  • ts:devlib / ts:devall reference a definitions/ directory that no longer exists.
  • prepack runs ts:release_build (removeComments: true) and then shell:npm_test, which re-runs tsc with the dev config — silently undoing the release compile. You can see the result in the published tarball: lib/*.js still contains comments.
  • BuildPackage.cmd last changed in 2014 and calls grunt 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:

Grunt task Replacement
ts:* tsc, plus tsconfig.release.json for the packed build
watch tsc --watch (already npm run dev)
clean scripts/clean.js
generate/verify_unit_testing_dependencies scripts/generate-test-deps.js
set_live_ga_id / set_dev_ga_id / verify_live_ga_id scripts/set-ga-id.js
template (docs-jekyll) scripts/build-docs.js
shell:build_package / shell:npm_test npm pack / npm test
tslint:build dropped (already broken; the repo uses prettier)

prepack now runs the release compile after the tests instead of before, so removeComments/sourceMap are no longer clobbered. Verified against a real npm pack: the produced tarball is identical to the published 9.1.0-alpha.15 except that shipped lib/*.js no longer carries comments, and the obsolete grunt-ts-generated lib/.d.ts is gone (it referenced .ts sources the package never shipped).

scripts/clean.js delegates to git clean -Xdf lib test, since .gitignore already 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, so docs-jekyll was 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, csproj2ts and tslint from the tree, along with the now-dead grunt and globule minimatch overrides.

Summary by CodeRabbit

  • Documentation

    • Improved HTML documentation generation for more consistent rendered content.
    • Updated documentation build instructions to use the current project commands.
  • Build & Release

    • Modernized build and packaging workflows for more reliable project builds and releases.
    • Added automated cleanup and dependency-version preparation steps to support repeatable builds.
  • Maintenance

    • Removed legacy build tooling and simplified project configuration.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@edusperoni, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 38b62ff8-2b23-4383-89f2-8b506dbe00ea

📥 Commits

Reviewing files that changed from the base of the PR and between 61d4d40 and c856ff3.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (12)
  • .gitignore
  • BuildPackage.cmd
  • CONTRIBUTING.md
  • Gruntfile.js
  • docs/build-jekyll-md.sh
  • docs/man_pages/config/config-set.md
  • package.json
  • scripts/build-docs.js
  • scripts/clean.js
  • scripts/generate-test-deps.js
  • scripts/set-ga-id.js
  • tsconfig.release.json
📝 Walkthrough

Walkthrough

The 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.

Changes

Build toolchain migration

Layer / File(s) Summary
npm build and release orchestration
package.json, tsconfig.release.json, CONTRIBUTING.md, .gitignore
npm scripts and release compiler settings replace Grunt commands, contribution instructions use the new commands, and all JavaScript files under scripts/ are unignored. Grunt dependencies and overrides are removed.
Build support utilities
scripts/*
Node.js scripts render documentation, clean generated files and archives, generate test dependency versions, and manage development or live GA tracking IDs.

Documentation pipeline

Layer / File(s) Summary
Documentation rendering integration
docs/build-jekyll-md.sh, docs/man_pages/config/config-set.md
The documentation wrapper invokes npm run docs-jekyll, and the config template adds an HTML-specific conditional.

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
Loading

Suggested reviewers: nathanwalker

Poem

A rabbit hops through scripts anew,
No Grunt bell rings; npm pulls through.
Docs bloom bright and builds run clean,
GA IDs keep their sheen.
tsc leaves a tidy trail—
Fluffy ears applaud the scale! 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: migrating the build workflow from Grunt to npm scripts.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1084bc7 and 61d4d40.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (12)
  • .gitignore
  • BuildPackage.cmd
  • CONTRIBUTING.md
  • Gruntfile.js
  • docs/build-jekyll-md.sh
  • docs/man_pages/config/config-set.md
  • package.json
  • scripts/build-docs.js
  • scripts/clean.js
  • scripts/generate-test-deps.js
  • scripts/set-ga-id.js
  • tsconfig.release.json
💤 Files with no reviewable changes (2)
  • BuildPackage.cmd
  • Gruntfile.js

Comment thread CONTRIBUTING.md Outdated
Comment thread package.json
Comment thread scripts/build-docs.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.
@edusperoni
edusperoni force-pushed the chore/remove-grunt branch from 61d4d40 to c856ff3 Compare July 25, 2026 16:27
@edusperoni
edusperoni merged commit 354903e into NativeScript:main Jul 25, 2026
7 checks passed
@edusperoni
edusperoni deleted the chore/remove-grunt branch July 25, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant