@schematics/angular 20.0.0-next.5 → 20.0.0-next.7

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.
@@ -6,10 +6,10 @@
6
6
  "outDir": "<%= relativePathToWorkspaceRoot %>/out-tsc/app",
7
7
  "types": []
8
8
  },
9
- "files": [
10
- "src/main.ts"
11
- ],
12
9
  "include": [
13
- "src/**/*.d.ts"
10
+ "src/**/*.ts"
11
+ ],
12
+ "exclude": [
13
+ "src/**/*.spec.ts"
14
14
  ]
15
15
  }
@@ -9,7 +9,6 @@
9
9
  ]
10
10
  },
11
11
  "include": [
12
- "src/**/*.spec.ts",
13
- "src/**/*.d.ts"
12
+ "src/**/*.ts"
14
13
  ]
15
14
  }
@@ -1,4 +1,4 @@
1
- import { NgModule<% if(experimentalZoneless) { %>, provideExperimentalZonelessChangeDetection<% } %> } from '@angular/core';
1
+ import { NgModule, provideBrowserGlobalErrorListeners<% if(experimentalZoneless) { %>, provideExperimentalZonelessChangeDetection<% } %> } from '@angular/core';
2
2
  import { BrowserModule } from '@angular/platform-browser';
3
3
  <% if (routing) { %>
4
4
  import { AppRoutingModule } from './app-routing-module';<% } %>
@@ -12,7 +12,10 @@ import { App } from './app';
12
12
  BrowserModule<% if (routing) { %>,
13
13
  AppRoutingModule<% } %>
14
14
  ],
15
- providers: [<% if (experimentalZoneless) { %>provideExperimentalZonelessChangeDetection()<% } %>],
15
+ providers: [
16
+ provideBrowserGlobalErrorListeners()<% if (experimentalZoneless) { %>,
17
+ provideExperimentalZonelessChangeDetection()<% } %>
18
+ ],
16
19
  bootstrap: [App]
17
20
  })
18
21
  export class AppModule { }
