Skip to content

Commit c551d9c

Browse files
committed
refactor(custom-esbuild): complete migration to @angular/build - Remove @angular-devkit/build-angular dependency completely - Update all references and tests to use @angular/build - Update schema generation to use @angular/build schemas - Update builder context patching to map to @angular/build:application
1 parent 7f86db7 commit c551d9c

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

packages/custom-esbuild/e2e/custom-esbuild-schema.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ describe('Custom ESBuild schema tests', () => {
1010
customEsbuildDevServerSchema = require('../dist/dev-server/schema.json');
1111
});
1212

13-
it('should fit the schema of the `@angular-devkit/build-angular:application`', () => {
13+
it('should fit the schema of the `@angular/build:application`', () => {
1414
const path = resolvePackagePath('@angular/build', 'src/builders/application/schema.json');
1515
const originalApplicationSchema = require(path);
1616
customEsbuildApplicationSchema.properties['plugins'] = undefined;
1717
customEsbuildApplicationSchema.properties['indexHtmlTransformer'] = undefined;
1818
expect(originalApplicationSchema.properties).toEqual(customEsbuildApplicationSchema.properties);
1919
});
2020

21-
it('should fit the schema of the `@angular-devkit/build-angular:dev-server`', () => {
22-
const originalDevServerSchema = require('@angular-devkit/build-angular/src/builders/dev-server/schema.json');
21+
it('should fit the schema of the `@angular/build:dev-server`', () => {
22+
const path = resolvePackagePath('@angular/build', 'src/builders/dev-server/schema.json');
23+
const originalDevServerSchema = require(path);
2324
customEsbuildDevServerSchema.properties['middlewares'] = undefined;
2425
expect(originalDevServerSchema.properties).toEqual(customEsbuildDevServerSchema.properties);
2526
});

packages/custom-esbuild/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
"@angular/compiler-cli": "^20.0.0"
5050
},
5151
"devDependencies": {
52-
"@angular-devkit/build-angular": "^20.0.0",
5352
"esbuild": "0.25.1",
5453
"jest": "29.7.0",
5554
"rimraf": "^5.0.0",

packages/custom-esbuild/src/dev-server/patch-builder-context.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { BuilderContext, Target } from '@angular-devkit/architect';
22

33
const executorToBuilderMap = new Map<string, string>([
4-
['@angular-builders/custom-esbuild', '@angular-devkit/build-angular:application'],
5-
['@angular-builders/custom-esbuild:application', '@angular-devkit/build-angular:application'],
4+
['@angular-builders/custom-esbuild', '@angular/build:application'],
5+
['@angular-builders/custom-esbuild:application', '@angular/build:application'],
66
]);
77

88
function cleanBuildTargetOptions(options: any) {
@@ -15,9 +15,9 @@ export function patchBuilderContext(context: BuilderContext, buildTarget: Target
1515
const originalGetBuilderNameForTarget = context.getBuilderNameForTarget;
1616

1717
// We have to patch `getBuilderNameForTarget` because Angular CLI checks
18-
// whether the runnable target is `@angular-devkit/build-angular:application`
18+
// whether the runnable target is `@angular/build:application`
1919
// and then defines the server to run. If the `builderName` (returned by
20-
// `context.getBuilderNameForTarget`) is not an `@angular-devkit/build-angular:application`,
20+
// `context.getBuilderNameForTarget`) is not an `@angular/build:application`,
2121
// then it will use the Webpack server for the `dev-server target`. By patching
2222
// the return value, Angular will use the Vite server for the `dev-server` target.
2323
context.getBuilderNameForTarget = async target => {

packages/custom-esbuild/src/schemes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ module.exports = [
77
newSchemaPath: `${__dirname}/../dist/application/schema.json`,
88
},
99
{
10-
originalSchemaPath: '@angular-devkit/build-angular/src/builders/dev-server/schema.json',
10+
originalSchemaPackage: '@angular/build',
11+
originalSchemaPath: 'src/builders/dev-server/schema.json',
1112
schemaExtensionPaths: [`${__dirname}/dev-server/schema.ext.json`],
1213
newSchemaPath: `${__dirname}/../dist/dev-server/schema.json`,
1314
},

yarn.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ __metadata:
4848
dependencies:
4949
"@angular-builders/common": "workspace:*"
5050
"@angular-devkit/architect": ">=0.2000.0 < 0.2100.0"
51-
"@angular-devkit/build-angular": ^20.0.0
5251
"@angular-devkit/core": ^20.0.0
5352
"@angular/build": ^20.0.0
5453
esbuild: 0.25.1

0 commit comments

Comments
 (0)