@schematics/angular 19.0.0-next.10 → 19.0.0-next.11

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.
@@ -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
 
@@ -11,6 +12,7 @@ describe('AppComponent', () => {
11
12
  declarations: [
12
13
  AppComponent
13
14
  ],
15
+ <% if(experimentalZoneless) { %>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
8
  imports: [AppComponent],
9
+ <% if(experimentalZoneless) { %>providers: [provideExperimentalZonelessChangeDetection()]<% } %>
8
10
  }).compileComponents();
9
11
  });
10
12
 
@@ -1,8 +1,10 @@
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: [
8
+ <% if(experimentalZoneless) { %>provideExperimentalZonelessChangeDetection()<% } else { %>provideZoneChangeDetection({ eventCoalescing: true })<% } %><% if (routing) {%>, provideRouter(routes)<% } %>
9
+ ]
8
10
  };
@@ -198,7 +198,7 @@ function addAppToWorkspaceFile(options, appDir, folderName) {
198
198
  outputPath: `dist/${folderName}`,
199
199
  index: `${sourceRoot}/index.html`,
200
200
  browser: `${sourceRoot}/main.ts`,
201
- polyfills: ['zone.js'],
201
+ polyfills: options.experimentalZoneless ? [] : ['zone.js'],
202
202
  tsConfig: `${projectRoot}tsconfig.app.json`,
203
203
  inlineStyleLanguage,
204
204
  assets: [{ 'glob': '**/*', 'input': `${projectRoot}public` }],
@@ -238,7 +238,7 @@ function addAppToWorkspaceFile(options, appDir, folderName) {
238
238
  : {
239
239
  builder: workspace_models_1.Builders.Karma,
240
240
  options: {
241
- polyfills: ['zone.js', 'zone.js/testing'],
241
+ polyfills: options.experimentalZoneless ? [] : ['zone.js', 'zone.js/testing'],
242
242
  tsConfig: `${projectRoot}tsconfig.spec.json`,
243
243
  inlineStyleLanguage,
244
244
  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
@@ -117,6 +117,11 @@
117
117
  "type": "boolean",
118
118
  "default": false,
119
119
  "x-user-analytics": "ep.ng_ssr"
120
+ },
121
+ "experimentalZoneless": {
122
+ "description": "Create an application that does not utilize zone.js.",
123
+ "type": "boolean",
124
+ "default": false
120
125
  }
121
126
  },
122
127
  "required": ["name"]
@@ -3,7 +3,9 @@ import { <% if(changeDetection !== 'Default') { %>ChangeDetectionStrategy, <% }%
3
3
  @Component({<% if(!skipSelector) {%>
4
4
  selector: '<%= selector %>',<%}%><% if(standalone) {%>
5
5
  standalone: true,
6
- imports: [],<%}%><% if(inlineTemplate) { %>
6
+ imports: [],<%} else { %>
7
+ standalone: false,
8
+ <% }%><% if(inlineTemplate) { %>
7
9
  template: `
8
10
  <p>
9
11
  <%= dasherize(name) %> works!
@@ -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
@@ -2,7 +2,8 @@ import { Directive } from '@angular/core';
2
2
 
3
3
  @Directive({
4
4
  selector: '[<%= selector %>]'<% if(standalone) {%>,
5
- standalone: true<%}%>
5
+ standalone: true<%} else {%>,
6
+ standalone: false<%}%>
6
7
  })
7
8
  export class <%= classify(name) %>Directive {
8
9
 
@@ -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,7 @@ function default_1(options) {
40
40
  minimal: options.minimal,
41
41
  standalone: options.standalone,
42
42
  ssr: options.ssr,
43
+ experimentalZoneless: options.experimentalZoneless,
43
44
  };
44
45
  return (0, schematics_1.chain)([
45
46
  (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.
@@ -138,6 +138,11 @@
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
+ "experimentalZoneless": {
143
+ "description": "Create an application that does not utilize zone.js.",
144
+ "type": "boolean",
145
+ "default": false
141
146
  }
142
147
  },
143
148
  "required": ["name", "version"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "19.0.0-next.10",
3
+ "version": "19.0.0-next.11",
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.10",
26
- "@angular-devkit/schematics": "19.0.0-next.10",
25
+ "@angular-devkit/core": "19.0.0-next.11",
26
+ "@angular-devkit/schematics": "19.0.0-next.11",
27
27
  "jsonc-parser": "3.3.1"
28
28
  },
29
29
  "packageManager": "yarn@4.5.0",
@@ -2,7 +2,8 @@ import { Pipe, PipeTransform } from '@angular/core';
2
2
 
3
3
  @Pipe({
4
4
  name: '<%= camelize(name) %>'<% if(standalone) {%>,
5
- standalone: true<%}%>
5
+ standalone: true<%} else {%>,
6
+ standalone: false<%}%>
6
7
  })
7
8
  export class <%= classify(name) %>Pipe implements PipeTransform {
8
9
 
@@ -14,10 +14,21 @@ const browserDistFolder = resolve(serverDistFolder, '../<%= browserDistDirectory
14
14
  const app = express();
15
15
  const angularApp = new AngularNodeAppEngine();
16
16
 
17
- // Example Express Rest API endpoints
18
- // app.get('/api/**', (req, res) => { });
17
+ /**
18
+ * Example Express Rest API endpoints can be defined here.
19
+ * Uncomment and define endpoints as necessary.
20
+ *
21
+ * Example:
22
+ * ```ts
23
+ * app.get('/api/**', (req, res) => {
24
+ * // Handle API request
25
+ * });
26
+ * ```
27
+ */
19
28
 
20
- // Serve static files from /<%= browserDistDirectory %>
29
+ /**
30
+ * Serve static files from /<%= browserDistDirectory %>
31
+ */
21
32
  app.get(
22
33
  '**',
23
34
  express.static(browserDistFolder, {
@@ -32,13 +43,22 @@ app.get(
32
43
  }),
33
44
  );
34
45
 
46
+ /**
47
+ * Handle all other requests by rendering the Angular application.
48
+ */
35
49
  app.get('**', (req, res, next) => {
36
50
  angularApp
37
51
  .render(req)
38
- .then((response) => (response ? writeResponseToNodeResponse(response, res) : next()))
52
+ .then((response) =>
53
+ response ? writeResponseToNodeResponse(response, res) : next(),
54
+ )
39
55
  .catch(next);
40
56
  });
41
57
 
58
+ /**
59
+ * Start the server if this module is the main entry point.
60
+ * The server listens on the port defined by the `PORT` environment variable, or defaults to 4000.
61
+ */
42
62
  if (isMainModule(import.meta.url)) {
43
63
  const port = process.env['PORT'] || 4000;
44
64
  app.listen(port, () => {
@@ -46,4 +66,7 @@ if (isMainModule(import.meta.url)) {
46
66
  });
47
67
  }
48
68
 
49
- export default createNodeRequestHandler(app);
69
+ /**
70
+ * The request handler used by the Angular CLI (dev-server and during build).
71
+ */
72
+ export const reqHandler = createNodeRequestHandler(app);
@@ -9,7 +9,7 @@
9
9
  "@types/node": "^18.18.0",
10
10
  "browser-sync": "^3.0.0",
11
11
  "express": "^4.18.2",
12
- "jasmine-core": "~5.3.0",
12
+ "jasmine-core": "~5.4.0",
13
13
  "jasmine-spec-reporter": "~7.0.0",
14
14
  "karma-chrome-launcher": "~3.2.0",
15
15
  "karma-coverage": "~2.2.0",
@@ -15,6 +15,6 @@ exports.latestVersions = {
15
15
  ...dependencies,
16
16
  // As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current
17
17
  Angular: dependencies['@angular/core'],
18
- DevkitBuildAngular: '^19.0.0-next.10',
19
- AngularSSR: '^19.0.0-next.10',
18
+ DevkitBuildAngular: '^19.0.0-next.11',
19
+ AngularSSR: '^19.0.0-next.11',
20
20
  };
@@ -1,27 +1,59 @@
1
1
  # <%= utils.classify(name) %>
2
2
 
3
- This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version <%= version %>.
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version <%= version %>.
4
4
 
5
5
  ## Development server
6
6
 
7
- Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
7
+ To start a local development server, run:
8
+
9
+ ```bash
10
+ ng serve
11
+ ```
12
+
13
+ Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
8
14
 
9
15
  ## Code scaffolding
10
16
 
11
- Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
17
+ Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
18
+
19
+ ```bash
20
+ ng generate component component-name
21
+ ```
22
+
23
+ For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
24
+
25
+ ```bash
26
+ ng generate --help
27
+ ```
12
28
 
13
- ## Build
29
+ ## Building
14
30
 
15
- Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
31
+ To build the project run:
32
+
33
+ ```bash
34
+ ng build
35
+ ```
36
+
37
+ This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
16
38
 
17
39
  ## Running unit tests
18
40
 
19
- Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
41
+ To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
42
+
43
+ ```bash
44
+ ng test
45
+ ```
20
46
 
21
47
  ## Running end-to-end tests
22
48
 
23
- Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
49
+ For end-to-end (e2e) testing, run:
50
+
51
+ ```bash
52
+ ng e2e
53
+ ```
54
+
55
+ Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
24
56
 
25
- ## Further help
57
+ ## Additional Resources
26
58
 
27
- 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.
59
+ 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.