@angular/cli 8.3.16 → 8.3.20

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.
@@ -32,7 +32,7 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
32
32
  async run(options) {
33
33
  // Check if the current installed CLI version is older than the latest version.
34
34
  if (await this.checkCLILatestVersion(options.verbose, options.next)) {
35
- this.logger.warn('The installed Angular CLI version is older than the latest published version.\n' +
35
+ this.logger.warn(`The installed Angular CLI version is older than the latest ${options.next ? 'pre-release' : 'stable'} version.\n` +
36
36
  'Installing a temporary version to perform the update.');
37
37
  return install_package_1.runTempPackageBin(`@angular/cli@${options.next ? 'next' : 'latest'}`, this.logger, this.packageManager, process.argv.slice(2));
38
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cli",
3
- "version": "8.3.16",
3
+ "version": "8.3.20",
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.803.16",
32
- "@angular-devkit/core": "8.3.16",
33
- "@angular-devkit/schematics": "8.3.16",
34
- "@schematics/angular": "8.3.16",
35
- "@schematics/update": "0.803.16",
31
+ "@angular-devkit/architect": "0.803.20",
32
+ "@angular-devkit/core": "8.3.20",
33
+ "@angular-devkit/schematics": "8.3.20",
34
+ "@schematics/angular": "8.3.20",
35
+ "@schematics/update": "0.803.20",
36
36
  "@yarnpkg/lockfile": "1.1.0",
37
37
  "ansi-colors": "4.1.1",
38
38
  "debug": "^4.1.1",
@@ -52,10 +52,10 @@
52
52
  "ng-update": {
53
53
  "migrations": "@schematics/angular/migrations/migration-collection.json",
54
54
  "packageGroup": {
55
- "@angular/cli": "8.3.16",
56
- "@angular-devkit/build-angular": "0.803.16",
57
- "@angular-devkit/build-ng-packagr": "0.803.16",
58
- "@angular-devkit/build-webpack": "0.803.16"
55
+ "@angular/cli": "8.3.20",
56
+ "@angular-devkit/build-angular": "0.803.20",
57
+ "@angular-devkit/build-ng-packagr": "0.803.20",
58
+ "@angular-devkit/build-webpack": "0.803.20"
59
59
  }
60
60
  },
61
61
  "engines": {
@@ -7,6 +7,6 @@
7
7
  */
8
8
  import { logging } from '@angular-devkit/core';
9
9
  import { PackageManager } from '../lib/config/schema';
10
- export declare function installPackage(packageName: string, logger: logging.Logger, packageManager?: PackageManager, extraArgs?: string[], global?: boolean): void;
10
+ export declare function installPackage(packageName: string, logger: logging.Logger, packageManager?: PackageManager, extraArgs?: string[], cwd?: string): void;
11
11
  export declare function installTempPackage(packageName: string, logger: logging.Logger, packageManager?: PackageManager): string;
12
12
  export declare function runTempPackageBin(packageName: string, logger: logging.Logger, packageManager?: PackageManager, args?: string[]): number;
@@ -14,31 +14,27 @@ const path_1 = require("path");
14
14
  const rimraf = require("rimraf");
15
15
  const schema_1 = require("../lib/config/schema");
16
16
  const color_1 = require("../utilities/color");
17
- function installPackage(packageName, logger, packageManager = schema_1.PackageManager.Npm, extraArgs = [], global = false) {
17
+ function installPackage(packageName, logger, packageManager = schema_1.PackageManager.Npm, extraArgs = [], cwd = process.cwd()) {
18
18
  const packageManagerArgs = getPackageManagerArguments(packageManager);
19
19
  const installArgs = [
20
20
  packageManagerArgs.install,
21
21
  packageName,
22
22
  packageManagerArgs.silent,
23
+ packageManagerArgs.noLockfile,
23
24
  ];
24
25
  logger.info(color_1.colors.green(`Installing packages for tooling via ${packageManager}.`));
25
- if (global) {
26
- if (packageManager === schema_1.PackageManager.Yarn) {
27
- installArgs.unshift('global');
28
- }
29
- else {
30
- installArgs.push('--global');
31
- }
32
- }
33
- const { status } = child_process_1.spawnSync(packageManager, [
34
- ...installArgs,
35
- ...extraArgs,
36
- ], {
37
- stdio: 'inherit',
26
+ const { status, stderr, stdout, error } = child_process_1.spawnSync(packageManager, [...installArgs, ...extraArgs], {
27
+ stdio: 'pipe',
28
+ encoding: 'utf8',
38
29
  shell: true,
30
+ cwd,
39
31
  });
40
32
  if (status !== 0) {
41
- throw new Error('Package install failed, see above.');
33
+ let errorMessage = ((error && error.message) || stderr || stdout || '').trim();
34
+ if (errorMessage) {
35
+ errorMessage += '\n';
36
+ }
37
+ throw new Error(errorMessage + `Package install failed${errorMessage ? ', see above' : ''}.`);
42
38
  }
43
39
  logger.info(color_1.colors.green(`Installed packages for tooling via ${packageManager}.`));
44
40
  }
@@ -46,23 +42,36 @@ exports.installPackage = installPackage;
46
42
  function installTempPackage(packageName, logger, packageManager = schema_1.PackageManager.Npm) {
47
43
  const tempPath = fs_1.mkdtempSync(path_1.join(fs_1.realpathSync(os_1.tmpdir()), '.ng-temp-packages-'));
48
44
  // clean up temp directory on process exit
49
- process.on('exit', () => rimraf.sync(tempPath));
45
+ process.on('exit', () => {
46
+ try {
47
+ rimraf.sync(tempPath);
48
+ }
49
+ catch (_a) { }
50
+ });
51
+ // NPM will warn when a `package.json` is not found in the install directory
52
+ // Example:
53
+ // npm WARN enoent ENOENT: no such file or directory, open '/tmp/.ng-temp-packages-84Qi7y/package.json'
54
+ // npm WARN .ng-temp-packages-84Qi7y No description
55
+ // npm WARN .ng-temp-packages-84Qi7y No repository field.
56
+ // npm WARN .ng-temp-packages-84Qi7y No license field.
57
+ // While we can use `npm init -y` we will end up needing to update the 'package.json' anyways
58
+ // because of missing fields.
59
+ fs_1.writeFileSync(path_1.join(tempPath, 'package.json'), JSON.stringify({
60
+ name: 'temp-cli-install',
61
+ description: 'temp-cli-install',
62
+ repository: 'temp-cli-install',
63
+ license: 'MIT',
64
+ }));
50
65
  // setup prefix/global modules path
51
66
  const packageManagerArgs = getPackageManagerArguments(packageManager);
67
+ const tempNodeModules = path_1.join(tempPath, 'node_modules');
52
68
  const installArgs = [
53
69
  packageManagerArgs.prefix,
54
- tempPath,
70
+ // Yarn will no append 'node_modules' to the path
71
+ packageManager === schema_1.PackageManager.Yarn ? tempNodeModules : tempPath,
72
+ packageManagerArgs.noLockfile,
55
73
  ];
56
- installPackage(packageName, logger, packageManager, installArgs, true);
57
- let tempNodeModules;
58
- if (packageManager !== schema_1.PackageManager.Yarn && process.platform !== 'win32') {
59
- // Global installs on Unix systems go to {prefix}/lib/node_modules.
60
- // Global installs on Windows go to {prefix}/node_modules (that is, no lib folder.)
61
- tempNodeModules = path_1.join(tempPath, 'lib', 'node_modules');
62
- }
63
- else {
64
- tempNodeModules = path_1.join(tempPath, 'node_modules');
65
- }
74
+ installPackage(packageName, logger, packageManager, installArgs, tempPath);
66
75
  // Needed to resolve schematics from this location since we use a custom
67
76
  // resolve strategy in '@angular/devkit-core/node'
68
77
  // todo: this should be removed when we change the resolutions to use require.resolve
@@ -92,10 +101,7 @@ function runTempPackageBin(packageName, logger, packageManager = schema_1.Packag
92
101
  if (!binPath) {
93
102
  throw new Error(`Cannot locate bin for temporary package: ${packageNameNoVersion}.`);
94
103
  }
95
- const argv = [
96
- binPath,
97
- ...args,
98
- ];
104
+ const argv = [binPath, ...args];
99
105
  const { status, error } = child_process_1.spawnSync('node', argv, {
100
106
  stdio: 'inherit',
101
107
  shell: true,
@@ -112,15 +118,27 @@ function runTempPackageBin(packageName, logger, packageManager = schema_1.Packag
112
118
  }
113
119
  exports.runTempPackageBin = runTempPackageBin;
114
120
  function getPackageManagerArguments(packageManager) {
115
- return packageManager === schema_1.PackageManager.Yarn
116
- ? {
117
- silent: '--silent',
118
- install: 'add',
119
- prefix: '--global-folder',
120
- }
121
- : {
122
- silent: '--quiet',
123
- install: 'install',
124
- prefix: '--prefix',
125
- };
121
+ switch (packageManager) {
122
+ case schema_1.PackageManager.Yarn:
123
+ return {
124
+ silent: '--silent',
125
+ install: 'add',
126
+ prefix: '--modules-folder',
127
+ noLockfile: '--no-lockfile',
128
+ };
129
+ case schema_1.PackageManager.Pnpm:
130
+ return {
131
+ silent: '--silent',
132
+ install: 'add',
133
+ prefix: '--prefix',
134
+ noLockfile: '--no-lockfile',
135
+ };
136
+ default:
137
+ return {
138
+ silent: '--quiet',
139
+ install: 'install',
140
+ prefix: '--prefix',
141
+ noLockfile: '--no-package-lock',
142
+ };
143
+ }
126
144
  }