@schematics/angular 12.0.0-rc.3 → 12.0.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.
@@ -67,16 +67,7 @@ function addAppToWorkspaceFile(options, appDir) {
67
67
  schematics['@schematics/angular:component'] = componentSchematicsOptions;
68
68
  }
69
69
  if (options.skipTests || options.minimal) {
70
- [
71
- 'class',
72
- 'component',
73
- 'directive',
74
- 'guard',
75
- 'interceptor',
76
- 'module',
77
- 'pipe',
78
- 'service',
79
- ].forEach((type) => {
70
+ ['class', 'component', 'directive', 'guard', 'interceptor', 'pipe', 'service'].forEach((type) => {
80
71
  if (!(`@schematics/angular:${type}` in schematics)) {
81
72
  schematics[`@schematics/angular:${type}`] = {};
82
73
  }
@@ -77,7 +77,10 @@ function default_1(options) {
77
77
  return async (host) => {
78
78
  const workspace = await workspace_1.getWorkspace(host);
79
79
  const project = workspace.projects.get(options.project);
80
- if (options.path === undefined && project) {
80
+ if (!project) {
81
+ throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`);
82
+ }
83
+ if (options.path === undefined) {
81
84
  options.path = workspace_1.buildDefaultPath(project);
82
85
  }
83
86
  options.module = find_module_1.findModuleFromOptions(host, options);
@@ -78,7 +78,7 @@ function default_1(options) {
78
78
  const workspace = await workspace_1.getWorkspace(host);
79
79
  const project = workspace.projects.get(options.project);
80
80
  if (!project) {
81
- throw new schematics_1.SchematicsException(`Invalid project name (${options.project})`);
81
+ throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`);
82
82
  }
83
83
  if (options.path === undefined) {
84
84
  options.path = workspace_1.buildDefaultPath(project);
package/library/index.js CHANGED
@@ -149,7 +149,7 @@ function default_1(options) {
149
149
  commonModule: false,
150
150
  flat: true,
151
151
  path: sourceDir,
152
- project: options.name,
152
+ project: projectName,
153
153
  }),
154
154
  schematics_1.schematic('component', {
155
155
  name: options.name,
@@ -159,13 +159,13 @@ function default_1(options) {
159
159
  flat: true,
160
160
  path: sourceDir,
161
161
  export: true,
162
- project: options.name,
162
+ project: projectName,
163
163
  }),
164
164
  schematics_1.schematic('service', {
165
165
  name: options.name,
166
166
  flat: true,
167
167
  path: sourceDir,
168
- project: options.name,
168
+ project: projectName,
169
169
  }),
170
170
  options.lintFix ? lint_fix_1.applyLintFix(sourceDir) : schematics_1.noop(),
171
171
  (_tree, context) => {
@@ -115,6 +115,11 @@
115
115
  "factory": "./update-12/update-web-workers",
116
116
  "description": "Updates Web Worker consumer usage to use the new syntax supported directly by Webpack 5."
117
117
  },
118
+ "schematic-options-12": {
119
+ "version": "12.0.1",
120
+ "factory": "./update-12/schematic-options",
121
+ "description": "Remove invalid 'skipTests' option in '@schematics/angular:module' Angular schematic options."
122
+ },
118
123
  "production-by-default": {
119
124
  "version": "9999.0.0",
120
125
  "factory": "./update-12/production-default-config",
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { Rule } from '@angular-devkit/schematics';
9
+ export default function (): Rule;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const core_1 = require("@angular-devkit/core");
11
+ const workspace_1 = require("../../utility/workspace");
12
+ function default_1() {
13
+ return workspace_1.updateWorkspace((workspace) => {
14
+ // Update root level schematics options if present
15
+ const rootSchematics = workspace.extensions.schematics;
16
+ if (rootSchematics && core_1.json.isJsonObject(rootSchematics)) {
17
+ updateSchematicsField(rootSchematics);
18
+ }
19
+ // Update project level schematics options if present
20
+ for (const [, project] of workspace.projects) {
21
+ const projectSchematics = project.extensions.schematics;
22
+ if (projectSchematics && core_1.json.isJsonObject(projectSchematics)) {
23
+ updateSchematicsField(projectSchematics);
24
+ }
25
+ }
26
+ });
27
+ }
28
+ exports.default = default_1;
29
+ function updateSchematicsField(schematics) {
30
+ for (const [schematicName, schematicOptions] of Object.entries(schematics)) {
31
+ if (!core_1.json.isJsonObject(schematicOptions)) {
32
+ continue;
33
+ }
34
+ if (schematicName === '@schematics/angular:module') {
35
+ delete schematicOptions.skipTests;
36
+ }
37
+ }
38
+ }
@@ -46,6 +46,13 @@ function default_1() {
46
46
  }
47
47
  exports.default = default_1;
48
48
  function updateOptions(target, optionsToUpdate) {
49
+ // This is a hacky way to make this migration idempotent.
50
+ // `defaultConfiguration` was only introduced in v12 projects and hence v11 projects do not have this property.
51
+ // Setting it as an empty string will not cause any side-effect.
52
+ if (typeof target.defaultConfiguration === 'string') {
53
+ return;
54
+ }
55
+ target.defaultConfiguration = '';
49
56
  if (!target.options) {
50
57
  target.options = {};
51
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "12.0.0-rc.3",
3
+ "version": "12.0.3",
4
4
  "description": "Schematics specific to Angular",
5
5
  "homepage": "https://github.com/angular/angular-cli",
6
6
  "keywords": [
@@ -15,8 +15,8 @@
15
15
  ],
16
16
  "schematics": "./collection.json",
17
17
  "dependencies": {
18
- "@angular-devkit/core": "12.0.0-rc.3",
19
- "@angular-devkit/schematics": "12.0.0-rc.3",
18
+ "@angular-devkit/core": "12.0.3",
19
+ "@angular-devkit/schematics": "12.0.3",
20
20
  "jsonc-parser": "3.0.0"
21
21
  },
22
22
  "repository": {
@@ -24,7 +24,7 @@
24
24
  "url": "https://github.com/angular/angular-cli.git"
25
25
  },
26
26
  "engines": {
27
- "node": "^12.14.1 || ^14.0.0",
27
+ "node": "^12.14.1 || >=14.0.0",
28
28
  "npm": "^6.11.0 || ^7.5.6",
29
29
  "yarn": ">= 1.13.0"
30
30
  },
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.latestVersions = void 0;
11
11
  exports.latestVersions = {
12
12
  // These versions should be kept up to date with latest Angular peer dependencies.
13
- Angular: '~12.0.0-rc.3',
13
+ Angular: '~12.0.3',
14
14
  RxJs: '~6.6.0',
15
15
  ZoneJs: '~0.11.4',
16
16
  TypeScript: '~4.2.3',
@@ -19,5 +19,5 @@ exports.latestVersions = {
19
19
  // published together from the same monorepo, and they are both
20
20
  // non-experimental, they will always have the same version.
21
21
  DevkitBuildAngular: '~' + require('../package.json')['version'],
22
- ngPackagr: '^12.0.0-next.8',
22
+ ngPackagr: '^12.0.0',
23
23
  };
@@ -68,7 +68,7 @@ async function createDefaultPath(tree, projectName) {
68
68
  const workspace = await getWorkspace(tree);
69
69
  const project = workspace.projects.get(projectName);
70
70
  if (!project) {
71
- throw new Error('Specified project does not exist.');
71
+ throw new Error(`Project "${projectName}" does not exist.`);
72
72
  }
73
73
  return buildDefaultPath(project);
74
74
  }
@@ -12,7 +12,7 @@ Run `ng generate component component-name` to generate a new component. You can
12
12
 
13
13
  ## Build
14
14
 
15
- Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
15
+ Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
16
16
 
17
17
  ## Running unit tests
18
18
 
@@ -20,7 +20,7 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.
20
20
 
21
21
  ## Running end-to-end tests
22
22
 
23
- Run `ng e2e` to execute the end-to-end tests via a platform of your choice.
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.
24
24
 
25
25
  ## Further help
26
26