@schematics/angular 19.2.0 → 20.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -96,8 +96,8 @@ function addDependenciesToPackageJson(options) {
96
96
  },
97
97
  {
98
98
  type: dependencies_1.NodeDependencyType.Dev,
99
- name: '@angular-devkit/build-angular',
100
- version: latest_versions_1.latestVersions.DevkitBuildAngular,
99
+ name: '@angular/build',
100
+ version: latest_versions_1.latestVersions.AngularBuild,
101
101
  },
102
102
  {
103
103
  type: dependencies_1.NodeDependencyType.Dev,
@@ -193,7 +193,7 @@ function addAppToWorkspaceFile(options, appDir, folderName) {
193
193
  schematics,
194
194
  targets: {
195
195
  build: {
196
- builder: workspace_models_1.Builders.Application,
196
+ builder: workspace_models_1.Builders.BuildApplication,
197
197
  defaultConfiguration: 'production',
198
198
  options: {
199
199
  outputPath: `dist/${folderName}`,
@@ -219,7 +219,7 @@ function addAppToWorkspaceFile(options, appDir, folderName) {
219
219
  },
220
220
  },
221
221
  serve: {
222
- builder: workspace_models_1.Builders.DevServer,
222
+ builder: workspace_models_1.Builders.BuildDevServer,
223
223
  defaultConfiguration: 'development',
224
224
  options: {},
225
225
  configurations: {
@@ -232,12 +232,12 @@ function addAppToWorkspaceFile(options, appDir, folderName) {
232
232
  },
233
233
  },
234
234
  'extract-i18n': {
235
- builder: workspace_models_1.Builders.ExtractI18n,
235
+ builder: workspace_models_1.Builders.BuildExtractI18n,
236
236
  },
237
237
  test: options.minimal
238
238
  ? undefined
239
239
  : {
240
- builder: workspace_models_1.Builders.Karma,
240
+ builder: workspace_models_1.Builders.BuildKarma,
241
241
  options: {
242
242
  polyfills: options.experimentalZoneless ? [] : ['zone.js', 'zone.js/testing'],
243
243
  tsConfig: `${projectRoot}tsconfig.spec.json`,
package/config/index.js CHANGED
@@ -9,9 +9,10 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.default = default_1;
11
11
  const schematics_1 = require("@angular-devkit/schematics");
12
- const utility_1 = require("@schematics/angular/utility");
13
12
  const node_path_1 = require("node:path");
14
13
  const paths_1 = require("../utility/paths");
14
+ const workspace_1 = require("../utility/workspace");
15
+ const workspace_models_1 = require("../utility/workspace-models");
15
16
  const schema_1 = require("./schema");
16
17
  function default_1(options) {
17
18
  switch (options.type) {
@@ -25,7 +26,7 @@ function default_1(options) {
25
26
  }
26
27
  function addBrowserslistConfig(options) {
27
28
  return async (host) => {
28
- const workspace = await (0, utility_1.readWorkspace)(host);
29
+ const workspace = await (0, workspace_1.getWorkspace)(host);
29
30
  const project = workspace.projects.get(options.project);
30
31
  if (!project) {
31
32
  throw new schematics_1.SchematicsException(`Project name "${options.project}" doesn't not exist.`);
@@ -38,7 +39,7 @@ function addBrowserslistConfig(options) {
38
39
  };
39
40
  }
40
41
  function addKarmaConfig(options) {
41
- return (0, utility_1.updateWorkspace)((workspace) => {
42
+ return (0, workspace_1.updateWorkspace)((workspace) => {
42
43
  const project = workspace.projects.get(options.project);
43
44
  if (!project) {
44
45
  throw new schematics_1.SchematicsException(`Project name "${options.project}" doesn't not exist.`);
@@ -48,10 +49,10 @@ function addKarmaConfig(options) {
48
49
  throw new schematics_1.SchematicsException(`No "test" target found for project "${options.project}".` +
49
50
  ' A "test" target is required to generate a karma configuration.');
50
51
  }
51
- if (testTarget.builder !== utility_1.AngularBuilder.Karma &&
52
- testTarget.builder !== utility_1.AngularBuilder.BuildKarma) {
52
+ if (testTarget.builder !== workspace_models_1.Builders.Karma &&
53
+ testTarget.builder !== workspace_models_1.Builders.BuildKarma) {
53
54
  throw new schematics_1.SchematicsException(`Cannot add a karma configuration as builder for "test" target in project does not` +
54
- ` use "${utility_1.AngularBuilder.Karma}" or "${utility_1.AngularBuilder.BuildKarma}".`);
55
+ ` use "${workspace_models_1.Builders.Karma}" or "${workspace_models_1.Builders.BuildKarma}".`);
55
56
  }
56
57
  testTarget.options ??= {};
57
58
  testTarget.options.karmaConfig = node_path_1.posix.join(project.root, 'karma.conf.js');
@@ -65,7 +66,7 @@ function addKarmaConfig(options) {
65
66
  (0, schematics_1.applyTemplates)({
66
67
  relativePathToWorkspaceRoot: (0, paths_1.relativePathToWorkspaceRoot)(project.root),
67
68
  folderName,
68
- needDevkitPlugin: testTarget.builder === utility_1.AngularBuilder.Karma,
69
+ needDevkitPlugin: testTarget.builder === workspace_models_1.Builders.Karma,
69
70
  }),
70
71
  (0, schematics_1.move)(project.root),
71
72
  ]));
package/e2e/index.js CHANGED
@@ -9,10 +9,13 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.default = default_1;
11
11
  const schematics_1 = require("@angular-devkit/schematics");
12
- const utility_1 = require("@schematics/angular/utility");
13
12
  const node_path_1 = require("node:path");
13
+ const dependency_1 = require("../utility/dependency");
14
14
  const json_file_1 = require("../utility/json-file");
15
15
  const latest_versions_1 = require("../utility/latest-versions");
16
+ const standalone_1 = require("../utility/standalone");
17
+ const workspace_1 = require("../utility/workspace");
18
+ const workspace_models_1 = require("../utility/workspace-models");
16
19
  /**
17
20
  * The list of development dependencies used by the E2E protractor-based builder.
18
21
  * The versions are sourced from the latest versions `../utility/latest-versions/package.json`
@@ -35,7 +38,7 @@ function addScriptsToPackageJson() {
35
38
  }
36
39
  function default_1(options) {
37
40
  const { relatedAppName } = options;
38
- return (0, utility_1.updateWorkspace)((workspace) => {
41
+ return (0, workspace_1.updateWorkspace)((workspace) => {
39
42
  const project = workspace.projects.get(relatedAppName);
40
43
  if (!project) {
41
44
  throw new schematics_1.SchematicsException(`Project name "${relatedAppName}" doesn't not exist.`);
@@ -43,7 +46,7 @@ function default_1(options) {
43
46
  const e2eRootPath = node_path_1.posix.join(project.root, 'e2e');
44
47
  project.targets.add({
45
48
  name: 'e2e',
46
- builder: utility_1.AngularBuilder.Protractor,
49
+ builder: workspace_models_1.Builders.Protractor,
47
50
  defaultConfiguration: 'development',
48
51
  options: {
49
52
  protractorConfig: node_path_1.posix.join(e2eRootPath, 'protractor.conf.js'),
@@ -66,10 +69,10 @@ function default_1(options) {
66
69
  }),
67
70
  (0, schematics_1.move)(e2eRootPath),
68
71
  ])),
69
- (0, utility_1.addRootProvider)(relatedAppName, ({ code, external }) => code `${external('provideProtractorTestingSupport', '@angular/platform-browser')}()`),
70
- ...E2E_DEV_DEPENDENCIES.map((name) => (0, utility_1.addDependency)(name, latest_versions_1.latestVersions[name], {
71
- type: utility_1.DependencyType.Dev,
72
- existing: utility_1.ExistingBehavior.Skip,
72
+ (0, standalone_1.addRootProvider)(relatedAppName, ({ code, external }) => code `${external('provideProtractorTestingSupport', '@angular/platform-browser')}()`),
73
+ ...E2E_DEV_DEPENDENCIES.map((name) => (0, dependency_1.addDependency)(name, latest_versions_1.latestVersions[name], {
74
+ type: dependency_1.DependencyType.Dev,
75
+ existing: dependency_1.ExistingBehavior.Skip,
73
76
  })),
74
77
  addScriptsToPackageJson(),
75
78
  ]);
@@ -9,12 +9,13 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.default = default_1;
11
11
  const schematics_1 = require("@angular-devkit/schematics");
12
- const utility_1 = require("@schematics/angular/utility");
13
12
  const node_path_1 = require("node:path");
13
+ const workspace_1 = require("../utility/workspace");
14
+ const workspace_models_1 = require("../utility/workspace-models");
14
15
  const ENVIRONMENTS_DIRECTORY = 'environments';
15
16
  const ENVIRONMENT_FILE_CONTENT = 'export const environment = {};\n';
16
17
  function default_1(options) {
17
- return (0, utility_1.updateWorkspace)((workspace) => {
18
+ return (0, workspace_1.updateWorkspace)((workspace) => {
18
19
  const project = workspace.projects.get(options.project);
19
20
  if (!project) {
20
21
  throw new schematics_1.SchematicsException(`Project name "${options.project}" doesn't not exist.`);
@@ -53,14 +54,14 @@ function log(type, text) {
53
54
  return (_, context) => context.logger[type](text);
54
55
  }
55
56
  function* generateConfigurationEnvironments(buildTarget, serverTarget, sourceRoot, projectName) {
56
- if (buildTarget.builder !== utility_1.AngularBuilder.Browser &&
57
- buildTarget.builder !== utility_1.AngularBuilder.BrowserEsbuild &&
58
- buildTarget.builder !== utility_1.AngularBuilder.Application &&
59
- buildTarget.builder !== utility_1.AngularBuilder.BuildApplication) {
57
+ if (buildTarget.builder !== workspace_models_1.Builders.Browser &&
58
+ buildTarget.builder !== workspace_models_1.Builders.BrowserEsbuild &&
59
+ buildTarget.builder !== workspace_models_1.Builders.Application &&
60
+ buildTarget.builder !== workspace_models_1.Builders.BuildApplication) {
60
61
  yield log('warn', `"build" target found for project "${projectName}" has a third-party builder "${buildTarget.builder}".` +
61
62
  ' The generated project options may not be compatible with this builder.');
62
63
  }
63
- if (serverTarget && serverTarget.builder !== utility_1.AngularBuilder.Server) {
64
+ if (serverTarget && serverTarget.builder !== workspace_models_1.Builders.Server) {
64
65
  yield log('warn', `"server" target found for project "${projectName}" has a third-party builder "${buildTarget.builder}".` +
65
66
  ' The generated project options may not be compatible with this builder.');
66
67
  }
package/library/index.js CHANGED
@@ -38,8 +38,8 @@ function addDependenciesToPackageJson() {
38
38
  },
39
39
  {
40
40
  type: dependencies_1.NodeDependencyType.Dev,
41
- name: '@angular-devkit/build-angular',
42
- version: latest_versions_1.latestVersions.DevkitBuildAngular,
41
+ name: '@angular/build',
42
+ version: latest_versions_1.latestVersions.AngularBuild,
43
43
  },
44
44
  {
45
45
  type: dependencies_1.NodeDependencyType.Dev,
@@ -70,7 +70,7 @@ function addLibToWorkspaceFile(options, projectRoot, projectName) {
70
70
  prefix: options.prefix,
71
71
  targets: {
72
72
  build: {
73
- builder: workspace_models_1.Builders.NgPackagr,
73
+ builder: workspace_models_1.Builders.BuildNgPackagr,
74
74
  defaultConfiguration: 'production',
75
75
  options: {
76
76
  project: `${projectRoot}/ng-package.json`,
@@ -85,7 +85,7 @@ function addLibToWorkspaceFile(options, projectRoot, projectName) {
85
85
  },
86
86
  },
87
87
  test: {
88
- builder: workspace_models_1.Builders.Karma,
88
+ builder: workspace_models_1.Builders.BuildKarma,
89
89
  options: {
90
90
  tsConfig: `${projectRoot}/tsconfig.spec.json`,
91
91
  polyfills: ['zone.js', 'zone.js/testing'],
@@ -99,7 +99,10 @@ function* updateBuildTarget(projectName, buildTarget, serverTarget, tree, contex
99
99
  // Update server file
100
100
  const ssrMainFile = serverTarget?.options?.['main'];
101
101
  if (typeof ssrMainFile === 'string') {
102
- yield deleteFile(ssrMainFile);
102
+ // Do not delete the server main file if it's the same as the browser file.
103
+ if (buildTarget.options?.browser !== ssrMainFile) {
104
+ yield deleteFile(ssrMainFile);
105
+ }
103
106
  yield (0, schematics_1.externalSchematic)('@schematics/angular', 'ssr', {
104
107
  project: projectName,
105
108
  skipInstall: true,
@@ -346,8 +349,13 @@ function deleteFile(path) {
346
349
  };
347
350
  }
348
351
  function updateJsonFile(path, updater) {
349
- return (tree) => {
350
- updater(new json_file_1.JSONFile(tree, path));
352
+ return (tree, ctx) => {
353
+ if (tree.exists(path)) {
354
+ updater(new json_file_1.JSONFile(tree, path));
355
+ }
356
+ else {
357
+ ctx.logger.info(`Skipping updating '${path}' as it does not exist.`);
358
+ }
351
359
  };
352
360
  }
353
361
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "19.2.0",
3
+ "version": "20.0.0-next.0",
4
4
  "description": "Schematics specific to Angular",
5
5
  "homepage": "https://github.com/angular/angular-cli",
6
6
  "keywords": [
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "schematics": "./collection.json",
24
24
  "dependencies": {
25
- "@angular-devkit/core": "19.2.0",
26
- "@angular-devkit/schematics": "19.2.0",
25
+ "@angular-devkit/core": "20.0.0-next.0",
26
+ "@angular-devkit/schematics": "20.0.0-next.0",
27
27
  "jsonc-parser": "3.3.1"
28
28
  },
29
29
  "repository": {
@@ -31,7 +31,7 @@
31
31
  "url": "https://github.com/angular/angular-cli.git"
32
32
  },
33
33
  "engines": {
34
- "node": "^18.19.1 || ^20.11.1 || >=22.0.0",
34
+ "node": "^20.11.1 || >=22.0.0",
35
35
  "npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
36
36
  "yarn": ">= 1.13.0"
37
37
  },
@@ -1486,10 +1486,6 @@ declare namespace ts {
1486
1486
  command: CommandTypes.Quickinfo;
1487
1487
  arguments: FileLocationRequestArgs;
1488
1488
  }
1489
- export interface QuickInfoRequestArgs extends FileLocationRequestArgs {
1490
- /** TODO */
1491
- verbosityLevel?: number;
1492
- }
1493
1489
  /**
1494
1490
  * Body of QuickInfoResponse.
1495
1491
  */
@@ -1523,10 +1519,6 @@ declare namespace ts {
1523
1519
  * JSDoc tags associated with symbol.
1524
1520
  */
1525
1521
  tags: JSDocTagInfo[];
1526
- /**
1527
- * TODO
1528
- */
1529
- canIncreaseVerbosityLevel?: boolean;
1530
1522
  }
1531
1523
  /**
1532
1524
  * Quickinfo response message.
@@ -10765,7 +10757,6 @@ declare namespace ts {
10765
10757
  displayParts?: SymbolDisplayPart[];
10766
10758
  documentation?: SymbolDisplayPart[];
10767
10759
  tags?: JSDocTagInfo[];
10768
- canIncreaseVerbosityLevel?: boolean;
10769
10760
  }
10770
10761
  type RenameInfo = RenameInfoSuccess | RenameInfoFailure;
10771
10762
  interface RenameInfoSuccess {