@schematics/angular 14.1.0-next.2 → 14.1.0-rc.3

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.
@@ -5,7 +5,6 @@
5
5
  "type": "object",
6
6
  "description": "Generates an application shell for running a server-side version of an app.",
7
7
  "additionalProperties": false,
8
- "long-description": "./app-shell-long.md",
9
8
  "properties": {
10
9
  "project": {
11
10
  "type": "string",
package/e2e/schema.json CHANGED
@@ -5,7 +5,6 @@
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
7
  "description": "Generates a new, generic end-to-end test definition for the given or default project.",
8
- "long-description": "e2e-long.md",
9
8
  "properties": {
10
9
  "rootSelector": {
11
10
  "description": "The HTML selector for the root component of the test app.",
@@ -4,7 +4,6 @@
4
4
  "title": "Library Options Schema",
5
5
  "type": "object",
6
6
  "description": "Creates a new, generic library project in the current workspace.",
7
- "long-description": "./library-long.md",
8
7
  "additionalProperties": false,
9
8
  "properties": {
10
9
  "name": {
@@ -1,7 +1,7 @@
1
1
  import { NgModule } from '@angular/core';<% if (commonModule) { %>
2
2
  import { CommonModule } from '@angular/common';<% } %><% if (lazyRouteWithoutRouteModule) { %>
3
3
  import { Routes, RouterModule } from '@angular/router';<% } %>
4
- <% if (routing || lazyRouteWithRouteModule) { %>
4
+ <% if ((!lazyRoute && routing) || lazyRouteWithRouteModule) { %>
5
5
  import { <%= classify(name) %>RoutingModule } from './<%= dasherize(name) %>-routing.module';<% } %>
6
6
  <% if (lazyRouteWithoutRouteModule) { %>
7
7
  const routes: Routes = [
@@ -11,7 +11,7 @@ const routes: Routes = [
11
11
  @NgModule({
12
12
  declarations: [],
13
13
  imports: [<% if (commonModule) { %>
14
- CommonModule<% } %><% if (routing || lazyRouteWithRouteModule) { %>,
14
+ CommonModule<% } %><% if ((!lazyRoute && routing) || lazyRouteWithRouteModule) { %>,
15
15
  <%= classify(name) %>RoutingModule<% } %><% if (lazyRouteWithoutRouteModule) { %>,
16
16
  RouterModule.forChild(routes)<% } %>
17
17
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "14.1.0-next.2",
3
+ "version": "14.1.0-rc.3",
4
4
  "description": "Schematics specific to Angular",
5
5
  "homepage": "https://github.com/angular/angular-cli",
6
6
  "keywords": [
@@ -23,8 +23,8 @@
23
23
  },
24
24
  "schematics": "./collection.json",
25
25
  "dependencies": {
26
- "@angular-devkit/core": "14.1.0-next.2",
27
- "@angular-devkit/schematics": "14.1.0-next.2",
26
+ "@angular-devkit/core": "14.1.0-rc.3",
27
+ "@angular-devkit/schematics": "14.1.0-rc.3",
28
28
  "jsonc-parser": "3.0.0"
29
29
  },
30
30
  "repository": {
@@ -10,8 +10,5 @@
10
10
  },
11
11
  "files": [
12
12
  "src/<%= stripTsExtension(main) %>.ts"
13
- ],
14
- "angularCompilerOptions": {
15
- "entryModule": "./<%= rootInSrc ? '' : 'src/' %><%= appDir %>/<%= stripTsExtension(rootModuleFileName) %>#<%= rootModuleClassName %>"
16
- }
13
+ ]
17
14
  }
@@ -45,6 +45,7 @@ const workspace_1 = require("../utility/workspace");
45
45
  const workspace_models_1 = require("../utility/workspace-models");
46
46
  function updateConfigFile(options, tsConfigDirectory) {
47
47
  return (0, workspace_1.updateWorkspace)((workspace) => {
48
+ var _a;
48
49
  const clientProject = workspace.projects.get(options.project);
49
50
  if (clientProject) {
50
51
  // In case the browser builder hashes the assets
@@ -79,6 +80,7 @@ function updateConfigFile(options, tsConfigDirectory) {
79
80
  }
80
81
  }
81
82
  const mainPath = options.main;
83
+ const sourceRoot = (_a = clientProject.sourceRoot) !== null && _a !== void 0 ? _a : (0, core_1.join)((0, core_1.normalize)(clientProject.root), 'src');
82
84
  const serverTsConfig = (0, core_1.join)(tsConfigDirectory, 'tsconfig.server.json');
83
85
  clientProject.targets.add({
84
86
  name: 'server',
@@ -86,7 +88,7 @@ function updateConfigFile(options, tsConfigDirectory) {
86
88
  defaultConfiguration: 'production',
87
89
  options: {
88
90
  outputPath: `dist/${options.project}/server`,
89
- main: (0, core_1.join)((0, core_1.normalize)(clientProject.root), 'src', mainPath.endsWith('.ts') ? mainPath : mainPath + '.ts'),
91
+ main: (0, core_1.join)((0, core_1.normalize)(sourceRoot), mainPath.endsWith('.ts') ? mainPath : mainPath + '.ts'),
90
92
  tsConfig: serverTsConfig,
91
93
  ...((buildTarget === null || buildTarget === void 0 ? void 0 : buildTarget.options) ? getServerOptions(buildTarget === null || buildTarget === void 0 ? void 0 : buildTarget.options) : {}),
92
94
  },
@@ -135,12 +137,12 @@ function wrapBootstrapCall(mainFile) {
135
137
  const afterText = `\n${triviaWidth > 2 ? ' '.repeat(triviaWidth - 1) : ''}};\n` +
136
138
  `
137
139
 
138
- if (document.readyState === 'complete') {
139
- bootstrap();
140
- } else {
141
- document.addEventListener('DOMContentLoaded', bootstrap);
142
- }
143
- `;
140
+ if (document.readyState === 'complete') {
141
+ bootstrap();
142
+ } else {
143
+ document.addEventListener('DOMContentLoaded', bootstrap);
144
+ }
145
+ `;
144
146
  // in some cases we need to cater for a trailing semicolon such as;
145
147
  // bootstrap().catch(err => console.log(err));
146
148
  const lastToken = bootstrapCall.parent.getLastToken();
@@ -215,12 +217,6 @@ function default_1(options) {
215
217
  }
216
218
  const clientBuildOptions = (clientBuildTarget.options ||
217
219
  {});
218
- const clientTsConfig = (0, core_1.normalize)(clientBuildOptions.tsConfig);
219
- const tsConfigExtends = (0, core_1.basename)(clientTsConfig);
220
- // this is needed because prior to version 8, tsconfig might have been in 'src'
221
- // and we don't want to break the 'ng add @nguniversal/express-engine schematics'
222
- const rootInSrc = clientProject.root === '' && clientTsConfig.includes('src/');
223
- const tsConfigDirectory = (0, core_1.join)((0, core_1.normalize)(clientProject.root), rootInSrc ? 'src' : '');
224
220
  if (!options.skipInstall) {
225
221
  context.addTask(new tasks_1.NodePackageInstallTask());
226
222
  }
@@ -233,6 +229,9 @@ function default_1(options) {
233
229
  }),
234
230
  (0, schematics_1.move)((0, core_1.join)((0, core_1.normalize)(clientProject.root), 'src')),
235
231
  ]);
232
+ const clientTsConfig = (0, core_1.normalize)(clientBuildOptions.tsConfig);
233
+ const tsConfigExtends = (0, core_1.basename)(clientTsConfig);
234
+ const tsConfigDirectory = (0, core_1.dirname)(clientTsConfig);
236
235
  const rootSource = (0, schematics_1.apply)((0, schematics_1.url)('./files/root'), [
237
236
  (0, schematics_1.applyTemplates)({
238
237
  ...schematics_1.strings,
@@ -240,7 +239,6 @@ function default_1(options) {
240
239
  stripTsExtension: (s) => s.replace(/\.ts$/, ''),
241
240
  tsConfigExtends,
242
241
  relativePathToWorkspaceRoot: (0, paths_1.relativePathToWorkspaceRoot)(tsConfigDirectory),
243
- rootInSrc,
244
242
  }),
245
243
  (0, schematics_1.move)(tsConfigDirectory),
246
244
  ]);
@@ -4,6 +4,7 @@
4
4
  export interface Schema {
5
5
  /**
6
6
  * The name of the application folder.
7
+ * @deprecated This option has no effect.
7
8
  */
8
9
  appDir?: string;
9
10
  /**
@@ -29,7 +29,8 @@
29
29
  "type": "string",
30
30
  "format": "path",
31
31
  "description": "The name of the application folder.",
32
- "default": "app"
32
+ "default": "app",
33
+ "x-deprecated": "This option has no effect."
33
34
  },
34
35
  "rootModuleFileName": {
35
36
  "type": "string",
@@ -94,15 +94,18 @@ function addDependency(name, specifier, options = {}) {
94
94
  // Section is not present. The dependency can be added to a new object literal for the section.
95
95
  manifest[type] = { [name]: specifier };
96
96
  }
97
- else if (dependencySection[name] === specifier) {
98
- // Already present with same specifier
99
- return;
100
- }
101
- else if (dependencySection[name]) {
102
- // Already present but different specifier
103
- throw new Error(`Package dependency "${name}" already exists with a different specifier.`);
104
- }
105
97
  else {
98
+ const existingSpecifier = dependencySection[name];
99
+ if (existingSpecifier === specifier) {
100
+ // Already present with same specifier
101
+ return;
102
+ }
103
+ if (existingSpecifier) {
104
+ // Already present but different specifier
105
+ // This warning may become an error in the future
106
+ context.logger.warn(`Package dependency "${name}" already exists with a different specifier. ` +
107
+ `"${existingSpecifier}" will be replaced with "${specifier}".`);
108
+ }
106
109
  // Add new dependency in alphabetical order
107
110
  const entries = Object.entries(dependencySection);
108
111
  entries.push([name, specifier]);
@@ -5,13 +5,13 @@
5
5
  "dependencies": {
6
6
  "@types/jasmine": "~4.0.0",
7
7
  "@types/node": "^14.15.0",
8
- "jasmine-core": "~4.1.0",
8
+ "jasmine-core": "~4.2.0",
9
9
  "jasmine-spec-reporter": "~7.0.0",
10
10
  "karma-chrome-launcher": "~3.1.0",
11
11
  "karma-coverage": "~2.2.0",
12
12
  "karma-jasmine-html-reporter": "~2.0.0",
13
- "karma-jasmine": "~5.0.0",
14
- "karma": "~6.3.0",
13
+ "karma-jasmine": "~5.1.0",
14
+ "karma": "~6.4.0",
15
15
  "ng-packagr": "^14.0.0-next.8",
16
16
  "protractor": "~7.0.0",
17
17
  "rxjs": "~7.5.0",
@@ -1,47 +0,0 @@
1
- An app shell lets Universal render a portion of your application via a route at build time.
2
- This gives users a meaningful first paint of your application that appears quickly
3
- because the browser can simply render the HTML without the need to initialize any JavaScript.
4
-
5
- Use this command with a routing app that is accompanied by a Universal server-side app.
6
-
7
- To create an app shell, use the following command.
8
-
9
- <code-example format="." language="bash">
10
- ng generate app-shell my-app
11
- </code-example>
12
-
13
- - `my-app` is the name of your client application
14
- - `server-app` is the name of the Universal (server) application
15
-
16
- The command adds two new architect build targets to your `angular.json` configuration file (along with a few other changes).
17
-
18
- <code-example format="." language="none" linenums="false">
19
- "server": {
20
- "builder": "@angular-devkit/build-angular:server",
21
- "options": {
22
- "outputPath": "dist/my-app-server",
23
- "main": "src/main.server.ts",
24
- "tsConfig": "src/tsconfig.server.json"
25
- }
26
- },
27
- "app-shell": {
28
- "builder": "@angular-devkit/build-angular:app-shell",
29
- "options": {
30
- "browserTarget": "my-app:build",
31
- "serverTarget": "my-app:server",
32
- "route": "shell"
33
- }
34
- }
35
- </code-example>
36
-
37
- To verify the that the app has been built with the default shell content:
38
-
39
- 1. Run the app-shell target.
40
-
41
- <code-example format="." language="bash">
42
- ng run my-app:app-shell
43
- </code-example>
44
-
45
- 1. Open `dist/app-shell/index.html` in your browser.
46
-
47
- The default text "app-shell works!" verifies that the app-shell route was rendered as part of the output.
package/e2e/e2e-long.md DELETED
@@ -1,2 +0,0 @@
1
- The e2e tests are created in a separate application in the `projects` folder of the workspace,
2
- next to the project being tested.
@@ -1,16 +0,0 @@
1
- # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2
- # For additional information regarding the format and rule options, please see:
3
- # https://github.com/browserslist/browserslist#queries
4
-
5
- # For the full list of supported browsers by the Angular framework, please see:
6
- # https://angular.io/guide/browser-support
7
-
8
- # You can see what browsers were selected by your queries by running:
9
- # npx browserslist
10
-
11
- last 1 Chrome version
12
- last 1 Firefox version
13
- last 2 Edge major versions
14
- last 2 Safari major versions
15
- last 2 iOS major versions
16
- Firefox ESR
@@ -1,5 +0,0 @@
1
- A library is a type of project that does not run independently.
2
- The library skeleton created by this command is placed by default in the `/projects` folder, and has `type` of "library".
3
-
4
- You can build a new library using the `ng build` command, run unit tests for it using the `ng test` command,
5
- and lint it using the `ng lint` command.