@@ -1,8 +1,12 @@
1
- import { ApplicationConfig, <% if(!experimentalZoneless) { %>provideZoneChangeDetection<% } else { %>provideExperimentalZonelessChangeDetection<% } %> } from '@angular/core';<% if (routing) { %>
1
+ import { ApplicationConfig, provideBrowserGlobalErrorListeners, <% if(!experimentalZoneless) { %>provideZoneChangeDetection<% } else { %>provideExperimentalZonelessChangeDetection<% } %> } from '@angular/core';<% if (routing) { %>
2
2
  import { provideRouter } from '@angular/router';
3
3
 
4
4
  import { routes } from './app.routes';<% } %>
5
5
 
6
6
  export const appConfig: ApplicationConfig = {
7
- providers: [<% if(experimentalZoneless) { %>provideExperimentalZonelessChangeDetection()<% } else { %>provideZoneChangeDetection({ eventCoalescing: true })<% } %><% if (routing) {%>, provideRouter(routes)<% } %>]
7
+ providers: [
8
+ provideBrowserGlobalErrorListeners(),
9
+ <% if(experimentalZoneless) { %>provideExperimentalZonelessChangeDetection()<% } else { %>provideZoneChangeDetection({ eventCoalescing: true })<% } %>,
10
+ <% if (routing) {%>provideRouter(routes)<% } %>
11
+ ]
8
12
  };
@@ -12,16 +12,33 @@ const core_1 = require("@angular-devkit/core");
12
12
  const schematics_1 = require("@angular-devkit/schematics");
13
13
  const tasks_1 = require("@angular-devkit/schematics/tasks");
14
14
  const dependencies_1 = require("../utility/dependencies");
15
+ const json_file_1 = require("../utility/json-file");
15
16
  const latest_versions_1 = require("../utility/latest-versions");
16
17
  const paths_1 = require("../utility/paths");
17
18
  const workspace_1 = require("../utility/workspace");
18
19
  const workspace_models_1 = require("../utility/workspace-models");
19
20
  const schema_1 = require("./schema");
21
+ function addTsProjectReference(...paths) {
22
+ return (host) => {
23
+ if (!host.exists('tsconfig.json')) {
24
+ return host;
25
+ }
26
+ const newReferences = paths.map((path) => ({ path }));
27
+ const file = new json_file_1.JSONFile(host, 'tsconfig.json');
28
+ const jsonPath = ['references'];
29
+ const value = file.get(jsonPath);
30
+ file.modify(jsonPath, Array.isArray(value) ? [...value, ...newReferences] : newReferences);
31
+ };
32
+ }
20
33
  function default_1(options) {
21
34
  return async (host, context) => {
22
35
  const { appDir, appRootSelector, componentOptions, folderName, sourceDir } = await getAppOptions(host, options);
23
36
  return (0, schematics_1.chain)([
24
37
  addAppToWorkspaceFile(options, appDir, folderName),
38
+ addTsProjectReference('./' + (0, core_1.join)((0, core_1.normalize)(appDir), 'tsconfig.app.json')),
39
+ options.skipTests
40
+ ? (0, schematics_1.noop)()
41
+ : addTsProjectReference('./' + (0, core_1.join)((0, core_1.normalize)(appDir), 'tsconfig.spec.json')),
25
42
  options.standalone
26
43
  ? (0, schematics_1.noop)()
27
44
  : (0, schematics_1.schematic)('module', {
@@ -0,0 +1,7 @@
1
+ Chrome >= 105
2
+ ChromeAndroid >= 105
3
+ Edge >= 105
4
+ Firefox >= 104
5
+ FirefoxAndroid >= 104
6
+ Safari >= 16
7
+ iOS >= 16
@@ -2,16 +2,10 @@
2
2
  # For additional information regarding the format and rule options, please see:
3
3
  # https://github.com/browserslist/browserslist#queries
4
4
 
5
- # For the full list of supported browsers by the Angular framework, please see:
5
+ # For Angular's browser support policy, please see:
6
6
  # https://angular.dev/reference/versions#browser-support
7
7
 
8
8
  # You can see what browsers were selected by your queries by running:
9
9
  # npx browserslist
10
10
 
11
- last 2 Chrome versions
12
- last 1 Firefox version
13
- last 2 Edge major versions
14
- last 2 Safari major versions
15
- last 2 iOS major versions
16
- last 2 Android major versions
17
- Firefox ESR
11
+ <%= config %>
package/config/index.js CHANGED
@@ -9,6 +9,7 @@
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 promises_1 = require("node:fs/promises");
12
13
  const node_path_1 = require("node:path");
13
14
  const paths_1 = require("../utility/paths");
14
15
  const workspace_1 = require("../utility/workspace");
@@ -31,9 +32,11 @@ function addBrowserslistConfig(options) {
31
32
  if (!project) {
32
33
  throw new schematics_1.SchematicsException(`Project name "${options.project}" doesn't not exist.`);
33
34
  }
35
+ // Read Angular's default vendored `.browserslistrc` file.
36
+ const config = await (0, promises_1.readFile)(node_path_1.posix.join(__dirname, '.browserslistrc'), 'utf8');
34
37
  return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files'), [
35
38
  (0, schematics_1.filter)((p) => p.endsWith('.browserslistrc.template')),
36
- (0, schematics_1.applyTemplates)({}),
39
+ (0, schematics_1.applyTemplates)({ config }),
37
40
  (0, schematics_1.move)(project.root),
38
41
  ]));
39
42
  };
@@ -150,6 +150,7 @@ function updateProjects(tree, context) {
150
150
  case workspace_models_1.Builders.Application:
151
151
  case workspace_models_1.Builders.DevServer:
152
152
  case workspace_models_1.Builders.ExtractI18n:
153
+ case workspace_models_1.Builders.Karma:
153
154
  case workspace_models_1.Builders.NgPackagr:
154
155
  // Ignore application, dev server, and i18n extraction for devkit usage check.
155
156
  // Both will be replaced if no other usage is found.
@@ -173,6 +174,13 @@ function updateProjects(tree, context) {
173
174
  case workspace_models_1.Builders.ExtractI18n:
174
175
  target.builder = '@angular/build:extract-i18n';
175
176
  break;
177
+ case workspace_models_1.Builders.Karma:
178
+ target.builder = '@angular/build:karma';
179
+ // Remove "builderMode" option since the builder will always use "application"
180
+ for (const [, karmaOptions] of (0, workspace_1.allTargetOptions)(target)) {
181
+ delete karmaOptions['builderMode'];
182
+ }
183
+ break;
176
184
  case workspace_models_1.Builders.NgPackagr:
177
185
  target.builder = '@angular/build:ng-packagr';
178
186
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "20.0.0-next.5",
3
+ "version": "20.0.0-next.7",
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": "20.0.0-next.5",
26
- "@angular-devkit/schematics": "20.0.0-next.5",
25
+ "@angular-devkit/core": "20.0.0-next.7",
26
+ "@angular-devkit/schematics": "20.0.0-next.7",
27
27
  "jsonc-parser": "3.3.1"
28
28
  },
29
29
  "repository": {
package/server/index.js CHANGED
@@ -95,10 +95,6 @@ function updateConfigFileApplicationBuilder(options) {
95
95
  function updateTsConfigFile(tsConfigPath) {
96
96
  return (host) => {
97
97
  const json = new json_file_1.JSONFile(host, tsConfigPath);
98
- const filesPath = ['files'];
99
- const files = new Set(json.get(filesPath) ?? []);
100
- files.add('src/' + serverMainEntryName);
101
- json.modify(filesPath, [...files]);
102
98
  const typePath = ['compilerOptions', 'types'];
103
99
  const types = new Set(json.get(typePath) ?? []);
104
100
  types.add('node');
package/ssr/index.js CHANGED
@@ -107,6 +107,11 @@ function updateApplicationBuilderTsConfigRule(options) {
107
107
  return;
108
108
  }
109
109
  const json = new json_file_1.JSONFile(host, tsConfigPath);
110
+ // Skip adding the files entry if the server entry would already be included
111
+ const include = json.get(['include']);
112
+ if (Array.isArray(include) && include.includes('src/**/*.ts')) {
113
+ return;
114
+ }
110
115
  const filesPath = ['files'];
111
116
  const files = new Set(json.get(filesPath) ?? []);
112
117
  files.add('src/server.ts');
@@ -16,7 +16,7 @@ exports.latestVersions = {
16
16
  // As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current
17
17
  Angular: '^20.0.0-next.0',
18
18
  NgPackagr: '^20.0.0-next.0',
19
- DevkitBuildAngular: '^20.0.0-next.5',
20
- AngularBuild: '^20.0.0-next.5',
21
- AngularSSR: '^20.0.0-next.5',
19
+ DevkitBuildAngular: '^20.0.0-next.7',
20
+ AngularBuild: '^20.0.0-next.7',
21
+ AngularSSR: '^20.0.0-next.7',
22
22
  };
@@ -2,8 +2,7 @@
2
2
  /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
3
  {
4
4
  "compileOnSave": false,
5
- "compilerOptions": {
6
- "outDir": "./dist/out-tsc",<% if (strict) { %>
5
+ "compilerOptions": {<% if (strict) { %>
7
6
  "strict": true,
8
7
  "noImplicitOverride": true,
9
8
  "noPropertyAccessFromIndexSignature": true,
@@ -22,5 +21,6 @@
22
21
  "strictInputAccessModifiers": true,
23
22
  "typeCheckHostBindings": true,
24
23
  "strictTemplates": true<% } %>
25
- }
24
+ },
25
+ "files": []
26
26
  }