Skip to content

feat: publish patched module files (sanitize, route, animate, etc.) to npm#11

Open
mattyb wants to merge 1 commit into
brickhouse-tech:masterfrom
civisanalytics:feat/publish-module-files
Open

feat: publish patched module files (sanitize, route, animate, etc.) to npm#11
mattyb wants to merge 1 commit into
brickhouse-tech:masterfrom
civisanalytics:feat/publish-module-files

Conversation

@mattyb
Copy link
Copy Markdown

@mattyb mattyb commented May 14, 2026

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)

…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>
Copilot AI review requested due to automatic review settings May 14, 2026 19:44
Copy link
Copy Markdown

@nmccready nmccready left a comment

Choose a reason for hiding this comment

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

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.

Comment thread package.json
"angular.min.js.gzip",
"angular-csp.css",
"angular-animate.js",
"angular-animate.min.js",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread package.json
"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",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

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.

2 participants