@schematics/angular 19.0.0-next.8 → 19.0.0-rc.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.
Files changed (52) hide show
  1. package/LICENSE +5 -5
  2. package/app-shell/index.js +71 -74
  3. package/app-shell/schema.d.ts +4 -0
  4. package/app-shell/schema.json +5 -0
  5. package/application/files/module-files/src/app/app.component.spec.ts.template +4 -2
  6. package/application/files/module-files/src/app/app.component.ts.template +2 -1
  7. package/application/files/module-files/src/app/app.module.ts.template +2 -2
  8. package/application/files/module-files/src/main.ts.template +1 -2
  9. package/application/files/standalone-files/src/app/app.component.spec.ts.template +4 -2
  10. package/application/files/standalone-files/src/app/app.component.ts.template +0 -1
  11. package/application/files/standalone-files/src/app/app.config.ts.template +2 -2
  12. package/application/index.js +3 -2
  13. package/application/schema.d.ts +9 -0
  14. package/application/schema.json +9 -0
  15. package/collection.json +2 -2
  16. package/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template +3 -2
  17. package/component/index.js +1 -0
  18. package/config/files/.browserslistrc.template +1 -0
  19. package/directive/files/__name@dasherize@if-flat__/__name@dasherize__.directive.ts.template +2 -2
  20. package/directive/index.js +1 -0
  21. package/library/files/README.md.template +49 -10
  22. package/ng-new/index.js +2 -0
  23. package/ng-new/schema.d.ts +9 -0
  24. package/ng-new/schema.json +9 -0
  25. package/package.json +3 -3
  26. package/pipe/files/__name@dasherize@if-flat__/__name@dasherize__.pipe.ts.template +2 -2
  27. package/server/files/application-builder/ngmodule-src/app/app.module.server.ts.template +13 -0
  28. package/server/files/application-builder/ngmodule-src/app/app.routes.server.ts.template +8 -0
  29. package/server/files/application-builder/standalone-src/app/app.config.server.ts.template +14 -0
  30. package/server/files/application-builder/standalone-src/app/app.routes.server.ts.template +8 -0
  31. package/server/files/server-builder/ngmodule-src/main.server.ts.template +1 -0
  32. package/server/files/server-builder/standalone-src/main.server.ts.template +7 -0
  33. package/server/index.js +16 -6
  34. package/server/schema.d.ts +5 -0
  35. package/server/schema.json +4 -0
  36. package/service-worker/files/ngsw-config.json.template +1 -0
  37. package/ssr/files/application-builder/server.ts.template +57 -42
  38. package/ssr/files/application-builder-common-engine/server.ts.template +65 -0
  39. package/ssr/files/server-builder/server.ts.template +1 -1
  40. package/ssr/index.js +20 -18
  41. package/ssr/schema.d.ts +5 -0
  42. package/ssr/schema.json +6 -0
  43. package/utility/latest-versions/package.json +1 -1
  44. package/utility/latest-versions.js +2 -2
  45. package/utility/workspace-models.d.ts +1 -1
  46. package/utility/workspace-models.js +1 -1
  47. package/workspace/files/README.md.template +41 -9
  48. /package/server/files/{src → application-builder/ngmodule-src}/main.server.ts.template +0 -0
  49. /package/server/files/{standalone-src → application-builder/standalone-src}/main.server.ts.template +0 -0
  50. /package/server/files/{src → server-builder/ngmodule-src}/app/app.module.server.ts.template +0 -0
  51. /package/server/files/{root → server-builder/root}/tsconfig.server.json.template +0 -0
  52. /package/server/files/{standalone-src → server-builder/standalone-src}/app/app.config.server.ts.template +0 -0
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2017 Google, Inc.
3
+ Copyright (c) 2010-2024 Google LLC. https://angular.dev/license
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
9
  copies of the Software, and to permit persons to whom the Software is
10
10
  furnished to do so, subject to the following conditions:
