@angular/cli 8.1.0-beta.3 → 8.1.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.
@@ -14,6 +14,7 @@ const semver_1 = require("semver");
14
14
  const analytics_1 = require("../models/analytics");
15
15
  const schematic_command_1 = require("../models/schematic-command");
16
16
  const npm_install_1 = require("../tasks/npm-install");
17
+ const color_1 = require("../utilities/color");
17
18
  const package_manager_1 = require("../utilities/package-manager");
18
19
  const package_metadata_1 = require("../utilities/package-metadata");
19
20
  const npa = require('npm-package-arg');
@@ -26,8 +27,8 @@ class AddCommand extends schematic_command_1.SchematicCommand {
26
27
  }
27
28
  async run(options) {
28
29
  if (!options.collection) {
29
- this.logger.fatal(`The "ng add" command requires a name argument to be specified eg. `
30
- + `${core_1.terminal.yellow('ng add [name] ')}. For more details, use "ng help".`);
30
+ this.logger.fatal(`The "ng add" command requires a name argument to be specified eg. ` +
31
+ `${color_1.colors.yellow('ng add [name] ')}. For more details, use "ng help".`);
31
32
  return 1;
32
33
  }
33
34
  let packageIdentifier;
@@ -49,7 +50,11 @@ class AddCommand extends schematic_command_1.SchematicCommand {
49
50
  // plus special cases for packages that did not have peer deps setup
50
51
  let packageMetadata;
51
52
  try {
52
- packageMetadata = await package_metadata_1.fetchPackageMetadata(packageIdentifier.name, this.logger, { registry: options.registry, usingYarn });
53
+ packageMetadata = await package_metadata_1.fetchPackageMetadata(packageIdentifier.name, this.logger, {
54
+ registry: options.registry,
55
+ usingYarn,
56
+ verbose: options.verbose,
57
+ });
53
58
  }
54
59
  catch (e) {
55
60
  this.logger.error('Unable to fetch package metadata: ' + e.message);
@@ -61,17 +66,16 @@ class AddCommand extends schematic_command_1.SchematicCommand {
61
66
  const version = await this.findProjectVersion('@angular/cli');
62
67
  // tslint:disable-next-line:no-any
63
68
  const semverOptions = { includePrerelease: true };
64
- if (version
65
- && ((semver_1.validRange(version) && semver_1.intersects(version, '7', semverOptions))
66
- || (semver_1.valid(version) && semver_1.satisfies(version, '7', semverOptions)))) {
69
+ if (version &&
70
+ ((semver_1.validRange(version) && semver_1.intersects(version, '7', semverOptions)) ||
71
+ (semver_1.valid(version) && semver_1.satisfies(version, '7', semverOptions)))) {
67
72
  packageIdentifier = npa.resolve('@angular/pwa', '0.12');
68
73
  }
69
74
  }
70
75
  }
71
76
  else if (!latestManifest || (await this.hasMismatchedPeer(latestManifest))) {
72
77
  // 'latest' is invalid so search for most recent matching package
73
- const versionManifests = Array.from(packageMetadata.versions.values())
74
- .filter(value => !semver_1.prerelease(value.version));
78
+ const versionManifests = Array.from(packageMetadata.versions.values()).filter(value => !semver_1.prerelease(value.version));
75
79
  versionManifests.sort((a, b) => semver_1.rcompare(a.version, b.version, true));
76
80
  let newIdentifier;
77
81
  for (const versionManifest of versionManifests) {
@@ -81,7 +85,7 @@ class AddCommand extends schematic_command_1.SchematicCommand {
81
85
  }
82
86
  }
83
87
  if (!newIdentifier) {
84
- this.logger.warn('Unable to find compatible package. Using \'latest\'.');
88
+ this.logger.warn("Unable to find compatible package. Using 'latest'.");
85
89
  }
86
90
  else {
87
91
  packageIdentifier = newIdentifier;
@@ -91,10 +95,14 @@ class AddCommand extends schematic_command_1.SchematicCommand {
91
95
  let collectionName = packageIdentifier.name;
92
96
  if (!packageIdentifier.registry) {
93
97
  try {
94
- const manifest = await package_metadata_1.fetchPackageManifest(packageIdentifier, this.logger, { registry: options.registry, usingYarn });
98
+ const manifest = await package_metadata_1.fetchPackageManifest(packageIdentifier, this.logger, {
99
+ registry: options.registry,
100
+ verbose: options.verbose,
101
+ usingYarn,
102
+ });
95
103
  collectionName = manifest.name;
96
104
  if (await this.hasMismatchedPeer(manifest)) {
97
- console.warn('Package has unmet peer dependencies. Adding the package may not succeed.');
105
+ this.logger.warn('Package has unmet peer dependencies. Adding the package may not succeed.');
98
106
  }
99
107
  }
100
108
  catch (e) {
@@ -131,10 +139,8 @@ class AddCommand extends schematic_command_1.SchematicCommand {
131
139
  async executeSchematic(collectionName, options = []) {
132
140
  const runOptions = {
133
141
  schematicOptions: options,
134
- workingDir: this.workspace.root,
135
142
  collectionName,
136
143
  schematicName: 'ng-add',
137
- allowPrivate: true,
138
144
  dryRun: false,
139
145
  force: false,
140
146
  };
@@ -155,7 +161,9 @@ class AddCommand extends schematic_command_1.SchematicCommand {
155
161
  async findProjectVersion(name) {
156
162
  let installedPackage;
157
163
  try {
158
- installedPackage = require.resolve(path_1.join(name, 'package.json'), { paths: [this.workspace.root] });
164
+ installedPackage = require.resolve(path_1.join(name, 'package.json'), {
165
+ paths: [this.workspace.root],
166
+ });
159
167
  }
160
168
  catch (_a) { }
161
169
  if (installedPackage) {
@@ -196,8 +204,8 @@ class AddCommand extends schematic_command_1.SchematicCommand {
196
204
  }
197
205
  // tslint:disable-next-line:no-any
198
206
  const options = { includePrerelease: true };
199
- if (!semver_1.intersects(version, peerIdentifier.rawSpec, options)
200
- && !semver_1.satisfies(version, peerIdentifier.rawSpec, options)) {
207
+ if (!semver_1.intersects(version, peerIdentifier.rawSpec, options) &&
208
+ !semver_1.satisfies(version, peerIdentifier.rawSpec, options)) {
201
209
  return true;
202
210
  }
203
211
  }
package/commands/add.d.ts CHANGED
@@ -22,6 +22,10 @@ export interface Schema {
22
22
  * The NPM registry to use.
23
23
  */
24
24
  registry?: string;
25
+ /**
26
+ * Display additional details about internal operations during execution.
27
+ */
28
+ verbose?: boolean;
25
29
  }
26
30
  /**
27
31
  * Shows a help message for this command in the console.
package/commands/add.json CHANGED
@@ -30,6 +30,11 @@
30
30
  "format": "hostname"
31
31
  }
32
32
  ]
33
+ },
34
+ "verbose": {
35
+ "description": "Display additional details about internal operations during execution.",
36
+ "type": "boolean",
37
+ "default": false
33
38
  }
34
39
  },
35
40
  "required": [
@@ -0,0 +1,7 @@
1
+ The value of *settingOrProject* is one of the following.
2
+ * "on" : Enables analytics gathering and reporting for the user.
3
+ * "off" : Disables analytics gathering and reporting for the user.
4
+ * "ci" : Enables analytics and configures reporting for use with Continuous Integration,
5
+ which uses a common CI user.
6
+ * "prompt" : Prompts the user to set the status interactively.
7
+ * "project" : Sets the default status for the project to the *projectSetting* value, which can be any of the other values. The *projectSetting* argument is ignored for all other values of *settingOrProject*.
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json-schema.org/schema",
3
3
  "$id": "ng-cli://commands/analytics.json",
4
4
  "description": "Configures the gathering of Angular CLI usage metrics. See https://v8.angular.io/cli/usage-analytics-gathering.",
5
- "$longDescription": "",
5
+ "$longDescription": "./analytics-long.md",
6
6
 
7
7
  "$aliases": [],
8
8
  "$scope": "all",
@@ -17,12 +17,28 @@ class DocCommand extends command_1.Command {
17
17
  }
18
18
  let domain = 'angular.io';
19
19
  if (options.version) {
20
+ // version can either be a string containing "next"
20
21
  if (options.version == 'next') {
21
22
  domain = 'next.angular.io';
23
+ // or a number where version must be a valid Angular version (i.e. not 0, 1 or 3)
22
24
  }
23
- else {
25
+ else if (!isNaN(+options.version) && ![0, 1, 3].includes(+options.version)) {
24
26
  domain = `v${options.version}.angular.io`;
25
27
  }
28
+ else {
29
+ this.logger.error('Version should either be a number (2, 4, 5, 6...) or "next"');
30
+ return 0;
31
+ }
32
+ }
33
+ else {
34
+ // we try to get the current Angular version of the project
35
+ // and use it if we can find it
36
+ try {
37
+ /* tslint:disable-next-line:no-implicit-dependencies */
38
+ const currentNgVersion = require('@angular/core').VERSION.major;
39
+ domain = `v${currentNgVersion}.angular.io`;
40
+ }
41
+ catch (e) { }
26
42
  }
27
43
  let searchUrl = `https://${domain}/api?query=${options.keyword}`;
28
44
  if (options.search) {
package/commands/doc.d.ts CHANGED
@@ -17,9 +17,10 @@ export interface Schema {
17
17
  */
18
18
  search?: boolean;
19
19
  /**
20
- * Contains the version of Angular to use for the documentation.
20
+ * Contains the version of Angular to use for the documentation. If not provided, the
21
+ * command uses your current Angular core version.
21
22
  */
22
- version?: any;
23
+ version?: VersionUnion;
23
24
  }
24
25
  /**
25
26
  * Shows a help message for this command in the console.
@@ -29,3 +30,11 @@ export declare enum HelpEnum {
29
30
  HelpJson = "JSON",
30
31
  Json = "json"
31
32
  }
33
+ /**
34
+ * Contains the version of Angular to use for the documentation. If not provided, the
35
+ * command uses your current Angular core version.
36
+ */
37
+ export declare type VersionUnion = number | VersionEnum;
38
+ export declare enum VersionEnum {
39
+ Next = "next"
40
+ }
package/commands/doc.js CHANGED
@@ -7,3 +7,7 @@ var HelpEnum;
7
7
  HelpEnum["HelpJson"] = "JSON";
8
8
  HelpEnum["Json"] = "json";
9
9
  })(HelpEnum = exports.HelpEnum || (exports.HelpEnum = {}));
10
+ var VersionEnum;
11
+ (function (VersionEnum) {
12
+ VersionEnum["Next"] = "next";
13
+ })(VersionEnum = exports.VersionEnum || (exports.VersionEnum = {}));
package/commands/doc.json CHANGED
@@ -27,19 +27,16 @@
27
27
  "description": "When true, searches all of angular.io. Otherwise, searches only API reference documentation."
28
28
  },
29
29
  "version" : {
30
- "anyOf": [
30
+ "oneOf": [
31
31
  {
32
- "const" : 2
33
- },
34
- {
35
- "type" : "integer",
32
+ "type": "number",
36
33
  "minimum": 4
37
34
  },
38
35
  {
39
- "const": "next"
36
+ "enum": [2, "next"]
40
37
  }
41
38
  ],
42
- "description": "Contains the version of Angular to use for the documentation."
39
+ "description": "Contains the version of Angular to use for the documentation. If not provided, the command uses your current Angular core version."
43
40
  }
44
41
  },
45
42
  "required": [
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  /**
3
4
  * @license
4
5
  * Copyright Google Inc. All Rights Reserved.
@@ -6,9 +7,8 @@
6
7
  * Use of this source code is governed by an MIT-style license that can be
7
8
  * found in the LICENSE file at https://angular.io/license
8
9
  */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const core_1 = require("@angular-devkit/core");
11
10
  const command_1 = require("../models/command");
11
+ const color_1 = require("../utilities/color");
12
12
  function pickOne(of) {
13
13
  return of[Math.floor(Math.random() * of.length)];
14
14
  }
@@ -24,7 +24,7 @@ class AwesomeCommand extends command_1.Command {
24
24
  `I spy with my little eye a great developer!`,
25
25
  `Noop... already awesome.`,
26
26
  ]);
27
- this.logger.info(core_1.terminal.green(phrase));
27
+ this.logger.info(color_1.colors.green(phrase));
28
28
  }
29
29
  }
30
30
  exports.AwesomeCommand = AwesomeCommand;
@@ -1,14 +1,7 @@
1
1
  "use strict";
2
- /**
3
- * @license
4
- * Copyright Google Inc. 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
2
  Object.defineProperty(exports, "__esModule", { value: true });
10
- const core_1 = require("@angular-devkit/core");
11
3
  const schematic_command_1 = require("../models/schematic-command");
4
+ const color_1 = require("../utilities/color");
12
5
  const json_schema_1 = require("../utilities/json-schema");
13
6
  class GenerateCommand extends schematic_command_1.SchematicCommand {
14
7
  async initialize(options) {
@@ -83,7 +76,7 @@ class GenerateCommand extends schematic_command_1.SchematicCommand {
83
76
  const subcommand = this.description.options.filter(x => x.subcommands)[0];
84
77
  if (Object.keys((subcommand && subcommand.subcommands) || {}).length == 1) {
85
78
  this.logger.info(`\nTo see help for a schematic run:`);
86
- this.logger.info(core_1.terminal.cyan(` ng generate <schematic> --help`));
79
+ this.logger.info(color_1.colors.cyan(` ng generate <schematic> --help`));
87
80
  }
88
81
  return 0;
89
82
  }
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google Inc. 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
+ */
1
8
  import { Command } from '../models/command';
2
9
  import { Schema as HelpCommandSchema } from './help';
3
10
  export declare class HelpCommand extends Command<HelpCommandSchema> {
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  * Use of this source code is governed by an MIT-style license that can be
8
8
  * found in the LICENSE file at https://angular.io/license
9
9
  */
10
- const core_1 = require("@angular-devkit/core");
11
10
  const command_1 = require("../models/command");
11
+ const color_1 = require("../utilities/color");
12
12
  class HelpCommand extends command_1.Command {
13
13
  async run() {
14
14
  this.logger.info(`Available Commands:`);
@@ -17,7 +17,7 @@ class HelpCommand extends command_1.Command {
17
17
  continue;
18
18
  }
19
19
  const aliasInfo = cmd.aliases.length > 0 ? ` (${cmd.aliases.join(', ')})` : '';
20
- this.logger.info(` ${core_1.terminal.cyan(cmd.name)}${aliasInfo} ${cmd.description}`);
20
+ this.logger.info(` ${color_1.colors.cyan(cmd.name)}${aliasInfo} ${cmd.description}`);
21
21
  }
22
22
  this.logger.info(`\nFor more detailed help run "ng [command name] --help"`);
23
23
  }
@@ -102,6 +102,7 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
102
102
  additionalOptions: {
103
103
  force: options.force || false,
104
104
  next: options.next || false,
105
+ verbose: options.verbose || false,
105
106
  packageManager,
106
107
  packages: options.all ? Object.keys(rootDependencies) : [],
107
108
  },
@@ -191,6 +192,7 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
191
192
  package: packageName,
192
193
  collection: migrations,
193
194
  from: options.from,
195
+ verbose: options.verbose || false,
194
196
  to: options.to || packageNode.package.version,
195
197
  },
196
198
  });
@@ -223,7 +225,7 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
223
225
  try {
224
226
  // Metadata requests are internally cached; multiple requests for same name
225
227
  // does not result in additional network traffic
226
- metadata = await package_metadata_1.fetchPackageMetadata(packageName, this.logger);
228
+ metadata = await package_metadata_1.fetchPackageMetadata(packageName, this.logger, { verbose: options.verbose });
227
229
  }
228
230
  catch (e) {
229
231
  this.logger.error(`Error fetching metadata for '${packageName}': ` + e.message);
@@ -264,6 +266,7 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
264
266
  dryRun: !!options.dryRun,
265
267
  showNothingDone: false,
266
268
  additionalOptions: {
269
+ verbose: options.verbose || false,
267
270
  force: options.force || false,
268
271
  packageManager,
269
272
  packages: packagesToUpdate,
@@ -41,6 +41,10 @@ export interface Schema {
41
41
  * installed version detected.
42
42
  */
43
43
  to?: string;
44
+ /**
45
+ * Display additional details about internal operations during execution.
46
+ */
47
+ verbose?: boolean;
44
48
  }
45
49
  /**
46
50
  * Shows a help message for this command in the console.
@@ -57,6 +57,11 @@
57
57
  "allowDirty": {
58
58
  "description": "Whether to allow updating when the repository contains modified or untracked files.",
59
59
  "type": "boolean"
60
+ },
61
+ "verbose": {
62
+ "description": "Display additional details about internal operations during execution.",
63
+ "type": "boolean",
64
+ "default": false
60
65
  }
61
66
  }
62
67
  }
@@ -1,10 +1,3 @@
1
- /**
2
- * @license
3
- * Copyright Google Inc. 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
1
  import { Command } from '../models/command';
9
2
  import { Schema as VersionCommandSchema } from './version';
10
3
  export declare class VersionCommand extends Command<VersionCommandSchema> {
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  /**
3
4
  * @license
4
5
  * Copyright Google Inc. All Rights Reserved.
@@ -6,12 +7,11 @@
6
7
  * Use of this source code is governed by an MIT-style license that can be
7
8
  * found in the LICENSE file at https://angular.io/license
8
9
  */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const core_1 = require("@angular-devkit/core");
11
10
  const child_process = require("child_process");
12
11
  const fs = require("fs");
13
12
  const path = require("path");
14
13
  const command_1 = require("../models/command");
14
+ const color_1 = require("../utilities/color");
15
15
  const find_up_1 = require("../utilities/find-up");
16
16
  class VersionCommand extends command_1.Command {
17
17
  async run() {
@@ -40,18 +40,16 @@ class VersionCommand extends command_1.Command {
40
40
  ? path.resolve(this.workspace.root, 'node_modules')
41
41
  : maybeNodeModules;
42
42
  const packageNames = [
43
- ...Object.keys(pkg && pkg['dependencies'] || {}),
44
- ...Object.keys(pkg && pkg['devDependencies'] || {}),
45
- ...Object.keys(projPkg && projPkg['dependencies'] || {}),
46
- ...Object.keys(projPkg && projPkg['devDependencies'] || {}),
43
+ ...Object.keys((pkg && pkg['dependencies']) || {}),
44
+ ...Object.keys((pkg && pkg['devDependencies']) || {}),
45
+ ...Object.keys((projPkg && projPkg['dependencies']) || {}),
46
+ ...Object.keys((projPkg && projPkg['devDependencies']) || {}),
47
47
  ];
48
48
  if (packageRoot != null) {
49
49
  // Add all node_modules and node_modules/@*/*
50
- const nodePackageNames = fs.readdirSync(packageRoot)
51
- .reduce((acc, name) => {
50
+ const nodePackageNames = fs.readdirSync(packageRoot).reduce((acc, name) => {
52
51
  if (name.startsWith('@')) {
53
- return acc.concat(fs.readdirSync(path.resolve(packageRoot, name))
54
- .map(subName => name + '/' + subName));
52
+ return acc.concat(fs.readdirSync(path.resolve(packageRoot, name)).map(subName => name + '/' + subName));
55
53
  }
56
54
  else {
57
55
  return acc.concat(name);
@@ -79,8 +77,7 @@ class VersionCommand extends command_1.Command {
79
77
  });
80
78
  gitBranch = gitRefName.replace('\n', '');
81
79
  }
82
- catch (_a) {
83
- }
80
+ catch (_a) { }
84
81
  ngCliVersion = `local (v${pkg.version}, branch: ${gitBranch})`;
85
82
  }
86
83
  let angularCoreVersion = '';
@@ -90,8 +87,8 @@ class VersionCommand extends command_1.Command {
90
87
  angularCoreVersion = versions['@angular/core'];
91
88
  if (angularCoreVersion) {
92
89
  for (const angularPackage of Object.keys(versions)) {
93
- if (versions[angularPackage] == angularCoreVersion
94
- && angularPackage.startsWith('@angular/')) {
90
+ if (versions[angularPackage] == angularCoreVersion &&
91
+ angularPackage.startsWith('@angular/')) {
95
92
  angularSameAsCore.push(angularPackage.replace(/^@angular\//, ''));
96
93
  delete versions[angularPackage];
97
94
  }
@@ -108,19 +105,23 @@ class VersionCommand extends command_1.Command {
108
105
  / ___ \\| | | | (_| | |_| | | (_| | | | |___| |___ | |
109
106
  /_/ \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_| \\____|_____|___|
110
107
  |___/
111
- `.split('\n').map(x => core_1.terminal.red(x)).join('\n');
108
+ `
109
+ .split('\n')
110
+ .map(x => color_1.colors.red(x))
111
+ .join('\n');
112
112
  this.logger.info(asciiArt);
113
113
  this.logger.info(`
114
114
  Angular CLI: ${ngCliVersion}
115
115
  Node: ${process.versions.node}
116
116
  OS: ${process.platform} ${process.arch}
117
117
  Angular: ${angularCoreVersion}
118
- ... ${angularSameAsCore.reduce((acc, name) => {
118
+ ... ${angularSameAsCore
119
+ .reduce((acc, name) => {
119
120
  // Perform a simple word wrap around 60.
120
121
  if (acc.length == 0) {
121
122
  return [name];
122
123
  }
123
- const line = (acc[acc.length - 1] + ', ' + name);
124
+ const line = acc[acc.length - 1] + ', ' + name;
124
125
  if (line.length > 60) {
125
126
  acc.push(name);
126
127
  }
@@ -128,7 +129,8 @@ class VersionCommand extends command_1.Command {
128
129
  acc[acc.length - 1] = line;
129
130
  }
130
131
  return acc;
131
- }, []).join('\n... ')}
132
+ }, [])
133
+ .join('\n... ')}
132
134
 
133
135
  Package${namePad.slice(7)}Version
134
136
  -------${namePad.replace(/ /g, '-')}------------------
@@ -145,16 +147,14 @@ class VersionCommand extends command_1.Command {
145
147
  return modulePkg.version;
146
148
  }
147
149
  }
148
- catch (_) {
149
- }
150
+ catch (_) { }
150
151
  try {
151
152
  if (cliNodeModules) {
152
153
  const modulePkg = require(path.resolve(cliNodeModules, moduleName, 'package.json'));
153
154
  return modulePkg.version + ' (cli-only)';
154
155
  }
155
156
  }
156
- catch (_a) {
157
- }
157
+ catch (_a) { }
158
158
  return '<error>';
159
159
  }
160
160
  }
package/lib/cli/index.js CHANGED
@@ -8,34 +8,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
8
8
  * found in the LICENSE file at https://angular.io/license
9
9
  */
10
10
  const node_1 = require("@angular-devkit/core/node");
11
- const colors = require("ansi-colors");
12
- const tty_1 = require("tty");
11
+ const path_1 = require("path");
13
12
  const util_1 = require("util");
14
13
  const command_runner_1 = require("../../models/command-runner");
14
+ const color_1 = require("../../utilities/color");
15
15
  const config_1 = require("../../utilities/config");
16
16
  const project_1 = require("../../utilities/project");
17
+ // tslint:disable: no-console
17
18
  async function default_1(options) {
18
- // Typings do not contain the function call (added in Node.js v9.9.0)
19
- const supportsColor = process.stdout instanceof tty_1.WriteStream &&
20
- process.stdout.getColorDepth() > 1;
21
19
  const logger = node_1.createConsoleLogger(false, process.stdout, process.stderr, {
22
- info: s => supportsColor ? s : colors.unstyle(s),
23
- debug: s => supportsColor ? s : colors.unstyle(s),
24
- warn: s => supportsColor ? colors.bold.yellow(s) : colors.unstyle(s),
25
- error: s => supportsColor ? colors.bold.red(s) : colors.unstyle(s),
26
- fatal: s => supportsColor ? colors.bold.red(s) : colors.unstyle(s),
20
+ info: s => (color_1.supportsColor ? s : color_1.colors.unstyle(s)),
21
+ debug: s => (color_1.supportsColor ? s : color_1.colors.unstyle(s)),
22
+ warn: s => (color_1.supportsColor ? color_1.colors.bold.yellow(s) : color_1.colors.unstyle(s)),
23
+ error: s => (color_1.supportsColor ? color_1.colors.bold.red(s) : color_1.colors.unstyle(s)),
24
+ fatal: s => (color_1.supportsColor ? color_1.colors.bold.red(s) : color_1.colors.unstyle(s)),
27
25
  });
28
26
  // Redirect console to logger
29
- console.log = function () { logger.info(util_1.format.apply(null, arguments)); };
30
- console.info = function () { logger.info(util_1.format.apply(null, arguments)); };
31
- console.warn = function () { logger.warn(util_1.format.apply(null, arguments)); };
32
- console.error = function () { logger.error(util_1.format.apply(null, arguments)); };
27
+ console.log = function () {
28
+ logger.info(util_1.format.apply(null, arguments));
29
+ };
30
+ console.info = function () {
31
+ logger.info(util_1.format.apply(null, arguments));
32
+ };
33
+ console.warn = function () {
34
+ logger.warn(util_1.format.apply(null, arguments));
35
+ };
36
+ console.error = function () {
37
+ logger.error(util_1.format.apply(null, arguments));
38
+ };
33
39
  let projectDetails = project_1.getWorkspaceDetails();
34
40
  if (projectDetails === null) {
35
41
  const [, localPath] = config_1.getWorkspaceRaw('local');
36
42
  if (localPath !== null) {
37
- logger.fatal(`An invalid configuration file was found ['${localPath}'].`
38
- + ' Please delete the file before running the command.');
43
+ logger.fatal(`An invalid configuration file was found ['${localPath}'].` +
44
+ ' Please delete the file before running the command.');
39
45
  return 1;
40
46
  }
41
47
  projectDetails = { root: process.cwd() };
@@ -54,12 +60,10 @@ async function default_1(options) {
54
60
  const fs = await Promise.resolve().then(() => require('fs'));
55
61
  const os = await Promise.resolve().then(() => require('os'));
56
62
  const tempDirectory = fs.mkdtempSync(fs.realpathSync(os.tmpdir()) + '/' + 'ng-');
57
- const logPath = tempDirectory + '/angular-errors.log';
63
+ const logPath = path_1.normalize(tempDirectory + '/angular-errors.log');
58
64
  fs.appendFileSync(logPath, '[error] ' + (err.stack || err));
59
65
  logger.fatal(`An unhandled exception occurred: ${err.message}\n` +
60
- `See "${logPath}" for further details.\n\n` +
61
- 'Please report with the contents of the log file at ' +
62
- 'https://github.com/angular/angular-cli/issues/new?template=1-bug-report.md');
66
+ `See "${logPath}" for further details.`);
63
67
  }
64
68
  catch (e) {
65
69
  logger.fatal(`An unhandled exception occurred: ${err.message}\n` +
@@ -80,6 +84,7 @@ async function default_1(options) {
80
84
  logger.fatal('An unexpected error occurred: ' + JSON.stringify(err));
81
85
  }
82
86
  if (options.testing) {
87
+ // tslint:disable-next-line: no-debugger
83
88
  debugger;
84
89
  throw err;
85
90
  }
@@ -890,6 +890,16 @@
890
890
  "webWorkerTsConfig": {
891
891
  "type": "string",
892
892
  "description": "TypeScript configuration for Web Worker modules."
893
+ },
894
+ "crossOrigin": {
895
+ "type": "string",
896
+ "description": "Define the crossorigin attribute setting of elements that provide CORS support.",
897
+ "default": "none",
898
+ "enum": [
899
+ "none",
900
+ "anonymous",
901
+ "use-credentials"
902
+ ]
893
903
  }
894
904
  },
895
905
  "additionalProperties": false,
@@ -985,6 +995,11 @@
985
995
  "type": "boolean",
986
996
  "description": "If the bundle will be lazy loaded.",
987
997
  "default": false
998
+ },
999
+ "inject": {
1000
+ "type": "boolean",
1001
+ "description": "If the bundle will be referenced in the HTML file.",
1002
+ "default": true
988
1003
  }
989
1004
  },
990
1005
  "additionalProperties": false,
@@ -1506,6 +1521,11 @@
1506
1521
  "type": "boolean",
1507
1522
  "description": "If the bundle will be lazy loaded.",
1508
1523
  "default": false
1524
+ },
1525
+ "inject": {
1526
+ "type": "boolean",
1527
+ "description": "If the bundle will be referenced in the HTML file.",
1528
+ "default": true
1509
1529
  }
1510
1530
  },
1511
1531
  "additionalProperties": false,
package/lib/init.js CHANGED
@@ -9,12 +9,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  */
10
10
  require("symbol-observable");
11
11
  // symbol polyfill must go first
12
+ // tslint:disable: no-console
12
13
  // tslint:disable-next-line:ordered-imports import-groups
13
14
  const core_1 = require("@angular-devkit/core");
14
15
  const fs = require("fs");
15
16
  const path = require("path");
16
17
  const semver_1 = require("semver");
17
18
  const stream_1 = require("stream");
19
+ const color_1 = require("../utilities/color");
18
20
  const config_1 = require("../utilities/config");
19
21
  const packageJson = require('../package.json');
20
22
  function _fromPackageJson(cwd) {
@@ -76,7 +78,7 @@ try {
76
78
  shouldWarn = true;
77
79
  }
78
80
  if (shouldWarn && config_1.isWarningEnabled('versionMismatch')) {
79
- const warning = core_1.terminal.yellow(core_1.tags.stripIndents `
81
+ const warning = color_1.colors.yellow(core_1.tags.stripIndents `
80
82
  Your global Angular CLI version (${globalVersion}) is greater than your local
81
83
  version (${localVersion}). The local Angular CLI version is used.
82
84
 
@@ -6,6 +6,11 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import { analytics } from '@angular-devkit/core';
9
+ export declare const AnalyticsProperties: {
10
+ AngularCliProd: string;
11
+ AngularCliStaging: string;
12
+ readonly AngularCliDefault: string;
13
+ };
9
14
  /**
10
15
  * This is the ultimate safelist for checking if a package name is safe to report to analytics.
11
16
  */
@@ -15,11 +15,32 @@ const inquirer = require("inquirer");
15
15
  const os = require("os");
16
16
  const ua = require("universal-analytics");
17
17
  const uuid_1 = require("uuid");
18
+ const color_1 = require("../utilities/color");
18
19
  const config_1 = require("../utilities/config");
19
20
  const tty_1 = require("../utilities/tty");
21
+ // tslint:disable: no-console
20
22
  const analyticsDebug = debug('ng:analytics'); // Generate analytics, including settings and users.
21
23
  const analyticsLogDebug = debug('ng:analytics:log'); // Actual logs of events.
22
- const BYTES_PER_MEGABYTES = 1024 * 1024;
24
+ const BYTES_PER_GIGABYTES = 1024 * 1024 * 1024;
25
+ let _defaultAngularCliPropertyCache;
26
+ exports.AnalyticsProperties = {
27
+ AngularCliProd: 'UA-8594346-29',
28
+ AngularCliStaging: 'UA-8594346-32',
29
+ get AngularCliDefault() {
30
+ if (_defaultAngularCliPropertyCache) {
31
+ return _defaultAngularCliPropertyCache;
32
+ }
33
+ const v = require('../package.json').version;
34
+ // The logic is if it's a full version then we should use the prod GA property.
35
+ if (/^\d+\.\d+\.\d+$/.test(v) && v !== '0.0.0') {
36
+ _defaultAngularCliPropertyCache = exports.AnalyticsProperties.AngularCliProd;
37
+ }
38
+ else {
39
+ _defaultAngularCliPropertyCache = exports.AnalyticsProperties.AngularCliStaging;
40
+ }
41
+ return _defaultAngularCliPropertyCache;
42
+ },
43
+ };
23
44
  /**
24
45
  * This is the ultimate safelist for checking if a package name is safe to report to analytics.
25
46
  */
@@ -53,7 +74,10 @@ function _getWindowsLanguageCode() {
53
74
  try {
54
75
  // This is true on Windows XP, 7, 8 and 10 AFAIK. Would return empty string or fail if it
55
76
  // doesn't work.
56
- return child_process.execSync('wmic.exe os get locale').toString().trim();
77
+ return child_process
78
+ .execSync('wmic.exe os get locale')
79
+ .toString()
80
+ .trim();
57
81
  }
58
82
  catch (_) { }
59
83
  return undefined;
@@ -64,11 +88,11 @@ function _getWindowsLanguageCode() {
64
88
  */
65
89
  function _getLanguage() {
66
90
  // Note: Windows does not expose the configured language by default.
67
- return process.env.LANG // Default Unix env variable.
68
- || process.env.LC_CTYPE // For C libraries. Sometimes the above isn't set.
69
- || process.env.LANGSPEC // For Windows, sometimes this will be set (not always).
70
- || _getWindowsLanguageCode()
71
- || '??'; // ¯\_(ツ)_/¯
91
+ return (process.env.LANG || // Default Unix env variable.
92
+ process.env.LC_CTYPE || // For C libraries. Sometimes the above isn't set.
93
+ process.env.LANGSPEC || // For Windows, sometimes this will be set (not always).
94
+ _getWindowsLanguageCode() ||
95
+ '??'); // ¯\_(ツ)_/¯
72
96
  }
73
97
  /**
74
98
  * Return the number of CPUs.
@@ -93,8 +117,8 @@ function _getCpuSpeed() {
93
117
  * @private
94
118
  */
95
119
  function _getRamSize() {
96
- // Report in megabytes. Otherwise it's too much noise.
97
- return Math.floor(os.totalmem() / BYTES_PER_MEGABYTES);
120
+ // Report in gigabytes (or closest). Otherwise it's too much noise.
121
+ return Math.round(os.totalmem() / BYTES_PER_GIGABYTES);
98
122
  }
99
123
  /**
100
124
  * Get the Node name and version. This returns a string like "Node 10.11", or "io.js 3.5".
@@ -104,8 +128,8 @@ function _getNodeVersion() {
104
128
  // We use any here because p.release is a new Node construct in Node 10 (and our typings are the
105
129
  // minimal version of Node we support).
106
130
  const p = process; // tslint:disable-line:no-any
107
- const name = typeof p.release == 'object' && typeof p.release.name == 'string' && p.release.name
108
- || process.argv0;
131
+ const name = (typeof p.release == 'object' && typeof p.release.name == 'string' && p.release.name) ||
132
+ process.argv0;
109
133
  return name + ' ' + process.version;
110
134
  }
111
135
  /**
@@ -115,7 +139,7 @@ function _getNodeVersion() {
115
139
  function _getNumericNodeVersion() {
116
140
  const p = process.version;
117
141
  const m = p.match(/\d+\.\d+/);
118
- return m && m[0] && parseFloat(m[0]) || 0;
142
+ return (m && m[0] && parseFloat(m[0])) || 0;
119
143
  }
120
144
  // These are just approximations of UA strings. We just try to fool Google Analytics to give us the
121
145
  // data we want.
@@ -226,7 +250,7 @@ class UniversalAnalytics {
226
250
  // We set custom metrics for values we care about.
227
251
  this._dimensions[core_1.analytics.NgCliAnalyticsDimensions.CpuCount] = _getCpuCount();
228
252
  this._dimensions[core_1.analytics.NgCliAnalyticsDimensions.CpuSpeed] = _getCpuSpeed();
229
- this._dimensions[core_1.analytics.NgCliAnalyticsDimensions.RamInMegabytes] = _getRamSize();
253
+ this._dimensions[core_1.analytics.NgCliAnalyticsDimensions.RamInGigabytes] = _getRamSize();
230
254
  this._dimensions[core_1.analytics.NgCliAnalyticsDimensions.NodeVersion] = _getNumericNodeVersion();
231
255
  }
232
256
  /**
@@ -235,10 +259,10 @@ class UniversalAnalytics {
235
259
  */
236
260
  _customVariables(options) {
237
261
  const additionals = {};
238
- this._dimensions.forEach((v, i) => additionals['cd' + i] = v);
239
- (options.dimensions || []).forEach((v, i) => additionals['cd' + i] = v);
240
- this._metrics.forEach((v, i) => additionals['cm' + i] = v);
241
- (options.metrics || []).forEach((v, i) => additionals['cm' + i] = v);
262
+ this._dimensions.forEach((v, i) => (additionals['cd' + i] = v));
263
+ (options.dimensions || []).forEach((v, i) => (additionals['cd' + i] = v));
264
+ this._metrics.forEach((v, i) => (additionals['cm' + i] = v));
265
+ (options.metrics || []).forEach((v, i) => (additionals['cm' + i] = v));
242
266
  return additionals;
243
267
  }
244
268
  event(ec, ea, options = {}) {
@@ -330,10 +354,16 @@ async function promptGlobalAnalytics(force = false) {
330
354
  Thank you for sharing anonymous usage data. If you change your mind, the following
331
355
  command will disable this feature entirely:
332
356
 
333
- ${core_1.terminal.yellow('ng analytics off')}
357
+ ${color_1.colors.yellow('ng analytics off')}
334
358
  `);
335
359
  console.log('');
336
360
  }
361
+ else {
362
+ // Send back a ping with the user `optout`. This is the only thing we send.
363
+ const ua = new UniversalAnalytics(exports.AnalyticsProperties.AngularCliDefault, 'optout');
364
+ ua.pageview('/telemetry/optout');
365
+ await ua.flush();
366
+ }
337
367
  return true;
338
368
  }
339
369
  else {
@@ -375,10 +405,16 @@ async function promptProjectAnalytics(force = false) {
375
405
  Thank you for sharing anonymous usage data. Would you change your mind, the following
376
406
  command will disable this feature entirely:
377
407
 
378
- ${core_1.terminal.yellow('ng analytics project off')}
408
+ ${color_1.colors.yellow('ng analytics project off')}
379
409
  `);
380
410
  console.log('');
381
411
  }
412
+ else {
413
+ // Send back a ping with the user `optout`. This is the only thing we send.
414
+ const ua = new UniversalAnalytics(exports.AnalyticsProperties.AngularCliDefault, 'optout');
415
+ ua.pageview('/telemetry/project/optout');
416
+ await ua.flush();
417
+ }
382
418
  return true;
383
419
  }
384
420
  return false;
@@ -387,9 +423,7 @@ exports.promptProjectAnalytics = promptProjectAnalytics;
387
423
  function hasGlobalAnalyticsConfiguration() {
388
424
  try {
389
425
  const globalWorkspace = config_1.getWorkspace('global');
390
- const analyticsConfig = globalWorkspace
391
- && globalWorkspace.getCli()
392
- && globalWorkspace.getCli()['analytics'];
426
+ const analyticsConfig = globalWorkspace && globalWorkspace.getCli() && globalWorkspace.getCli()['analytics'];
393
427
  if (analyticsConfig !== null && analyticsConfig !== undefined) {
394
428
  return true;
395
429
  }
@@ -406,7 +440,7 @@ exports.hasGlobalAnalyticsConfiguration = hasGlobalAnalyticsConfiguration;
406
440
  */
407
441
  function getGlobalAnalytics() {
408
442
  analyticsDebug('getGlobalAnalytics');
409
- const propertyId = 'UA-8594346-29';
443
+ const propertyId = exports.AnalyticsProperties.AngularCliDefault;
410
444
  if ('NG_CLI_ANALYTICS' in process.env) {
411
445
  if (process.env['NG_CLI_ANALYTICS'] == 'false' || process.env['NG_CLI_ANALYTICS'] == '') {
412
446
  analyticsDebug('NG_CLI_ANALYTICS is false');
@@ -420,9 +454,7 @@ function getGlobalAnalytics() {
420
454
  // If anything happens we just keep the NOOP analytics.
421
455
  try {
422
456
  const globalWorkspace = config_1.getWorkspace('global');
423
- const analyticsConfig = globalWorkspace
424
- && globalWorkspace.getCli()
425
- && globalWorkspace.getCli()['analytics'];
457
+ const analyticsConfig = globalWorkspace && globalWorkspace.getCli() && globalWorkspace.getCli()['analytics'];
426
458
  analyticsDebug('Client Analytics config found: %j', analyticsConfig);
427
459
  if (analyticsConfig === false) {
428
460
  analyticsDebug('Analytics disabled. Ignoring all analytics.');
@@ -472,9 +504,7 @@ function getSharedAnalytics() {
472
504
  // If anything happens we just keep the NOOP analytics.
473
505
  try {
474
506
  const globalWorkspace = config_1.getWorkspace('global');
475
- const analyticsConfig = globalWorkspace
476
- && globalWorkspace.getCli()
477
- && globalWorkspace.getCli()['analyticsSharing'];
507
+ const analyticsConfig = globalWorkspace && globalWorkspace.getCli() && globalWorkspace.getCli()['analyticsSharing'];
478
508
  if (!analyticsConfig || !analyticsConfig.tracking || !analyticsConfig.uuid) {
479
509
  return undefined;
480
510
  }
package/models/command.js CHANGED
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  // tslint:disable:no-global-tslint-disable no-any
11
11
  const core_1 = require("@angular-devkit/core");
12
12
  const path = require("path");
13
+ const color_1 = require("../utilities/color");
13
14
  const config_1 = require("../utilities/config");
14
15
  const interface_1 = require("./interface");
15
16
  class Command {
@@ -40,12 +41,8 @@ class Command {
40
41
  const name = this.description.name;
41
42
  const args = this.description.options.filter(x => x.positional !== undefined);
42
43
  const opts = this.description.options.filter(x => x.positional === undefined);
43
- const argDisplay = args && args.length > 0
44
- ? ' ' + args.map(a => `<${a.name}>`).join(' ')
45
- : '';
46
- const optionsDisplay = opts && opts.length > 0
47
- ? ` [options]`
48
- : ``;
44
+ const argDisplay = args && args.length > 0 ? ' ' + args.map(a => `<${a.name}>`).join(' ') : '';
45
+ const optionsDisplay = opts && opts.length > 0 ? ` [options]` : ``;
49
46
  this.logger.info(`usage: ng ${name}${argDisplay}${optionsDisplay}`);
50
47
  this.logger.info('');
51
48
  }
@@ -60,7 +57,7 @@ class Command {
60
57
  if (args.length > 0) {
61
58
  this.logger.info(`arguments:`);
62
59
  args.forEach(o => {
63
- this.logger.info(` ${core_1.terminal.cyan(o.name)}`);
60
+ this.logger.info(` ${color_1.colors.cyan(o.name)}`);
64
61
  if (o.description) {
65
62
  this.logger.info(formatDescription(o.description));
66
63
  }
@@ -78,7 +75,7 @@ class Command {
78
75
  const aliases = o.aliases && o.aliases.length > 0
79
76
  ? '(' + o.aliases.map(a => `-${a}`).join(' ') + ')'
80
77
  : '';
81
- this.logger.info(` ${core_1.terminal.cyan('--' + core_1.strings.dasherize(o.name))} ${aliases}`);
78
+ this.logger.info(` ${color_1.colors.cyan('--' + core_1.strings.dasherize(o.name))} ${aliases}`);
82
79
  if (o.description) {
83
80
  this.logger.info(formatDescription(o.description));
84
81
  }
@@ -118,7 +115,7 @@ class Command {
118
115
  dimensions[ua] = v;
119
116
  }
120
117
  }
121
- this.analytics.pageview('/command/' + paths.join('/'), { dimensions });
118
+ this.analytics.pageview('/command/' + paths.join('/'), { dimensions, metrics });
122
119
  }
123
120
  async validateAndRun(options) {
124
121
  if (!(options.help === true || options.help === 'json' || options.help === 'JSON')) {
package/models/parser.js CHANGED
@@ -12,7 +12,7 @@ const core_1 = require("@angular-devkit/core");
12
12
  const interface_1 = require("./interface");
13
13
  class ParseArgumentException extends core_1.BaseException {
14
14
  constructor(comments, parsed, ignored) {
15
- super(`One or more errors occured while parsing arguments:\n ${comments.join('\n ')}`);
15
+ super(`One or more errors occurred while parsing arguments:\n ${comments.join('\n ')}`);
16
16
  this.comments = comments;
17
17
  this.parsed = parsed;
18
18
  this.ignored = ignored;
@@ -29,7 +29,7 @@ export interface RunSchematicOptions extends BaseSchematicSchema {
29
29
  export declare class UnknownCollectionError extends Error {
30
30
  constructor(collectionName: string);
31
31
  }
32
- export declare abstract class SchematicCommand<T extends (BaseSchematicSchema & BaseCommandOptions)> extends Command<T> {
32
+ export declare abstract class SchematicCommand<T extends BaseSchematicSchema & BaseCommandOptions> extends Command<T> {
33
33
  readonly allowPrivateSchematics: boolean;
34
34
  readonly allowAdditionalArgs: boolean;
35
35
  private _host;
@@ -14,6 +14,7 @@ const tools_1 = require("@angular-devkit/schematics/tools");
14
14
  const inquirer = require("inquirer");
15
15
  const systemPath = require("path");
16
16
  const workspace_loader_1 = require("../models/workspace-loader");
17
+ const color_1 = require("../utilities/color");
17
18
  const config_1 = require("../utilities/config");
18
19
  const json_schema_1 = require("../utilities/json-schema");
19
20
  const package_manager_1 = require("../utilities/package-manager");
@@ -104,9 +105,7 @@ class SchematicCommand extends command_1.Command {
104
105
  const [collectionName, schematicName] = schematicNames[0].split(/:/)[0];
105
106
  // Display <collectionName:schematicName> if this is not the default collectionName,
106
107
  // otherwise just show the schematicName.
107
- const displayName = collectionName == this.getDefaultSchematicCollection()
108
- ? schematicName
109
- : schematicNames[0];
108
+ const displayName = collectionName == this.getDefaultSchematicCollection() ? schematicName : schematicNames[0];
110
109
  const schematicOptions = subCommandOption.subcommands[schematicNames[0]].options;
111
110
  const schematicArgs = schematicOptions.filter(x => x.positional !== undefined);
112
111
  const argDisplay = schematicArgs.length > 0
@@ -187,8 +186,8 @@ class SchematicCommand extends command_1.Command {
187
186
  workflow.registry.addSmartDefaultProvider('projectName', () => {
188
187
  if (this._workspace) {
189
188
  try {
190
- return this._workspace.getProjectByPath(core_1.normalize(process.cwd()))
191
- || this._workspace.getDefaultProjectName();
189
+ return (this._workspace.getProjectByPath(core_1.normalize(process.cwd())) ||
190
+ this._workspace.getDefaultProjectName());
192
191
  }
193
192
  catch (e) {
194
193
  if (e instanceof core_1.experimental.workspace.AmbiguousProjectPathException) {
@@ -222,17 +221,19 @@ class SchematicCommand extends command_1.Command {
222
221
  break;
223
222
  case 'list':
224
223
  question.type = !!definition.multiselect ? 'checkbox' : 'list';
225
- question.choices = definition.items && definition.items.map(item => {
226
- if (typeof item == 'string') {
227
- return item;
228
- }
229
- else {
230
- return {
231
- name: item.label,
232
- value: item.value,
233
- };
234
- }
235
- });
224
+ question.choices =
225
+ definition.items &&
226
+ definition.items.map(item => {
227
+ if (typeof item == 'string') {
228
+ return item;
229
+ }
230
+ else {
231
+ return {
232
+ name: item.label,
233
+ value: item.value,
234
+ };
235
+ }
236
+ });
236
237
  break;
237
238
  default:
238
239
  question.type = definition.type;
@@ -243,7 +244,7 @@ class SchematicCommand extends command_1.Command {
243
244
  return inquirer.prompt(questions);
244
245
  });
245
246
  }
246
- return this._workflow = workflow;
247
+ return (this._workflow = workflow);
247
248
  }
248
249
  getDefaultSchematicCollection() {
249
250
  let workspace = config_1.getWorkspace('local');
@@ -356,19 +357,19 @@ class SchematicCommand extends command_1.Command {
356
357
  break;
357
358
  case 'update':
358
359
  loggingQueue.push(core_1.tags.oneLine `
359
- ${core_1.terminal.white('UPDATE')} ${eventPath} (${event.content.length} bytes)
360
+ ${color_1.colors.white('UPDATE')} ${eventPath} (${event.content.length} bytes)
360
361
  `);
361
362
  break;
362
363
  case 'create':
363
364
  loggingQueue.push(core_1.tags.oneLine `
364
- ${core_1.terminal.green('CREATE')} ${eventPath} (${event.content.length} bytes)
365
+ ${color_1.colors.green('CREATE')} ${eventPath} (${event.content.length} bytes)
365
366
  `);
366
367
  break;
367
368
  case 'delete':
368
- loggingQueue.push(`${core_1.terminal.yellow('DELETE')} ${eventPath}`);
369
+ loggingQueue.push(`${color_1.colors.yellow('DELETE')} ${eventPath}`);
369
370
  break;
370
371
  case 'rename':
371
- loggingQueue.push(`${core_1.terminal.blue('RENAME')} ${eventPath} => ${event.to}`);
372
+ loggingQueue.push(`${color_1.colors.blue('RENAME')} ${eventPath} => ${event.to}`);
372
373
  break;
373
374
  }
374
375
  });
@@ -382,8 +383,9 @@ class SchematicCommand extends command_1.Command {
382
383
  error = false;
383
384
  }
384
385
  });
385
- return new Promise((resolve) => {
386
- workflow.execute({
386
+ return new Promise(resolve => {
387
+ workflow
388
+ .execute({
387
389
  collection: collectionName,
388
390
  schematic: schematicName,
389
391
  options: input,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cli",
3
- "version": "8.1.0-beta.3",
3
+ "version": "8.1.2",
4
4
  "description": "CLI tool for Angular",
5
5
  "main": "lib/cli/index.js",
6
6
  "bin": {
@@ -28,21 +28,21 @@
28
28
  },
29
29
  "homepage": "https://github.com/angular/angular-cli",
30
30
  "dependencies": {
31
- "@angular-devkit/architect": "0.801.0-beta.3",
32
- "@angular-devkit/core": "8.1.0-beta.3",
33
- "@angular-devkit/schematics": "8.1.0-beta.3",
34
- "@schematics/angular": "8.1.0-beta.3",
35
- "@schematics/update": "0.801.0-beta.3",
31
+ "@angular-devkit/architect": "0.801.2",
32
+ "@angular-devkit/core": "8.1.2",
33
+ "@angular-devkit/schematics": "8.1.2",
34
+ "@schematics/angular": "8.1.2",
35
+ "@schematics/update": "0.801.2",
36
36
  "@yarnpkg/lockfile": "1.1.0",
37
- "ansi-colors": "4.0.1",
37
+ "ansi-colors": "4.1.0",
38
38
  "debug": "^4.1.1",
39
39
  "ini": "1.3.5",
40
- "inquirer": "6.4.0",
40
+ "inquirer": "6.4.1",
41
41
  "npm-package-arg": "6.1.0",
42
- "open": "6.3.0",
42
+ "open": "6.4.0",
43
43
  "pacote": "9.5.1",
44
- "read-package-tree": "5.2.2",
45
- "semver": "6.1.1",
44
+ "read-package-tree": "5.3.1",
45
+ "semver": "6.2.0",
46
46
  "symbol-observable": "1.2.0",
47
47
  "universal-analytics": "^0.4.20",
48
48
  "uuid": "^3.3.2"
@@ -50,10 +50,10 @@
50
50
  "ng-update": {
51
51
  "migrations": "@schematics/angular/migrations/migration-collection.json",
52
52
  "packageGroup": {
53
- "@angular/cli": "8.1.0-beta.3",
54
- "@angular-devkit/build-angular": "0.801.0-beta.3",
55
- "@angular-devkit/build-ng-packagr": "0.801.0-beta.3",
56
- "@angular-devkit/build-webpack": "0.801.0-beta.3"
53
+ "@angular/cli": "8.1.2",
54
+ "@angular-devkit/build-angular": "0.801.2",
55
+ "@angular-devkit/build-ng-packagr": "0.801.2",
56
+ "@angular-devkit/build-webpack": "0.801.2"
57
57
  }
58
58
  },
59
59
  "engines": {
@@ -62,7 +62,6 @@
62
62
  },
63
63
  "husky": {
64
64
  "hooks": {
65
- "pre-commit": "lint-staged",
66
65
  "pre-push": "node ./bin/devkit-admin hooks/pre-push"
67
66
  }
68
67
  }
@@ -7,8 +7,8 @@
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- const core_1 = require("@angular-devkit/core");
11
10
  const child_process_1 = require("child_process");
11
+ const color_1 = require("../utilities/color");
12
12
  async function default_1(packageName, logger, packageManager, projectRoot, save = true) {
13
13
  const installArgs = [];
14
14
  switch (packageManager) {
@@ -25,7 +25,7 @@ async function default_1(packageName, logger, packageManager, projectRoot, save
25
25
  installArgs.push('install');
26
26
  break;
27
27
  }
28
- logger.info(core_1.terminal.green(`Installing packages for tooling via ${packageManager}.`));
28
+ logger.info(color_1.colors.green(`Installing packages for tooling via ${packageManager}.`));
29
29
  if (packageName) {
30
30
  installArgs.push(packageName);
31
31
  }
@@ -34,10 +34,9 @@ async function default_1(packageName, logger, packageManager, projectRoot, save
34
34
  }
35
35
  installArgs.push('--quiet');
36
36
  await new Promise((resolve, reject) => {
37
- child_process_1.spawn(packageManager, installArgs, { stdio: 'inherit', shell: true })
38
- .on('close', (code) => {
37
+ child_process_1.spawn(packageManager, installArgs, { stdio: 'inherit', shell: true }).on('close', (code) => {
39
38
  if (code === 0) {
40
- logger.info(core_1.terminal.green(`Installed packages for tooling via ${packageManager}.`));
39
+ logger.info(color_1.colors.green(`Installed packages for tooling via ${packageManager}.`));
41
40
  resolve();
42
41
  }
43
42
  else {
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google Inc. 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 * as colors from 'ansi-colors';
9
+ export declare const supportsColor: boolean;
10
+ export { colors };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * @license
5
+ * Copyright Google Inc. All Rights Reserved.
6
+ *
7
+ * Use of this source code is governed by an MIT-style license that can be
8
+ * found in the LICENSE file at https://angular.io/license
9
+ */
10
+ const colors = require("ansi-colors");
11
+ exports.colors = colors;
12
+ const tty_1 = require("tty");
13
+ // Typings do not contain the function call (added in Node.js v9.9.0)
14
+ exports.supportsColor = process.stdout instanceof tty_1.WriteStream &&
15
+ process.stdout.getColorDepth() > 1;
16
+ colors.enabled = exports.supportsColor;
@@ -51,7 +51,14 @@ function getWorkspace(level = 'local') {
51
51
  const root = core_1.normalize(path.dirname(configPath));
52
52
  const file = core_1.normalize(path.basename(configPath));
53
53
  const workspace = new core_1.experimental.workspace.Workspace(root, new node_1.NodeJsSyncHost());
54
- workspace.loadWorkspaceFromHost(file).subscribe();
54
+ let error;
55
+ workspace.loadWorkspaceFromHost(file).subscribe({
56
+ error: e => error = e,
57
+ });
58
+ if (error) {
59
+ throw new Error(`Workspace config file cannot le loaded: ${configPath}`
60
+ + `\n${error instanceof Error ? error.message : error}`);
61
+ }
55
62
  cachedWorkspaces.set(level, workspace);
56
63
  return workspace;
57
64
  }
@@ -81,7 +88,7 @@ function getWorkspaceRaw(level = 'local') {
81
88
  .subscribe(data => content = core_1.virtualFs.fileBufferToString(data));
82
89
  const ast = core_1.parseJsonAst(content, core_1.JsonParseMode.Loose);
83
90
  if (ast.kind != 'object') {
84
- throw new Error('Invalid JSON');
91
+ throw new Error(`Invalid JSON file: ${configPath}`);
85
92
  }
86
93
  return [ast, configPath];
87
94
  }
package/utilities/tty.js CHANGED
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  /**
4
3
  * @license
5
4
  * Copyright Google Inc. All Rights Reserved.
@@ -7,12 +6,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
6
  * Use of this source code is governed by an MIT-style license that can be
8
7
  * found in the LICENSE file at https://angular.io/license
9
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ function _isTruthy(value) {
11
+ // Returns true if value is a string that is anything but 0 or false.
12
+ return value !== undefined && value !== '0' && value.toUpperCase() !== 'FALSE';
13
+ }
10
14
  function isTTY() {
15
+ // If we force TTY, we always return true.
11
16
  const force = process.env['NG_FORCE_TTY'];
12
17
  if (force !== undefined) {
13
- return !(force === '0' || force.toUpperCase() === 'FALSE');
18
+ return _isTruthy(force);
14
19
  }
15
- const ci = process.env['CI'];
16
- return !!process.stdout.isTTY && (!ci || ci === '0' || ci.toUpperCase() === 'FALSE');
20
+ return !!process.stdout.isTTY && !_isTruthy(process.env['CI']);
17
21
  }
18
22
  exports.isTTY = isTTY;