@angular/cli 13.0.2 → 13.1.0-next.2

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.
@@ -597,6 +597,7 @@
597
597
  "name": {
598
598
  "description": "The name of the new app.",
599
599
  "type": "string",
600
+ "pattern": "^(?:@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*/)?[a-zA-Z0-9-~][a-zA-Z0-9-._~]*$",
600
601
  "$default": {
601
602
  "$source": "argv",
602
603
  "index": 0
@@ -1151,6 +1152,7 @@
1151
1152
  "name": {
1152
1153
  "type": "string",
1153
1154
  "description": "The name of the library.",
1155
+ "pattern": "^(?:@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*/)?[a-zA-Z0-9-~][a-zA-Z0-9-._~]*$",
1154
1156
  "$default": {
1155
1157
  "$source": "argv",
1156
1158
  "index": 0
@@ -1258,7 +1260,6 @@
1258
1260
  "name": {
1259
1261
  "description": "The name of the new workspace and initial project.",
1260
1262
  "type": "string",
1261
- "format": "html-selector",
1262
1263
  "$default": {
1263
1264
  "$source": "argv",
1264
1265
  "index": 0
@@ -484,7 +484,7 @@ export interface LibraryOptionsSchema {
484
484
  /**
485
485
  * The name of the library.
486
486
  */
487
- name?: string;
487
+ name: string;
488
488
  /**
489
489
  * A prefix to apply to generated selectors.
490
490
  */
@@ -25,6 +25,7 @@ export declare abstract class ArchitectCommand<T extends ArchitectCommandOptions
25
25
  target: string | undefined;
26
26
  missingTargetError: string | undefined;
27
27
  initialize(options: T & Arguments): Promise<number | void>;
28
+ private warnOnMissingNodeModules;
28
29
  run(options: ArchitectCommandOptions & Arguments): Promise<number>;
29
30
  protected runSingleTarget(target: Target, targetOptions: string[]): Promise<0 | 1>;
30
31
  protected runArchitectTarget(options: ArchitectCommandOptions & Arguments): Promise<number>;
@@ -6,12 +6,34 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
9
28
  Object.defineProperty(exports, "__esModule", { value: true });
10
29
  exports.ArchitectCommand = void 0;
11
30
  const architect_1 = require("@angular-devkit/architect");
12
31
  const node_1 = require("@angular-devkit/architect/node");
13
32
  const core_1 = require("@angular-devkit/core");
33
+ const fs_1 = require("fs");
34
+ const path = __importStar(require("path"));
14
35
  const json_schema_1 = require("../utilities/json-schema");
36
+ const package_manager_1 = require("../utilities/package-manager");
15
37
  const analytics_1 = require("./analytics");
16
38
  const command_1 = require("./command");
17
39
  const parser_1 = require("./parser");
@@ -77,7 +99,18 @@ class ArchitectCommand extends command_1.Command {
77
99
  if (this.multiTarget) {
78
100
  builderNames.add(builderName);
79
101
  }
80
- const builderDesc = await this._architectHost.resolveBuilder(builderName);
102
+ let builderDesc;
103
+ try {
104
+ builderDesc = await this._architectHost.resolveBuilder(builderName);
105
+ }
106
+ catch (e) {
107
+ if (e.code === 'MODULE_NOT_FOUND') {
108
+ await this.warnOnMissingNodeModules(this.workspace.basePath);
109
+ this.logger.fatal(`Could not find the '${builderName}' builder's node package.`);
110
+ return 1;
111
+ }
112
+ throw e;
113
+ }
81
114
  const optionDefs = await (0, json_schema_1.parseJsonSchemaToOptions)(this._registry, builderDesc.optionSchema);
82
115
  const parsedOptions = (0, parser_1.parseArguments)([...commandLeftovers], optionDefs);
83
116
  const builderLeftovers = parsedOptions['--'] || [];
@@ -142,7 +175,18 @@ class ArchitectCommand extends command_1.Command {
142
175
  project: projectName || (targetProjectNames.length > 0 ? targetProjectNames[0] : ''),
143
176
  target: this.target,
144
177
  });
145
- const builderDesc = await this._architectHost.resolveBuilder(builderConf);
178
+ let builderDesc;
179
+ try {
180
+ builderDesc = await this._architectHost.resolveBuilder(builderConf);
181
+ }
182
+ catch (e) {
183
+ if (e.code === 'MODULE_NOT_FOUND') {
184
+ await this.warnOnMissingNodeModules(this.workspace.basePath);
185
+ this.logger.fatal(`Could not find the '${builderConf}' builder's node package.`);
186
+ return 1;
187
+ }
188
+ throw e;
189
+ }
146
190
  this.description.options.push(...(await (0, json_schema_1.parseJsonSchemaToOptions)(this._registry, builderDesc.optionSchema)));
147
191
  // Update options to remove analytics from options if the builder isn't safelisted.
148
192
  for (const o of this.description.options) {
@@ -151,6 +195,32 @@ class ArchitectCommand extends command_1.Command {
151
195
  }
152
196
  }
153
197
  }
198
+ async warnOnMissingNodeModules(basePath) {
199
+ // Check for a `node_modules` directory (npm, yarn non-PnP, etc.)
200
+ if ((0, fs_1.existsSync)(path.resolve(basePath, 'node_modules'))) {
201
+ return;
202
+ }
203
+ // Check for yarn PnP files
204
+ if ((0, fs_1.existsSync)(path.resolve(basePath, '.pnp.js')) ||
205
+ (0, fs_1.existsSync)(path.resolve(basePath, '.pnp.cjs')) ||
206
+ (0, fs_1.existsSync)(path.resolve(basePath, '.pnp.mjs'))) {
207
+ return;
208
+ }
209
+ const packageManager = await (0, package_manager_1.getPackageManager)(basePath);
210
+ let installSuggestion = 'Try installing with ';
211
+ switch (packageManager) {
212
+ case 'npm':
213
+ installSuggestion += `'npm install'`;
214
+ break;
215
+ case 'yarn':
216
+ installSuggestion += `'yarn'`;
217
+ break;
218
+ default:
219
+ installSuggestion += `the project's package manager`;
220
+ break;
221
+ }
222
+ this.logger.warn(`Node packages may not be installed. ${installSuggestion}.`);
223
+ }
154
224
  async run(options) {
155
225
  return await this.runArchitectTarget(options);
156
226
  }
@@ -159,7 +229,19 @@ class ArchitectCommand extends command_1.Command {
159
229
  // overrides separately (getting the configuration builds the whole project, including
160
230
  // overrides).
161
231
  const builderConf = await this._architectHost.getBuilderNameForTarget(target);
162
- const builderDesc = await this._architectHost.resolveBuilder(builderConf);
232
+ let builderDesc;
233
+ try {
234
+ builderDesc = await this._architectHost.resolveBuilder(builderConf);
235
+ }
236
+ catch (e) {
237
+ if (e.code === 'MODULE_NOT_FOUND') {
238
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
239
+ await this.warnOnMissingNodeModules(this.workspace.basePath);
240
+ this.logger.fatal(`Could not find the '${builderConf}' builder's node package.`);
241
+ return 1;
242
+ }
243
+ throw e;
244
+ }
163
245
  const targetOptionArray = await (0, json_schema_1.parseJsonSchemaToOptions)(this._registry, builderDesc.optionSchema);
164
246
  const overrides = (0, parser_1.parseArguments)(targetOptions, targetOptionArray, this.logger);
165
247
  const allowAdditionalProperties = typeof builderDesc.optionSchema === 'object' && builderDesc.optionSchema.additionalProperties;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cli",
3
- "version": "13.0.2",
3
+ "version": "13.1.0-next.2",
4
4
  "description": "CLI tool for Angular",
5
5
  "main": "lib/cli/index.js",
6
6
  "bin": {
@@ -28,10 +28,10 @@
28
28
  },
29
29
  "homepage": "https://github.com/angular/angular-cli",
30
30
  "dependencies": {
31
- "@angular-devkit/architect": "0.1300.2",
32
- "@angular-devkit/core": "13.0.2",
33
- "@angular-devkit/schematics": "13.0.2",
34
- "@schematics/angular": "13.0.2",
31
+ "@angular-devkit/architect": "0.1301.0-next.2",
32
+ "@angular-devkit/core": "13.1.0-next.2",
33
+ "@angular-devkit/schematics": "13.1.0-next.2",
34
+ "@schematics/angular": "13.1.0-next.2",
35
35
  "@yarnpkg/lockfile": "1.1.0",
36
36
  "ansi-colors": "4.1.1",
37
37
  "debug": "4.3.2",
@@ -51,12 +51,12 @@
51
51
  "ng-update": {
52
52
  "migrations": "@schematics/angular/migrations/migration-collection.json",
53
53
  "packageGroup": {
54
- "@angular/cli": "13.0.2",
55
- "@angular-devkit/architect": "0.1300.2",
56
- "@angular-devkit/build-angular": "13.0.2",
57
- "@angular-devkit/build-webpack": "0.1300.2",
58
- "@angular-devkit/core": "13.0.2",
59
- "@angular-devkit/schematics": "13.0.2"
54
+ "@angular/cli": "13.1.0-next.2",
55
+ "@angular-devkit/architect": "0.1301.0-next.2",
56
+ "@angular-devkit/build-angular": "13.1.0-next.2",
57
+ "@angular-devkit/build-webpack": "0.1301.0-next.2",
58
+ "@angular-devkit/core": "13.1.0-next.2",
59
+ "@angular-devkit/schematics": "13.1.0-next.2"
60
60
  }
61
61
  },
62
62
  "engines": {