@schematics/angular 12.0.1 → 12.0.5

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.
@@ -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) => {
@@ -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.1",
3
+ "version": "12.0.5",
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.1",
19
- "@angular-devkit/schematics": "12.0.1",
18
+ "@angular-devkit/core": "12.0.5",
19
+ "@angular-devkit/schematics": "12.0.5",
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.1',
13
+ Angular: '~12.0.5',
14
14
  RxJs: '~6.6.0',
15
15
  ZoneJs: '~0.11.4',
16
16
  TypeScript: '~4.2.3',
@@ -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
  }
@@ -97,8 +97,7 @@ function default_1(options) {
97
97
  if (!projectTarget) {
98
98
  throw new Error(`Target is not defined for this project.`);
99
99
  }
100
- const projectTargetOptions = (projectTarget.options ||
101
- {});
100
+ const projectTargetOptions = (projectTarget.options || {});
102
101
  if (options.path === undefined) {
103
102
  options.path = workspace_1.buildDefaultPath(project);
104
103
  }
@@ -111,6 +110,16 @@ function default_1(options) {
111
110
  const workerConfigPath = core_1.join(core_1.normalize(root), 'tsconfig.worker.json');
112
111
  projectTargetOptions.webWorkerTsConfig = workerConfigPath;
113
112
  }
113
+ const projectTestTarget = project.targets.get('test');
114
+ if (projectTestTarget) {
115
+ const projectTestTargetOptions = (projectTestTarget.options ||
116
+ {});
117
+ const needWebWorkerConfig = !projectTestTargetOptions.webWorkerTsConfig;
118
+ if (needWebWorkerConfig) {
119
+ const workerConfigPath = core_1.join(core_1.normalize(root), 'tsconfig.worker.json');
120
+ projectTestTargetOptions.webWorkerTsConfig = workerConfigPath;
121
+ }
122
+ }
114
123
  const templateSource = schematics_1.apply(schematics_1.url('./files/worker'), [
115
124
  schematics_1.applyTemplates({ ...options, ...core_1.strings }),
116
125
  schematics_1.move(parsedPath.path),