11
11
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
14
 
15
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
16
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
17
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -106,59 +106,6 @@ function validateProject(mainPath) {
106
106
  }
107
107
  };
108
108
  }
109
- function addAppShellConfigToWorkspace(options) {
110
- return (host, context) => {
111
- return (0, workspace_1.updateWorkspace)((workspace) => {
112
- const project = workspace.projects.get(options.project);
113
- if (!project) {
114
- return;
115
- }
116
- const buildTarget = project.targets.get('build');
117
- if (buildTarget?.builder === workspace_models_1.Builders.Application) {
118
- // Application builder configuration.
119
- const prodConfig = buildTarget.configurations?.production;
120
- if (!prodConfig) {
121
- throw new schematics_1.SchematicsException(`A "production" configuration is not defined for the "build" builder.`);
122
- }
123
- prodConfig.appShell = true;
124
- return;
125
- }
126
- // Webpack based builders configuration.
127
- // Validation of targets is handled already in the main function.
128
- // Duplicate keys means that we have configurations in both server and build builders.
129
- const serverConfigKeys = project.targets.get('server')?.configurations ?? {};
130
- const buildConfigKeys = project.targets.get('build')?.configurations ?? {};
131
- const configurationNames = Object.keys({
132
- ...serverConfigKeys,
133
- ...buildConfigKeys,
134
- });
135
- const configurations = {};
136
- for (const key of configurationNames) {
137
- if (!serverConfigKeys[key]) {
138
- context.logger.warn(`Skipped adding "${key}" configuration to "app-shell" target as it's missing from "server" target.`);
139
- continue;
140
- }
141
- if (!buildConfigKeys[key]) {
142
- context.logger.warn(`Skipped adding "${key}" configuration to "app-shell" target as it's missing from "build" target.`);
143
- continue;
144
- }
145
- configurations[key] = {
146
- browserTarget: `${options.project}:build:${key}`,
147
- serverTarget: `${options.project}:server:${key}`,
148
- };
149
- }
150
- project.targets.add({
151
- name: 'app-shell',
152
- builder: workspace_models_1.Builders.AppShell,
153
- defaultConfiguration: configurations['production'] ? 'production' : undefined,
154
- options: {
155
- route: APP_SHELL_ROUTE,
156
- },
157
- configurations,
158
- });
159
- });
160
- };
161
- }
162
109
  function addRouterModule(mainPath) {
163
110
  return (host) => {
164
111
  const modulePath = (0, ng_ast_utils_1.getAppModulePath)(host, mainPath);
@@ -184,6 +131,24 @@ function getMetadataProperty(metadata, propertyName) {
184
131
  })[0];
185
132
  return property;
186
133
  }
