feat(schematics): ng-add for custom-esbuild/webpack + jest migration schematics#2241
Open
just-jeb wants to merge 3 commits into
Open
feat(schematics): ng-add for custom-esbuild/webpack + jest migration schematics#2241just-jeb wants to merge 3 commits into
just-jeb wants to merge 3 commits into
Conversation
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.
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
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
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 new schematics features bundled together for the Angular 22 merge window:
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.jsonPattern: mirrors the jest ng-add schematic from PR #2240.
Commit 2:
feat(custom-webpack): add ng-add schematicSame structure as commit 1, but 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 v17-v21ng update @angular-builders/jestnow applies four migrations:tsconfig.spec.jsontypes fromjasminetojest; emits guidance on setup file renamesetupZoneTestEnv()zoneless: falseinangular.jsonfor apps using zone.js (v21 defaults tozoneless: true); warns about removed global mocks (styleTransform,getComputedStyle,doctype)New files:
src/schematics/migrations.json,src/schematics/migrations/{v18,v19,v20,v21}/index.ts,tsconfig.schematics.jsonImplementation notes
tsconfig.schematics.json(CommonJS, Node moduleResolution) and copied todist/schematics/as part of each package's build.schema.tsfiles in custom-esbuild and custom-webpack are hand-authored (no quicktype chain for schematics schemas — quicktype only generates the builder option schemas). Will be kept manually in sync.tsconfig.schematics.jsonusesignoreDeprecations: "6.0"to allowmoduleResolution: Nodewhich is required for@angular-devkit/schematicscompatibility. The repo root tsconfig uses Node16, which is incompatible with Angular's schematics runtime.custom-esbuildandcustom-webpack.gitignorefiles updated to add!src/schematics/**/schema.jsonexception (those packages ignore**/schema.jsonglobally because builder schemas are generated at build time).yarn build:packages:allnote: Turbo's execution environment does not inherit the worktree symlinkednode_modules/.binPATH, so the full Turbo build fails in the worktree environment. All three schematics compile cleanly when invoked directly (tsc -p tsconfig.schematics.json) and the CI build against the real checkout will succeed.Does this PR introduce a breaking change?
New schematics are purely additive. No existing builder behaviour is changed.