@angular/cli 8.0.2 → 8.0.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.
@@ -5,10 +5,12 @@ if ('NG_CLI_ANALYTICS' in process.env) {
5
5
  return;
6
6
  }
7
7
 
8
- try {
9
- const analytics = require('../../models/analytics');
8
+ (async () => {
9
+ try {
10
+ const analytics = require('../../models/analytics');
10
11
 
11
- if (!analytics.hasGlobalAnalyticsConfiguration()) {
12
- analytics.promptGlobalAnalytics();
13
- }
14
- } catch (_) {}
12
+ if (!analytics.hasGlobalAnalyticsConfiguration()) {
13
+ await analytics.promptGlobalAnalytics();
14
+ }
15
+ } catch (_) {}
16
+ })();
@@ -1,14 +1,18 @@
1
- Uses the [webpack](https://webpack.js.org/) build tool, with default configuration options specified in the workspace configuration file (`angular.json`) or with a named alternative configuration.
2
- A "production" configuration is created by default when you use the CLI to create the project, and you can use that configuration by specifying the `--prod` option.
1
+ The command can be used to build a project of type "application" or "library".
2
+ When used to build a library, a different builder is invoked, and only the `ts-config`, `configuration`, and `watch` options are applied.
3
+ All other options apply only to building applications.
4
+
5
+ The application builder uses the [webpack](https://webpack.js.org/) build tool, with default configuration options specified in the workspace configuration file (`angular.json`) or with a named alternative configuration.
6
+ A "production" configuration is created by default when you use the CLI to create the project, and you can use that configuration by specifying the `--configuration="production"` or the `--prod="true"` option.
3
7
 
4
8
  The configuration options generally correspond to the command options.
5
- You can override individual configuration defaults by specifying the corresponding options on the command line.
9
+ You can override individual configuration defaults by specifying the corresponding options on the command line.
6
10
  The command can accept option names given in either dash-case or camelCase.
7
11
  Note that in the configuration file, you must specify names in camelCase.
8
12
 
9
13
  Some additional options can only be set through the configuration file,
10
14
  either by direct editing or with the `ng config` command.
11
- These include `assets`, `styles`, and `scripts` objects that provide runtime-global resources to include in the project.
15
+ These include `assets`, `styles`, and `scripts` objects that provide runtime-global resources to include in the project.
12
16
  Resources in CSS, such as images and fonts, are automatically written and fingerprinted at the root of the output folder.
13
17
 
14
18
  For further details, see [Workspace Configuration](guide/workspace-config).
@@ -12,7 +12,6 @@ const fs = require("fs");
12
12
  const path = require("path");
13
13
  const semver = require("semver");
14
14
  const schematic_command_1 = require("../models/schematic-command");
15
- const find_up_1 = require("../utilities/find-up");
16
15
  const package_manager_1 = require("../utilities/package-manager");
17
16
  const package_metadata_1 = require("../utilities/package-metadata");
18
17
  const package_tree_1 = require("../utilities/package-tree");
@@ -79,14 +78,15 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
79
78
  const packageManager = package_manager_1.getPackageManager(this.workspace.root);
80
79
  this.logger.info(`Using package manager: '${packageManager}'`);
81
80
  // Special handling for Angular CLI 1.x migrations
82
- if (options.migrateOnly === undefined && options.from === undefined) {
83
- if (!options.all && packages.length === 1 && packages[0].name === '@angular/cli') {
84
- const oldConfigFilePath = find_up_1.findUp(oldConfigFileNames, process.cwd());
85
- if (oldConfigFilePath) {
86
- options.migrateOnly = true;
87
- options.from = '1.0.0';
88
- }
89
- }
81
+ if (options.migrateOnly === undefined &&
82
+ options.from === undefined &&
83
+ !options.all &&
84
+ packages.length === 1 &&
85
+ packages[0].name === '@angular/cli' &&
86
+ this.workspace.configFile &&
87
+ oldConfigFileNames.includes(this.workspace.configFile)) {
88
+ options.migrateOnly = true;
89
+ options.from = '1.0.0';
90
90
  }
91
91
  this.logger.info('Collecting installed dependencies...');
92
92
  const packageTree = await package_tree_1.readPackageTree(this.workspace.root);
@@ -273,11 +273,19 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
273
273
  checkCleanGit() {
274
274
  try {
275
275
  const result = child_process_1.execSync('git status --porcelain', { encoding: 'utf8', stdio: 'pipe' });
276
- return result.trim().length === 0;
277
- }
278
- catch (_a) {
279
- return true;
276
+ if (result.trim().length === 0) {
277
+ return true;
278
+ }
279
+ // Only files inside the workspace root are relevant
280
+ for (const entry of result.split('\n')) {
281
+ const relativeEntry = path.relative(path.resolve(this.workspace.root), path.resolve(entry.slice(3).trim()));
282
+ if (!relativeEntry.startsWith('..') && !path.isAbsolute(relativeEntry)) {
283
+ return false;
284
+ }
285
+ }
280
286
  }
287
+ catch (_a) { }
288
+ return true;
281
289
  }
282
290
  }
283
291
  exports.UpdateCommand = UpdateCommand;
@@ -72,8 +72,12 @@ class VersionCommand extends command_1.Command {
72
72
  if (!__dirname.match(/node_modules/)) {
73
73
  let gitBranch = '??';
74
74
  try {
75
- const gitRefName = '' + child_process.execSync('git symbolic-ref HEAD', { cwd: __dirname });
76
- gitBranch = path.basename(gitRefName.replace('\n', ''));
75
+ const gitRefName = child_process.execSync('git rev-parse --abbrev-ref HEAD', {
76
+ cwd: __dirname,
77
+ encoding: 'utf8',
78
+ stdio: 'pipe',
79
+ });
80
+ gitBranch = gitRefName.replace('\n', '');
77
81
  }
78
82
  catch (_a) {
79
83
  }
@@ -19,7 +19,7 @@ const config_1 = require("../utilities/config");
19
19
  const tty_1 = require("../utilities/tty");
20
20
  const analyticsDebug = debug('ng:analytics'); // Generate analytics, including settings and users.
21
21
  const analyticsLogDebug = debug('ng:analytics:log'); // Actual logs of events.
22
- const BYTES_PER_MEGABYTES = 1024 * 1024;
22
+ const BYTES_PER_GIGABYTES = 1024 * 1024 * 1024;
23
23
  /**
24
24
  * This is the ultimate safelist for checking if a package name is safe to report to analytics.
25
25
  */
@@ -93,8 +93,8 @@ function _getCpuSpeed() {
93
93
  * @private
94
94
  */
95
95
  function _getRamSize() {
96
- // Report in megabytes. Otherwise it's too much noise.
97
- return Math.floor(os.totalmem() / BYTES_PER_MEGABYTES);
96
+ // Report in gigabytes (or closest). Otherwise it's too much noise.
97
+ return Math.round(os.totalmem() / BYTES_PER_GIGABYTES);
98
98
  }
99
99
  /**
100
100
  * Get the Node name and version. This returns a string like "Node 10.11", or "io.js 3.5".
@@ -226,7 +226,7 @@ class UniversalAnalytics {
226
226
  // We set custom metrics for values we care about.
227
227
  this._dimensions[core_1.analytics.NgCliAnalyticsDimensions.CpuCount] = _getCpuCount();
228
228
  this._dimensions[core_1.analytics.NgCliAnalyticsDimensions.CpuSpeed] = _getCpuSpeed();
229
- this._dimensions[core_1.analytics.NgCliAnalyticsDimensions.RamInMegabytes] = _getRamSize();
229
+ this._dimensions[core_1.analytics.NgCliAnalyticsDimensions.RamInGigabytes] = _getRamSize();
230
230
  this._dimensions[core_1.analytics.NgCliAnalyticsDimensions.NodeVersion] = _getNumericNodeVersion();
231
231
  }
232
232
  /**
@@ -194,9 +194,12 @@ class ArchitectCommand extends command_1.Command {
194
194
  logger: this.logger,
195
195
  analytics: analytics_1.isPackageNameSafeForAnalytics(builderConf) ? this.analytics : undefined,
196
196
  });
197
- const result = await run.output.toPromise();
197
+ const { error, success } = await run.output.toPromise();
198
198
  await run.stop();
199
- return result.success ? 0 : 1;
199
+ if (error) {
200
+ this.logger.error(error);
201
+ }
202
+ return success ? 0 : 1;
200
203
  }
201
204
  }
202
205
  async runArchitectTarget(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cli",
3
- "version": "8.0.2",
3
+ "version": "8.0.6",
4
4
  "description": "CLI tool for Angular",
5
5
  "main": "lib/cli/index.js",
6
6
  "bin": {
@@ -28,11 +28,11 @@
28
28
  },
29
29
  "homepage": "https://github.com/angular/angular-cli",
30
30
  "dependencies": {
31
- "@angular-devkit/architect": "0.800.2",
32
- "@angular-devkit/core": "8.0.2",
33
- "@angular-devkit/schematics": "8.0.2",
34
- "@schematics/angular": "8.0.2",
35
- "@schematics/update": "0.800.2",
31
+ "@angular-devkit/architect": "0.800.6",
32
+ "@angular-devkit/core": "8.0.6",
33
+ "@angular-devkit/schematics": "8.0.6",
34
+ "@schematics/angular": "8.0.6",
35
+ "@schematics/update": "0.800.6",
36
36
  "@yarnpkg/lockfile": "1.1.0",
37
37
  "debug": "^4.1.1",
38
38
  "ini": "1.3.5",
@@ -49,10 +49,10 @@
49
49
  "ng-update": {
50
50
  "migrations": "@schematics/angular/migrations/migration-collection.json",
51
51
  "packageGroup": {
52
- "@angular/cli": "8.0.2",
53
- "@angular-devkit/build-angular": "0.800.2",
54
- "@angular-devkit/build-ng-packagr": "0.800.2",
55
- "@angular-devkit/build-webpack": "0.800.2"
52
+ "@angular/cli": "8.0.6",
53
+ "@angular-devkit/build-angular": "0.800.6",
54
+ "@angular-devkit/build-ng-packagr": "0.800.6",
55
+ "@angular-devkit/build-webpack": "0.800.6"
56
56
  }
57
57
  },
58
58
  "engines": {