134
+ function addAppShellConfigToWorkspace(options) {
135
+ return (0, workspace_1.updateWorkspace)((workspace) => {
136
+ const project = workspace.projects.get(options.project);
137
+ if (!project) {
138
+ return;
139
+ }
140
+ const buildTarget = project.targets.get('build');
141
+ if (buildTarget?.builder === workspace_models_1.Builders.Application ||
142
+ buildTarget?.builder === workspace_models_1.Builders.BuildApplication) {
143
+ // Application builder configuration.
144
+ const prodConfig = buildTarget.configurations?.production;
145
+ if (!prodConfig) {
146
+ throw new schematics_1.SchematicsException(`A "production" configuration is not defined for the "build" builder.`);
147
+ }
148
+ prodConfig.appShell = true;
149
+ }
150
+ });
151
+ }
187
152
  function addServerRoutes(options) {
188
153
  return async (host) => {
189
154
  // The workspace gets updated so this needs to be reloaded
@@ -237,13 +202,12 @@ function addStandaloneServerRoute(options) {
237
202
  if (!host.exists(configFilePath)) {
238
203
  throw new schematics_1.SchematicsException(`Cannot find "${configFilePath}".`);
239
204
  }
205
+ const recorder = host.beginUpdate(configFilePath);
240
206
  let configSourceFile = getSourceFile(host, configFilePath);
241
207
  if (!(0, ast_utils_1.isImported)(configSourceFile, 'ROUTES', '@angular/router')) {
242
208
  const routesChange = (0, ast_utils_1.insertImport)(configSourceFile, configFilePath, 'ROUTES', '@angular/router');
243
- const recorder = host.beginUpdate(configFilePath);
244
209
  if (routesChange) {
245
210
  (0, change_1.applyToUpdateRecorder)(recorder, [routesChange]);
246
- host.commitUpdate(recorder);
247
211
  }
248
212
  }
249
213
  configSourceFile = getSourceFile(host, configFilePath);
@@ -252,29 +216,59 @@ function addStandaloneServerRoute(options) {
252
216
  throw new schematics_1.SchematicsException(`Cannot find the "providers" configuration in "${configFilePath}".`);
253
217
  }
254
218
  // Add route to providers literal.
255
- const newProvidersLiteral = typescript_1.default.factory.updateArrayLiteralExpression(providersLiteral, [
256
- ...providersLiteral.elements,
257
- typescript_1.default.factory.createObjectLiteralExpression([
258
- typescript_1.default.factory.createPropertyAssignment('provide', typescript_1.default.factory.createIdentifier('ROUTES')),
259
- typescript_1.default.factory.createPropertyAssignment('multi', typescript_1.default.factory.createIdentifier('true')),
260
- typescript_1.default.factory.createPropertyAssignment('useValue', typescript_1.default.factory.createArrayLiteralExpression([
261
- typescript_1.default.factory.createObjectLiteralExpression([
262
- typescript_1.default.factory.createPropertyAssignment('path', typescript_1.default.factory.createIdentifier(`'${APP_SHELL_ROUTE}'`)),
263
- typescript_1.default.factory.createPropertyAssignment('component', typescript_1.default.factory.createIdentifier('AppShellComponent')),
264
- ], true),
265
- ], true)),
266
- ], true),
267
- ]);
268
- const recorder = host.beginUpdate(configFilePath);
269
219
  recorder.remove(providersLiteral.getStart(), providersLiteral.getWidth());
270
- const printer = typescript_1.default.createPrinter();
271
- recorder.insertRight(providersLiteral.getStart(), printer.printNode(typescript_1.default.EmitHint.Unspecified, newProvidersLiteral, configSourceFile));
220
+ const updatedProvidersString = [
221
+ ...providersLiteral.elements.map((element) => ' ' + element.getText()),
222
+ ` {
223
+ provide: ROUTES,
224
+ multi: true,
225
+ useValue: [{
226
+ path: '${APP_SHELL_ROUTE}',
227
+ component: AppShellComponent
228
+ }]
229
+ }\n `,
230
+ ];
231
+ recorder.insertRight(providersLiteral.getStart(), `[\n${updatedProvidersString.join(',\n')}]`);
272
232
  // Add AppShellComponent import
273
233
  const appShellImportChange = (0, ast_utils_1.insertImport)(configSourceFile, configFilePath, 'AppShellComponent', './app-shell/app-shell.component');
274
234
  (0, change_1.applyToUpdateRecorder)(recorder, [appShellImportChange]);
275
235
  host.commitUpdate(recorder);
276
236
  };
277
237
  }
238
+ function addServerRoutingConfig(options) {
239
+ return async (host) => {
240
+ const workspace = await (0, workspace_1.getWorkspace)(host);
241
+ const project = workspace.projects.get(options.project);
242
+ if (!project) {
243
+ throw new schematics_1.SchematicsException(`Project name "${options.project}" doesn't not exist.`);
244
+ }
245
+ const configFilePath = (0, posix_1.join)(project.sourceRoot ?? 'src', 'app/app.routes.server.ts');
246
+ if (!host.exists(configFilePath)) {
247
+ throw new schematics_1.SchematicsException(`Cannot find "${configFilePath}".`);
248
+ }
249
+ const sourceFile = getSourceFile(host, configFilePath);
250
+ const nodes = (0, ast_utils_1.getSourceNodes)(sourceFile);
251
+ // Find the serverRoutes variable declaration
252
+ const serverRoutesNode = nodes.find((node) => typescript_1.default.isVariableDeclaration(node) &&
253
+ node.initializer &&
254
+ typescript_1.default.isArrayLiteralExpression(node.initializer) &&
255
+ node.type &&
256
+ typescript_1.default.isArrayTypeNode(node.type) &&
257
+ node.type.getText().includes('ServerRoute'));
258
+ if (!serverRoutesNode) {
259
+ throw new schematics_1.SchematicsException(`Cannot find the "ServerRoute" configuration in "${configFilePath}".`);
260
+ }
261
+ const recorder = host.beginUpdate(configFilePath);
262
+ const arrayLiteral = serverRoutesNode.initializer;
263
+ const firstElementPosition = arrayLiteral.elements[0]?.getStart() ?? arrayLiteral.getStart() + 1;
264
+ const newRouteString = `{
265
+ path: '${APP_SHELL_ROUTE}',
266
+ renderMode: RenderMode.AppShell
267
+ },\n`;
268
+ recorder.insertLeft(firstElementPosition, newRouteString);
269
+ host.commitUpdate(recorder);
270
+ };
271
+ }
278
272
  function default_1(options) {
279
273
  return async (tree) => {
280
274
  const browserEntryPoint = await (0, util_1.getMainFilePath)(tree, options.project);
@@ -282,9 +276,12 @@ function default_1(options) {
282
276
  return (0, schematics_1.chain)([
283
277
  validateProject(browserEntryPoint),
284
278
  (0, schematics_1.schematic)('server', options),
285
- addAppShellConfigToWorkspace(options),
286
- isStandalone ? (0, schematics_1.noop)() : addRouterModule(browserEntryPoint),
287
- isStandalone ? addStandaloneServerRoute(options) : addServerRoutes(options),
279
+ ...(isStandalone
280
+ ? [addStandaloneServerRoute(options)]
281
+ : [addRouterModule(browserEntryPoint), addServerRoutes(options)]),
282
+ options.serverRouting
283
+ ? addServerRoutingConfig(options)
284
+ : addAppShellConfigToWorkspace(options),
288
285
  (0, schematics_1.schematic)('component', {
289
286
  name: 'app-shell',
290
287
  module: 'app.module.server.ts',
@@ -6,4 +6,8 @@ export interface Schema {
6
6
  * The name of the related client app.
7
7
  */
8
8
  project: string;
9
+ /**
10
+ * Creates a server application using the Server Routing API (Developer Preview).
11
+ */
12
+ serverRouting?: boolean;
9
13
  }
@@ -12,6 +12,11 @@
12
12
  "$default": {
13
13
  "$source": "projectName"
14
14
  }
15
+ },
16
+ "serverRouting": {
17
+ "description": "Creates a server application using the Server Routing API (Developer Preview).",
18
+ "type": "boolean",
19
+ "default": false
15
20
  }
16
21
  },
17
22
  "required": ["project"]
@@ -1,4 +1,5 @@
1
- import { TestBed } from '@angular/core/testing';<% if (routing) { %>
1
+ <% if(experimentalZoneless) { %>import { provideExperimentalZonelessChangeDetection } from '@angular/core';
2
+ <% } %>import { TestBed } from '@angular/core/testing';<% if (routing) { %>
2
3
  import { RouterModule } from '@angular/router';<% } %>
3
4
  import { AppComponent } from './app.component';
4
5
 
@@ -10,7 +11,8 @@ describe('AppComponent', () => {
10
11
  ],<% } %>
11
12
  declarations: [
12
13
  AppComponent
13
- ],
14
+ ],<% if(experimentalZoneless) { %>
15
+ providers: [provideExperimentalZonelessChangeDetection()]<% } %>
14
16
  }).compileComponents();
15
17
  });
16
18
 
@@ -9,7 +9,8 @@ import { Component } from '@angular/core';
9
9
  %><router-outlet /><%
10
10
  } %>
11
11
  `,<% } else { %>
12
- templateUrl: './app.component.html',<% } if(inlineStyle) { %>
12
+ templateUrl: './app.component.html',<% } %>
13
+ standalone: false,<% if(inlineStyle) { %>
13
14
  styles: []<% } else { %>
14
15
  styleUrl: './app.component.<%= style %>'<% } %>
15
16
  })
@@ -1,4 +1,4 @@
1
- import { NgModule } from '@angular/core';
1
+ import { NgModule<% 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,7 @@ import { AppComponent } from './app.component';
12
12
  BrowserModule<% if (routing) { %>,
13
13
  AppRoutingModule<% } %>
14
14
  ],
15
- providers: [],
15
+ providers: [<% if (experimentalZoneless) { %>provideExperimentalZonelessChangeDetection()<% } %>],
16
16
  bootstrap: [AppComponent]
17
17
  })
18
18
  export class AppModule { }
@@ -1,10 +1,9 @@
1
1
  <% if(!!viewEncapsulation) { %>import { ViewEncapsulation } from '@angular/core';
2
2
  <% }%>import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3
-
4
3
  import { AppModule } from './app/app.module';
5
4
 
6
5
  platformBrowserDynamic().bootstrapModule(AppModule, {
7
- ngZoneEventCoalescing: true<% if(!!viewEncapsulation) { %>,
6
+ <% if(!experimentalZoneless) { %>ngZoneEventCoalescing: true,<% } %><% if(!!viewEncapsulation) { %>
8
7
  defaultEncapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } %>
9
8
  })
10
9
  .catch(err => console.error(err));
@@ -1,10 +1,12 @@
1
- import { TestBed } from '@angular/core/testing';
1
+ <% if(experimentalZoneless) { %>import { provideExperimentalZonelessChangeDetection } from '@angular/core';
2
+ <% } %>import { TestBed } from '@angular/core/testing';
2
3
  import { AppComponent } from './app.component';
3
4
 
4
5
  describe('AppComponent', () => {
5
6
  beforeEach(async () => {
6
7
  await TestBed.configureTestingModule({
7
- imports: [AppComponent],
8
+ imports: [AppComponent],<% if(experimentalZoneless) { %>
9
+ providers: [provideExperimentalZonelessChangeDetection()]<% } %>
8
10
  }).compileComponents();
9
11
  });
10
12
 
@@ -3,7 +3,6 @@ import { RouterOutlet } from '@angular/router';<% } %>
3
3
 
4
4
  @Component({
5
5
  selector: '<%= selector %>',
6
- standalone: true,
7
6
  imports: [<% if(routing) { %>RouterOutlet<% } %>],<% if(inlineTemplate) { %>
8
7
  template: `
9
8
  <h1>Welcome to {{title}}!</h1>
@@ -1,8 +1,8 @@
1
- import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';<% if (routing) { %>
1
+ import { ApplicationConfig, <% 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: [provideZoneChangeDetection({ eventCoalescing: true })<% if (routing) { %>, provideRouter(routes)<% } %>]
7
+ providers: [<% if(experimentalZoneless) { %>provideExperimentalZonelessChangeDetection()<% } else { %>provideZoneChangeDetection({ eventCoalescing: true })<% } %><% if (routing) {%>, provideRouter(routes)<% } %>]
8
8
  };
@@ -78,6 +78,7 @@ function default_1(options) {
78
78
  options.ssr
79
79
  ? (0, schematics_1.schematic)('ssr', {
80
80
  project: options.name,
81
+ serverRouting: options.serverRouting,
81
82
  skipInstall: true,
82
83
  })
83
84
  : (0, schematics_1.noop)(),
@@ -198,7 +199,7 @@ function addAppToWorkspaceFile(options, appDir, folderName) {
198
199
  outputPath: `dist/${folderName}`,
199
200
  index: `${sourceRoot}/index.html`,
200
201
  browser: `${sourceRoot}/main.ts`,
201
- polyfills: ['zone.js'],
202
+ polyfills: options.experimentalZoneless ? [] : ['zone.js'],
202
203
  tsConfig: `${projectRoot}tsconfig.app.json`,
203
204
  inlineStyleLanguage,
204
205
  assets: [{ 'glob': '**/*', 'input': `${projectRoot}public` }],
@@ -238,7 +239,7 @@ function addAppToWorkspaceFile(options, appDir, folderName) {
238
239
  : {
239
240
  builder: workspace_models_1.Builders.Karma,
240
241
  options: {
241
- polyfills: ['zone.js', 'zone.js/testing'],
242
+ polyfills: options.experimentalZoneless ? [] : ['zone.js', 'zone.js/testing'],
242
243
  tsConfig: `${projectRoot}tsconfig.spec.json`,
243
244
  inlineStyleLanguage,
244
245
  assets: [{ 'glob': '**/*', 'input': `${projectRoot}public` }],
@@ -2,6 +2,10 @@
2
2
  * Generates a new basic application definition in the "projects" subfolder of the workspace.
3
3
  */
4
4
  export interface Schema {
5
+ /**
6
+ * Create an application that does not utilize zone.js.
7
+ */
8
+ experimentalZoneless?: boolean;
5
9
  /**
6
10
  * Include styles inline in the root component.ts file. Only CSS styles can be included
7
11
  * inline. Default is false, meaning that an external styles file is created and referenced
@@ -34,6 +38,11 @@ export interface Schema {
34
38
  * Creates an application with routing enabled.
35
39
  */
36
40
  routing?: boolean;
41
+ /**
42
+ * Creates a server application using the Server Routing and App Engine APIs (Developer
43
+ * Preview).
44
+ */
45
+ serverRouting?: boolean;
37
46
  /**
38
47
  * Skip installing dependency packages.
39
48
  */
@@ -117,6 +117,15 @@
117
117
  "type": "boolean",
118
118
  "default": false,
119
119
  "x-user-analytics": "ep.ng_ssr"
120
+ },
121
+ "serverRouting": {
122
+ "description": "Creates a server application using the Server Routing and App Engine APIs (Developer Preview).",
123
+ "type": "boolean"
124
+ },
125
+ "experimentalZoneless": {
126
+ "description": "Create an application that does not utilize zone.js.",
127
+ "type": "boolean",
128
+ "default": false
120
129
  }
121
130
  },
122
131
  "required": ["name"]
package/collection.json CHANGED
@@ -23,10 +23,10 @@
23
23
  "schema": "./application/schema.json",
24
24
  "description": "Create an Angular application."
25
25
  },
26
- "e2e": {
26
+ "private-e2e": {
27
27
  "factory": "./e2e",
28
28
  "schema": "./e2e/schema.json",
29
- "description": "Create an Angular e2e application.",
29
+ "description": "PRIVATE API - Do not use.",
30
30
  "hidden": true
31
31
  },
32
32
  "class": {
@@ -2,8 +2,9 @@ import { <% if(changeDetection !== 'Default') { %>ChangeDetectionStrategy, <% }%
2
2
 
3
3
  @Component({<% if(!skipSelector) {%>
4
4
  selector: '<%= selector %>',<%}%><% if(standalone) {%>
5
- standalone: true,
6
- imports: [],<%}%><% if(inlineTemplate) { %>
5
+ imports: [],<%} else { %>
6
+ standalone: false,
7
+ <% }%><% if(inlineTemplate) { %>
7
8
  template: `
8
9
  <p>
9
10
  <%= dasherize(name) %> works!
@@ -42,6 +42,7 @@ function default_1(options) {
42
42
  options.selector =
43
43
  options.selector || buildSelector(options, (project && project.prefix) || '');
44
44
  (0, validation_1.validateHtmlSelector)(options.selector);
45
+ (0, validation_1.validateClassName)(schematics_1.strings.classify(options.name));
45
46
  const skipStyleFile = options.inlineStyle || options.style === schema_1.Style.None;
46
47
  const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
47
48
  options.skipTests ? (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts.template')) : (0, schematics_1.noop)(),
@@ -13,4 +13,5 @@ last 1 Firefox version
13
13
  last 2 Edge major versions
14
14
  last 2 Safari major versions
15
15
  last 2 iOS major versions
16
+ last 2 Android major versions
16
17
  Firefox ESR
@@ -1,8 +1,8 @@
1
1
  import { Directive } from '@angular/core';
2
2
 
3
3
  @Directive({
4
- selector: '[<%= selector %>]'<% if(standalone) {%>,
5
- standalone: true<%}%>
4
+ selector: '[<%= selector %>]'<% if(!standalone) {%>,
5
+ standalone: false<%}%>
6
6
  })
7
7
  export class <%= classify(name) %>Directive {
8
8
 
@@ -40,6 +40,7 @@ function default_1(options) {
40
40
  options.path = parsedPath.path;
41
41
  options.selector = options.selector || buildSelector(options, project.prefix || '');
42
42
  (0, validation_1.validateHtmlSelector)(options.selector);
43
+ (0, validation_1.validateClassName)(schematics_1.strings.classify(options.name));
43
44
  const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
44
45
  options.skipTests ? (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts.template')) : (0, schematics_1.noop)(),
45
46
  (0, schematics_1.applyTemplates)({
@@ -1,24 +1,63 @@
1
1
  # <%= classify(name) %>
2
2
 
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version <%= angularLatestVersion %>.
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version <%= angularLatestVersion %>.
4
4
 
5
5
  ## Code scaffolding
6
6
 
7
- Run `ng generate component component-name --project <%= name %>` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project <%= name %>`.
8
- > Note: Don't forget to add `--project <%= name %>` or else it will be added to the default project in your `angular.json` file.
7
+ Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
9
8
 
10
- ## Build
9
+ ```bash
10
+ ng generate component component-name
11
+ ```
11
12
 
12
- Run `ng build <%= name %>` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+ For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
13
14
 
14
- ## Publishing
15
+ ```bash
16
+ ng generate --help
17
+ ```
15
18
 
16
- After building your library with `ng build <%= name %>`, go to the dist folder `cd dist/<%= dasherize(name) %>` and run `npm publish`.
19
+ ## Building
20
+
21
+ To build the library, run:
22
+
23
+ ```bash
24
+ ng build <%= name %>
25
+ ```
26
+
27
+ This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
28
+
29
+ ### Publishing the Library
30
+
31
+ Once the project is built, you can publish your library by following these steps:
32
+
33
+ 1. Navigate to the `dist` directory:
34
+ ```bash
35
+ cd dist/<%= dasherize(name) %>
36
+ ```
37
+
38
+ 2. Run the `npm publish` command to publish your library to the npm registry:
39
+ ```bash
40
+ npm publish
41
+ ```
17
42
 
18
43
  ## Running unit tests
19
44
 
20
- Run `ng test <%= name %>` to execute the unit tests via [Karma](https://karma-runner.github.io).
45
+ To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
46
+
47
+ ```bash
48
+ ng test
49
+ ```
50
+
51
+ ## Running end-to-end tests
52
+
53
+ For end-to-end (e2e) testing, run:
54
+
55
+ ```bash
56
+ ng e2e
57
+ ```
58
+
59
+ Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
21
60
 
22
- ## Further help
61
+ ## Additional Resources
23
62
 
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
63
+ For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
package/ng-new/index.js CHANGED
@@ -40,6 +40,8 @@ function default_1(options) {
40
40
  minimal: options.minimal,
41
41
  standalone: options.standalone,
42
42
  ssr: options.ssr,
43
+ serverRouting: options.serverRouting,
44
+ experimentalZoneless: options.experimentalZoneless,
43
45
  };
44
46
  return (0, schematics_1.chain)([
45
47
  (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.empty)(), [
@@ -16,6 +16,10 @@ export interface Schema {
16
16
  * The directory name to create the workspace in.
17
17
  */
18
18
  directory?: string;
19
+ /**
20
+ * Create an application that does not utilize zone.js.
21
+ */
22
+ experimentalZoneless?: boolean;
19
23
  /**
20
24
  * Include styles inline in the component TS file. By default, an external styles file is
21
25
  * created and referenced in the component TypeScript file.
@@ -50,6 +54,11 @@ export interface Schema {
50
54
  * Enable routing in the initial project.
51
55
  */
52
56
  routing?: boolean;
57
+ /**
58
+ * Creates a server application using the Server Routing and App Engine APIs (Developer
59
+ * Preview).
60
+ */
61
+ serverRouting?: boolean;
53
62
  /**
54
63
  * Do not initialize a git repository.
55
64
  */
@@ -138,6 +138,15 @@
138
138
  "description": "Creates an application with Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering) enabled.",
139
139
  "type": "boolean",
140
140
  "x-user-analytics": "ep.ng_ssr"
141
+ },
142
+ "serverRouting": {
143
+ "description": "Creates a server application using the Server Routing and App Engine APIs (Developer Preview).",
144
+ "type": "boolean"
145
+ },
146
+ "experimentalZoneless": {
147
+ "description": "Create an application that does not utilize zone.js.",
148
+ "type": "boolean",
149
+ "default": false
141
150
  }
142
151
  },
143
152
  "required": ["name", "version"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "19.0.0-next.8",
3
+ "version": "19.0.0-rc.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.0.0-next.8",
26
- "@angular-devkit/schematics": "19.0.0-next.8",
25
+ "@angular-devkit/core": "19.0.0-rc.0",
26
+ "@angular-devkit/schematics": "19.0.0-rc.0",
27
27
  "jsonc-parser": "3.3.1"
28
28
  },
29
29
  "packageManager": "yarn@4.5.0",
@@ -1,8 +1,8 @@
1
1
  import { Pipe, PipeTransform } from '@angular/core';
2
2
 
3
3
  @Pipe({
4
- name: '<%= camelize(name) %>'<% if(standalone) {%>,
5
- standalone: true<%}%>
4
+ name: '<%= camelize(name) %>'<% if(!standalone) {%>,
5
+ standalone: false<%}%>
6
6
  })
7
7
  export class <%= classify(name) %>Pipe implements PipeTransform {
8
8
 
@@ -0,0 +1,13 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { ServerModule } from '@angular/platform-server';<% if(serverRouting) { %>
3
+ import { provideServerRoutesConfig } from '@angular/ssr';<% } %>
4
+ import { AppComponent } from './app.component';
5
+ import { AppModule } from './app.module';<% if(serverRouting) { %>
6
+ import { serverRoutes } from './app.routes.server';<% } %>
7
+
8
+ @NgModule({
9
+ imports: [AppModule, ServerModule],<% if(serverRouting) { %>
10
+ providers: [provideServerRoutesConfig(serverRoutes)],<% } %>
11
+ bootstrap: [AppComponent],
12
+ })
13
+ export class AppServerModule {}
@@ -0,0 +1,8 @@
1
+ import { RenderMode, ServerRoute } from '@angular/ssr';
2
+
3
+ export const serverRoutes: ServerRoute[] = [
4
+ {
5
+ path: '**',
6
+ renderMode: RenderMode.Prerender
7
+ }
8
+ ];