feat: publish patched module files (sanitize, route, animate, etc.) to npm#11
feat: publish patched module files (sanitize, route, animate, etc.) to npm#11mattyb wants to merge 1 commit into
Conversation
…o npm The Gruntfile already builds all companion modules to build/angular-*.js but they were never copied to root or included in the files array, so npm publish only shipped angular.js. Consumers needing patched versions of sanitize, route, animate, etc. had no way to get them via npm. - Copy all built modules from build/ to root during build - Minify each module with terser (same approach as core angular.js) - Add all .js, .min.js, and .min.js.map variants to files array - Drop angular.min.js.gzip from files (compress:build makes a .zip of the build dir, not a gzip of the minified file — it was never produced) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
nmccready
left a comment
There was a problem hiding this comment.
LGTM overall — the description's reasoning checks out: Grunt already builds build/angular-*.js, they just never landed in root or files. Dropping angular.min.js.gzip is correct (the compress:build task makes a .zip of the build dir, not a gzip of the file — that entry was a phantom). Two small nits inline. Suggest also adding npm pack --dry-run output (or tar tzf of npm pack) to the PR body as a one-line test plan, so future reviewers can eyeball the tarball contents without a local checkout.
| "angular.min.js.gzip", | ||
| "angular-csp.css", | ||
| "angular-animate.js", | ||
| "angular-animate.min.js", |
There was a problem hiding this comment.
Worth confirming .gitignore covers angular-*.{js,min.js,min.js.map} so the 12 new root-level copies don't accidentally land in a commit. The existing angular.js/angular.min.js* pattern presumably already ignores them — just extending it should do.
| "scripts": { | ||
| "build": "npx grunt validate-angular-files clean buildall write && cp build/angular.js . && npx terser angular.js -o angular.min.js --source-map \"filename=angular.min.js.map\" -c -m", | ||
| "build": "npx grunt validate-angular-files clean buildall write && cp build/angular.js build/angular-animate.js build/angular-aria.js build/angular-cookies.js build/angular-loader.js build/angular-message-format.js build/angular-messages.js build/angular-mocks.js build/angular-parse-ext.js build/angular-resource.js build/angular-route.js build/angular-sanitize.js build/angular-touch.js . && npx terser angular.js -o angular.min.js --source-map \"filename=angular.min.js.map\" -c -m && for m in angular-animate angular-aria angular-cookies angular-loader angular-message-format angular-messages angular-mocks angular-parse-ext angular-resource angular-route angular-sanitize angular-touch; do npx terser $m.js -o $m.min.js --source-map \"filename=$m.min.js.map\" -c -m; done", | ||
| "prepublishOnly": "npm run build", |
There was a problem hiding this comment.
Preexisting (not introduced here, but worth fixing in a follow-up): terser's --source-map "filename=X.min.js.map" writes the map file but does not append //# sourceMappingURL=X.min.js.map to the minified output. DevTools won't auto-load the map unless you add url=:
--source-map "filename=$m.min.js.map,url=$m.min.js.map"
The existing angular.min.js line has the same shape, so this PR is consistent — not a regression.
The Gruntfile already builds all companion modules to build/angular-*.js but they were never copied to root or included in the files array, so npm publish only shipped angular.js. Consumers needing patched versions of sanitize, route, animate, etc. had no way to get them via npm.