feat(schematics): ng-add for custom-esbuild/webpack + jest migration schematics#2241
Closed
just-jeb wants to merge 5 commits into
Closed
feat(schematics): ng-add for custom-esbuild/webpack + jest migration schematics#2241just-jeb wants to merge 5 commits into
just-jeb wants to merge 5 commits into
Conversation
2 tasks
Adds an ng-add schematic so users can run `ng add @angular-builders/custom-esbuild` to automatically configure their Angular workspace. The schematic: - Rewrites architect.build.builder in angular.json to @angular-builders/custom-esbuild:application - Adds @angular-builders/custom-esbuild to devDependencies in package.json - Schedules NodePackageInstallTask (skippable via skipInstall option) Also adds tsconfig.schematics.json for separate schematics compilation and updates the build script to compile and copy schematics artifacts.
Adds an ng-add schematic so users can run `ng add @angular-builders/custom-webpack` to automatically configure their Angular workspace. The schematic: - Rewrites architect.build.builder in angular.json to @angular-builders/custom-webpack:browser - Adds @angular-builders/custom-webpack to devDependencies in package.json - Schedules NodePackageInstallTask (skippable via skipInstall option) Also adds tsconfig.schematics.json for separate schematics compilation and updates the build script to compile and copy schematics artifacts.
Adds ng-update migrations so users running `ng update @angular-builders/jest` get automated help with the breaking changes across four major version bumps: - v18: switch tsconfig.spec.json from jasmine to jest types; guidance on setup file rename (jest-preset-angular -> jest-preset-angular/setup-jest) - v19: guidance on zone.js setup change to explicit setupZoneTestEnv() call - v20: no-op (no breaking changes in v20) - v21: set zoneless: false in angular.json for apps still using zone.js (v21 defaults to zoneless: true); warn about removed global mocks (styleTransform, getComputedStyle, doctype removed as Jest 30 jsdom handles them) Adds tsconfig.schematics.json for migrations compilation, updates the build script to compile and copy migration artifacts, and registers migrations.json under the ng-update key in package.json.
66a1217 to
31c96fd
Compare
Owner
Author
|
Superseded by #2267, which consolidates ng-add/ng-update schematics for all builders (jest, custom-esbuild, custom-webpack) in a single PR targeting release/v22. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
PR Type
What is the current behavior?
Users must manually update
angular.jsonandpackage.jsonwhen adding@angular-builders/custom-esbuildor@angular-builders/custom-webpackto their project. Users upgrading@angular-builders/jestacross major versions have no automated migration support.Issue Number: N/A
What is the new behavior?
Three additive schematics features. Targeted at the next major aligned with Angular 22 (not yet released) — see "Versioning" below.
Commit 1:
feat(custom-esbuild): add ng-add schematicng add @angular-builders/custom-esbuildnow:architect.build.builderinangular.jsonto@angular-builders/custom-esbuild:application@angular-builders/custom-esbuildtodevDependenciesinpackage.jsonNodePackageInstallTask(skippable via--skipInstall)New files:
src/schematics/collection.json,src/schematics/ng-add/{index.ts,schema.json,schema.ts},tsconfig.schematics.json. Mirrors the jest ng-add schematic from #2240.Commit 2:
feat(custom-webpack): add ng-add schematicSame structure as commit 1, for
@angular-builders/custom-webpack:architect.build.builderto@angular-builders/custom-webpack:browser@angular-builders/custom-webpacktodevDependenciesNodePackageInstallTaskCommit 3:
feat(jest): add ng-update migration schematics v18-v21ng update @angular-builders/jestnow applies migrations across the v18→v21 chain:tsconfig.spec.jsontypes fromjasminetojest; emits guidance on setup file renamesetupZoneTestEnv()zoneless: falseinangular.jsonfor projects using the jest builder (v21 defaults tozoneless: true); warns about removed global mocksNew files:
src/schematics/migrations.json,src/schematics/migrations/{v18,v19,v20,v21}/index.ts,tsconfig.schematics.json.Implementation notes
tsconfig.schematics.json(CommonJS, Node moduleResolution) and are copied todist/schematics/as part of each package's build.schema.tsfiles for schematics are hand-authored (quicktype only generates the builder option schemas, not schematics schemas) and kept in sync manually.tsconfig.schematics.jsonusesignoreDeprecations: "6.0"to allowmoduleResolution: Node, required by@angular-devkit/schematics; the repo root tsconfig uses Node16, which is incompatible with Angular's schematics runtime.custom-esbuildandcustom-webpack.gitignoreadd a!src/schematics/**/schema.jsonexception (those packages ignore**/schema.jsonglobally because builder schemas are generated at build time).Versioning
The schematics are purely additive (no existing builder behaviour changes), but they are intended to land with the v22-aligned major rather than the current 21.x line, so the ng-add/ng-update surface ships together with the Angular 22 support. Should be merged after #2240 (shared
packages/jest/package.jsonand jesttsconfig.schematics.jsonedits will need a rebase).Does this PR introduce a breaking change?
New schematics are purely additive. No existing builder behaviour is changed.