@angular/cli 8.3.2 → 8.3.6

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,16 +1,14 @@
1
1
  'use strict';
2
- // This file is ES6 because it needs to be executed as is.
2
+ // This file is ES5 because it needs to be executed as is.
3
3
 
4
- if ('NG_CLI_ANALYTICS' in process.env) {
4
+ if (process.env['NG_CLI_ANALYTICS'] !== undefined) {
5
5
  return;
6
6
  }
7
7
 
8
- (async () => {
9
- try {
10
- const analytics = require('../../models/analytics');
8
+ try {
9
+ var analytics = require('../../models/analytics');
11
10
 
12
- if (!analytics.hasGlobalAnalyticsConfiguration()) {
13
- await analytics.promptGlobalAnalytics();
14
- }
15
- } catch (_) {}
16
- })();
11
+ if (!analytics.hasGlobalAnalyticsConfiguration()) {
12
+ analytics.promptGlobalAnalytics().catch(function() { });
13
+ }
14
+ } catch (_) {}
@@ -75,7 +75,7 @@ class AddCommand extends schematic_command_1.SchematicCommand {
75
75
  }
76
76
  else if (!latestManifest || (await this.hasMismatchedPeer(latestManifest))) {
77
77
  // 'latest' is invalid so search for most recent matching package
78
- const versionManifests = Array.from(packageMetadata.versions.values()).filter(value => !semver_1.prerelease(value.version));
78
+ const versionManifests = Object.values(packageMetadata.versions).filter(value => !semver_1.prerelease(value.version));
79
79
  versionManifests.sort((a, b) => semver_1.rcompare(a.version, b.version, true));
80
80
  let newIdentifier;
81
81
  for (const versionManifest of versionManifests) {
@@ -10,12 +10,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  const child_process_1 = require("child_process");
11
11
  const fs = require("fs");
12
12
  const path = require("path");
13
- const semver = require("semver");
14
13
  const schematic_command_1 = require("../models/schematic-command");
15
14
  const package_manager_1 = require("../utilities/package-manager");
16
15
  const package_metadata_1 = require("../utilities/package-metadata");
17
16
  const package_tree_1 = require("../utilities/package-tree");
18
17
  const npa = require('npm-package-arg');
18
+ const pickManifest = require('npm-pick-manifest');
19
19
  const oldConfigFileNames = ['.angular-cli.json', 'angular-cli.json'];
20
20
  class UpdateCommand extends schematic_command_1.SchematicCommand {
21
21
  constructor() {
@@ -121,25 +121,25 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
121
121
  this.logger.warn('"next" option has no effect when using "migrate-only" option.');
122
122
  }
123
123
  const packageName = packages[0].name;
124
- let packageNode = rootDependencies[packageName];
125
- if (typeof packageNode === 'string') {
124
+ const packageDependency = rootDependencies[packageName];
125
+ let packageNode = packageDependency && packageDependency.node;
126
+ if (packageDependency && !packageNode) {
126
127
  this.logger.error('Package found in package.json but is not installed.');
127
128
  return 1;
128
129
  }
129
- else if (!packageNode) {
130
+ else if (!packageDependency) {
130
131
  // Allow running migrations on transitively installed dependencies
131
132
  // There can technically be nested multiple versions
132
133
  // TODO: If multiple, this should find all versions and ask which one to use
133
134
  const child = packageTree.children.find(c => c.name === packageName);
134
135
  if (child) {
135
- // A link represents a symlinked package so use the actual in this case
136
- packageNode = child.isLink ? child.target : child;
137
- }
138
- if (!packageNode) {
139
- this.logger.error('Package is not installed.');
140
- return 1;
136
+ packageNode = child;
141
137
  }
142
138
  }
139
+ if (!packageNode) {
140
+ this.logger.error('Package is not installed.');
141
+ return 1;
142
+ }
143
143
  const updateMetadata = packageNode.package['ng-update'];
144
144
  let migrations = updateMetadata && updateMetadata.migrations;
145
145
  if (migrations === undefined) {
@@ -200,15 +200,13 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
200
200
  const requests = [];
201
201
  // Validate packages actually are part of the workspace
202
202
  for (const pkg of packages) {
203
- const node = rootDependencies[pkg.name];
203
+ const node = rootDependencies[pkg.name] && rootDependencies[pkg.name].node;
204
204
  if (!node) {
205
205
  this.logger.error(`Package '${pkg.name}' is not a dependency.`);
206
206
  return 1;
207
207
  }
208
208
  // If a specific version is requested and matches the installed version, skip.
209
- if (pkg.type === 'version' &&
210
- typeof node === 'object' &&
211
- node.package.version === pkg.fetchSpec) {
209
+ if (pkg.type === 'version' && node.package.version === pkg.fetchSpec) {
212
210
  this.logger.info(`Package '${pkg.name}' is already at '${pkg.fetchSpec}'.`);
213
211
  continue;
214
212
  }
@@ -234,24 +232,39 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
234
232
  // Try to find a package version based on the user requested package specifier
235
233
  // registry specifier types are either version, range, or tag
236
234
  let manifest;
237
- if (requestIdentifier.type === 'version') {
238
- manifest = metadata.versions.get(requestIdentifier.fetchSpec);
239
- }
240
- else if (requestIdentifier.type === 'range') {
241
- const maxVersion = semver.maxSatisfying(Array.from(metadata.versions.keys()), requestIdentifier.fetchSpec);
242
- if (maxVersion) {
243
- manifest = metadata.versions.get(maxVersion);
235
+ if (requestIdentifier.type === 'version' ||
236
+ requestIdentifier.type === 'range' ||
237
+ requestIdentifier.type === 'tag') {
238
+ try {
239
+ manifest = pickManifest(metadata, requestIdentifier.fetchSpec);
240
+ }
241
+ catch (e) {
242
+ if (e.code === 'ETARGET') {
243
+ // If not found and next was used and user did not provide a specifier, try latest.
244
+ // Package may not have a next tag.
245
+ if (requestIdentifier.type === 'tag' &&
246
+ requestIdentifier.fetchSpec === 'next' &&
247
+ !requestIdentifier.rawSpec) {
248
+ try {
249
+ manifest = pickManifest(metadata, 'latest');
250
+ }
251
+ catch (e) {
252
+ if (e.code !== 'ETARGET' && e.code !== 'ENOVERSIONS') {
253
+ throw e;
254
+ }
255
+ }
256
+ }
257
+ }
258
+ else if (e.code !== 'ENOVERSIONS') {
259
+ throw e;
260
+ }
244
261
  }
245
- }
246
- else if (requestIdentifier.type === 'tag') {
247
- manifest = metadata.tags[requestIdentifier.fetchSpec];
248
262
  }
249
263
  if (!manifest) {
250
264
  this.logger.error(`Package specified by '${requestIdentifier.raw}' does not exist within the registry.`);
251
265
  return 1;
252
266
  }
253
- if ((typeof node === 'string' && manifest.version === node) ||
254
- (typeof node === 'object' && manifest.version === node.package.version)) {
267
+ if (manifest.version === node.package.version) {
255
268
  this.logger.info(`Package '${packageName}' is already up to date.`);
256
269
  continue;
257
270
  }
@@ -847,8 +847,31 @@
847
847
  "default": false
848
848
  },
849
849
  "index": {
850
- "type": "string",
851
- "description": "The name of the index HTML file."
850
+ "description": "Configures the generation of the application's HTML index.",
851
+ "oneOf": [
852
+ {
853
+ "type": "string",
854
+ "description": "The path of a file to use for the application's HTML index. The filename of the specified path will be used for the generated file and will be created in the root of the application's configured output path."
855
+ },
856
+ {
857
+ "type": "object",
858
+ "description": "",
859
+ "properties": {
860
+ "input": {
861
+ "type": "string",
862
+ "minLength": 1,
863
+ "description": "The path of a file to use for the application's generated HTML index."
864
+ },
865
+ "output": {
866
+ "type": "string",
867
+ "minLength": 1,
868
+ "default": "index.html",
869
+ "description": "The output path of the application's generated HTML index file. The full provided path will be used and will be considered relative to the application's configured output path."
870
+ }
871
+ },
872
+ "required": ["input"]
873
+ }
874
+ ]
852
875
  },
853
876
  "statsJson": {
854
877
  "type": "boolean",
package/models/parser.js CHANGED
@@ -164,7 +164,7 @@ function _assignOption(arg, nextArg, { options, parsedOptions, leftovers, ignore
164
164
  const v = _coerce(value, option, parsedOptions[option.name]);
165
165
  if (v !== undefined) {
166
166
  if (parsedOptions[option.name] !== v) {
167
- if (parsedOptions[option.name] !== undefined) {
167
+ if (parsedOptions[option.name] !== undefined && option.type !== interface_1.OptionType.Array) {
168
168
  warnings.push(`Option ${JSON.stringify(option.name)} was already specified with value `
169
169
  + `${JSON.stringify(parsedOptions[option.name])}. The new value ${JSON.stringify(v)} `
170
170
  + `will override it.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cli",
3
- "version": "8.3.2",
3
+ "version": "8.3.6",
4
4
  "description": "CLI tool for Angular",
5
5
  "main": "lib/cli/index.js",
6
6
  "bin": {
@@ -28,17 +28,18 @@
28
28
  },
29
29
  "homepage": "https://github.com/angular/angular-cli",
30
30
  "dependencies": {
31
- "@angular-devkit/architect": "0.803.2",
32
- "@angular-devkit/core": "8.3.2",
33
- "@angular-devkit/schematics": "8.3.2",
34
- "@schematics/angular": "8.3.2",
35
- "@schematics/update": "0.803.2",
31
+ "@angular-devkit/architect": "0.803.6",
32
+ "@angular-devkit/core": "8.3.6",
33
+ "@angular-devkit/schematics": "8.3.6",
34
+ "@schematics/angular": "8.3.6",
35
+ "@schematics/update": "0.803.6",
36
36
  "@yarnpkg/lockfile": "1.1.0",
37
37
  "ansi-colors": "4.1.1",
38
38
  "debug": "^4.1.1",
39
39
  "ini": "1.3.5",
40
40
  "inquirer": "6.5.1",
41
41
  "npm-package-arg": "6.1.0",
42
+ "npm-pick-manifest": "3.0.2",
42
43
  "open": "6.4.0",
43
44
  "pacote": "9.5.5",
44
45
  "read-package-tree": "5.3.1",
@@ -50,10 +51,10 @@
50
51
  "ng-update": {
51
52
  "migrations": "@schematics/angular/migrations/migration-collection.json",
52
53
  "packageGroup": {
53
- "@angular/cli": "8.3.2",
54
- "@angular-devkit/build-angular": "0.803.2",
55
- "@angular-devkit/build-ng-packagr": "0.803.2",
56
- "@angular-devkit/build-webpack": "0.803.2"
54
+ "@angular/cli": "8.3.6",
55
+ "@angular-devkit/build-angular": "0.803.6",
56
+ "@angular-devkit/build-ng-packagr": "0.803.6",
57
+ "@angular-devkit/build-webpack": "0.803.6"
57
58
  }
58
59
  },
59
60
  "engines": {
@@ -41,7 +41,7 @@ export interface PackageMetadata {
41
41
  tags: {
42
42
  [tag: string]: PackageManifest | undefined;
43
43
  };
44
- versions: Map<string, PackageManifest>;
44
+ versions: Record<string, PackageManifest>;
45
45
  }
46
46
  export declare function fetchPackageMetadata(name: string, logger: logging.LoggerApi, options?: {
47
47
  registry?: string;
@@ -39,9 +39,7 @@ function readOptions(logger, yarn = false, showPotentials = false) {
39
39
  path.join(globalPrefix, 'etc', baseFilename),
40
40
  path.join(os_1.homedir(), dotFilename),
41
41
  ];
42
- const projectConfigLocations = [
43
- path.join(cwd, dotFilename),
44
- ];
42
+ const projectConfigLocations = [path.join(cwd, dotFilename)];
45
43
  const root = path.parse(cwd).root;
46
44
  for (let curDir = path.dirname(cwd); curDir && curDir !== root; curDir = path.dirname(curDir)) {
47
45
  projectConfigLocations.unshift(path.join(curDir, dotFilename));
@@ -109,16 +107,19 @@ async function fetchPackageMetadata(name, logger, options) {
109
107
  const metadata = {
110
108
  name: response.name,
111
109
  tags: {},
112
- versions: new Map(),
110
+ versions: {},
113
111
  };
114
112
  if (response.versions) {
115
113
  for (const [version, manifest] of Object.entries(response.versions)) {
116
- metadata.versions.set(version, normalizeManifest(manifest));
114
+ metadata.versions[version] = normalizeManifest(manifest);
117
115
  }
118
116
  }
119
117
  if (response['dist-tags']) {
118
+ // Store this for use with other npm utility packages
119
+ // tslint:disable-next-line: no-any
120
+ metadata['dist-tags'] = response['dist-tags'];
120
121
  for (const [tag, version] of Object.entries(response['dist-tags'])) {
121
- const manifest = metadata.versions.get(version);
122
+ const manifest = metadata.versions[version];
122
123
  if (manifest) {
123
124
  metadata.tags[tag] = manifest;
124
125
  }
@@ -18,21 +18,25 @@ export interface PackageTreeNodeBase {
18
18
  dependencies?: Record<string, string>;
19
19
  devDependencies?: Record<string, string>;
20
20
  peerDependencies?: Record<string, string>;
21
+ optionalDependencies?: Record<string, string>;
21
22
  'ng-update'?: {
22
23
  migrations?: string;
23
24
  };
24
25
  };
26
+ parent?: PackageTreeNode;
25
27
  children: PackageTreeNode[];
26
28
  }
27
29
  export interface PackageTreeActual extends PackageTreeNodeBase {
28
30
  isLink: false;
29
- parent?: PackageTreeActual;
30
31
  }
31
32
  export interface PackageTreeLink extends PackageTreeNodeBase {
32
33
  isLink: true;
33
- parent: null;
34
34
  target: PackageTreeActual;
35
35
  }
36
36
  export declare type PackageTreeNode = PackageTreeActual | PackageTreeLink;
37
37
  export declare function readPackageTree(path: string): Promise<PackageTreeNode>;
38
- export declare function findNodeDependencies(root: PackageTreeNode, node?: PackageTreeNode): Record<string, string | PackageTreeActual | undefined>;
38
+ export interface NodeDependency {
39
+ version: string;
40
+ node?: PackageTreeNode;
41
+ }
42
+ export declare function findNodeDependencies(node: PackageTreeNode): Record<string, NodeDependency>;
@@ -14,19 +14,25 @@ function readPackageTree(path) {
14
14
  });
15
15
  }
16
16
  exports.readPackageTree = readPackageTree;
17
- function findNodeDependencies(root, node = root) {
18
- const actual = node.isLink ? node.target : node;
17
+ function findNodeDependencies(node) {
19
18
  const rawDeps = {
20
- ...actual.package.dependencies,
21
- ...actual.package.devDependencies,
22
- ...actual.package.peerDependencies,
19
+ ...node.package.dependencies,
20
+ ...node.package.devDependencies,
21
+ ...node.package.peerDependencies,
22
+ ...node.package.optionalDependencies,
23
23
  };
24
24
  return Object.entries(rawDeps).reduce((deps, [name, version]) => {
25
- const depNode = root.children.find(child => {
26
- return child.name === name && !child.isLink && child.parent === node;
27
- });
28
- deps[name] = depNode || version;
25
+ let dependencyNode;
26
+ let parent = node;
27
+ while (!dependencyNode && parent) {
28
+ dependencyNode = parent.children.find(child => child.name === name);
29
+ parent = parent.parent;
30
+ }
31
+ deps[name] = {
32
+ node: dependencyNode,
33
+ version,
34
+ };
29
35
  return deps;
30
- }, {});
36
+ }, Object.create(null));
31
37
  }
32
38
  exports.findNodeDependencies = findNodeDependencies;