@angular/cli 11.1.0 → 11.1.4
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.
- package/commands/add-impl.js +1 -0
- package/commands/doc-impl.js +2 -5
- package/commands/new-impl.js +2 -0
- package/commands/update-impl.js +26 -3
- package/lib/config/schema.json +2 -2
- package/models/schematic-command.js +1 -1
- package/package.json +13 -13
- package/utilities/package-manager.d.ts +4 -0
- package/utilities/package-manager.js +26 -1
- package/utilities/package-metadata.js +1 -1
package/commands/add-impl.js
CHANGED
|
@@ -35,6 +35,7 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
35
35
|
}
|
|
36
36
|
async run(options) {
|
|
37
37
|
var _a;
|
|
38
|
+
await package_manager_1.ensureCompatibleNpm(this.context.root);
|
|
38
39
|
if (!options.collection) {
|
|
39
40
|
this.logger.fatal(`The "ng add" command requires a name argument to be specified eg. ` +
|
|
40
41
|
`${color_1.colors.yellow('ng add [name] ')}. For more details, use "ng help".`);
|
package/commands/doc-impl.js
CHANGED
|
@@ -45,11 +45,8 @@ class DocCommand extends command_1.Command {
|
|
|
45
45
|
if (options.search) {
|
|
46
46
|
searchUrl = `https://${domain}/docs?search=${options.keyword}`;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
open(searchUrl, {
|
|
51
|
-
wait: false,
|
|
52
|
-
});
|
|
48
|
+
await open(searchUrl, {
|
|
49
|
+
wait: false,
|
|
53
50
|
});
|
|
54
51
|
}
|
|
55
52
|
}
|
package/commands/new-impl.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NewCommand = void 0;
|
|
4
4
|
const schematic_command_1 = require("../models/schematic-command");
|
|
5
|
+
const package_manager_1 = require("../utilities/package-manager");
|
|
5
6
|
class NewCommand extends schematic_command_1.SchematicCommand {
|
|
6
7
|
constructor() {
|
|
7
8
|
super(...arguments);
|
|
@@ -13,6 +14,7 @@ class NewCommand extends schematic_command_1.SchematicCommand {
|
|
|
13
14
|
return super.initialize(options);
|
|
14
15
|
}
|
|
15
16
|
async run(options) {
|
|
17
|
+
await package_manager_1.ensureCompatibleNpm(this.context.root);
|
|
16
18
|
// Register the version of the CLI in the registry.
|
|
17
19
|
const packageJson = require('../package.json');
|
|
18
20
|
const version = packageJson.version;
|
package/commands/update-impl.js
CHANGED
|
@@ -188,6 +188,7 @@ class UpdateCommand extends command_1.Command {
|
|
|
188
188
|
// tslint:disable-next-line:no-big-function
|
|
189
189
|
async run(options) {
|
|
190
190
|
var _a;
|
|
191
|
+
await package_manager_1.ensureCompatibleNpm(this.context.root);
|
|
191
192
|
// Check if the @angular-devkit/schematics package can be resolved from the workspace root
|
|
192
193
|
// This works around issues with packages containing migrations that cannot directly depend on the package
|
|
193
194
|
// This check can be removed once the schematic runtime handles this situation
|
|
@@ -487,10 +488,32 @@ class UpdateCommand extends command_1.Command {
|
|
|
487
488
|
const migrations = global.externalMigrations;
|
|
488
489
|
if (success && migrations) {
|
|
489
490
|
for (const migration of migrations) {
|
|
490
|
-
|
|
491
|
-
// Resolve the collection from the workspace root, as otherwise it will be resolved from the temp
|
|
491
|
+
// Resolve the package from the workspace root, as otherwise it will be resolved from the temp
|
|
492
492
|
// installed CLI version.
|
|
493
|
-
require.resolve(migration.
|
|
493
|
+
const packagePath = require.resolve(migration.package, { paths: [this.context.root] });
|
|
494
|
+
let migrations;
|
|
495
|
+
// Check if it is a package-local location
|
|
496
|
+
const localMigrations = path.join(packagePath, migration.collection);
|
|
497
|
+
if (fs.existsSync(localMigrations)) {
|
|
498
|
+
migrations = localMigrations;
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
// Try to resolve from package location.
|
|
502
|
+
// This avoids issues with package hoisting.
|
|
503
|
+
try {
|
|
504
|
+
migrations = require.resolve(migration.collection, { paths: [packagePath] });
|
|
505
|
+
}
|
|
506
|
+
catch (e) {
|
|
507
|
+
if (e.code === 'MODULE_NOT_FOUND') {
|
|
508
|
+
this.logger.error(`Migrations for package (${migration.package}) were not found.`);
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
this.logger.error(`Unable to resolve migrations for package (${migration.package}). [${e.message}]`);
|
|
512
|
+
}
|
|
513
|
+
return 1;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
const result = await this.executeMigrations(migration.package, migrations, new semver.Range('>' + migration.from + ' <=' + migration.to), options.createCommits);
|
|
494
517
|
if (!result) {
|
|
495
518
|
return 0;
|
|
496
519
|
}
|
package/lib/config/schema.json
CHANGED
|
@@ -751,7 +751,7 @@
|
|
|
751
751
|
]
|
|
752
752
|
},
|
|
753
753
|
"fonts": {
|
|
754
|
-
"description": "Enables optimization for fonts. This requires internet access.",
|
|
754
|
+
"description": "Enables optimization for fonts. This option requires internet access. `HTTPS_PROXY` environment variable can be used to specify a proxy server.",
|
|
755
755
|
"default": true,
|
|
756
756
|
"oneOf": [
|
|
757
757
|
{
|
|
@@ -759,7 +759,7 @@
|
|
|
759
759
|
"properties": {
|
|
760
760
|
"inline": {
|
|
761
761
|
"type": "boolean",
|
|
762
|
-
"description": "Reduce render blocking requests by inlining external Google fonts and icons CSS definitions in the application's HTML index file. This requires internet access.",
|
|
762
|
+
"description": "Reduce render blocking requests by inlining external Google fonts and icons CSS definitions in the application's HTML index file. This option requires internet access. `HTTPS_PROXY` environment variable can be used to specify a proxy server.",
|
|
763
763
|
"default": true
|
|
764
764
|
}
|
|
765
765
|
},
|
|
@@ -409,7 +409,7 @@ class SchematicCommand extends command_1.Command {
|
|
|
409
409
|
this.logger.fatal('The Schematic workflow failed. See above.');
|
|
410
410
|
}
|
|
411
411
|
else if (debug) {
|
|
412
|
-
this.logger.fatal(`An error
|
|
412
|
+
this.logger.fatal(`An error occurred:\n${err.message}\n${err.stack}`);
|
|
413
413
|
}
|
|
414
414
|
else {
|
|
415
415
|
this.logger.fatal(err.message);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.4",
|
|
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.1101.
|
|
32
|
-
"@angular-devkit/core": "11.1.
|
|
33
|
-
"@angular-devkit/schematics": "11.1.
|
|
34
|
-
"@schematics/angular": "11.1.
|
|
35
|
-
"@schematics/update": "0.1101.
|
|
31
|
+
"@angular-devkit/architect": "0.1101.4",
|
|
32
|
+
"@angular-devkit/core": "11.1.4",
|
|
33
|
+
"@angular-devkit/schematics": "11.1.4",
|
|
34
|
+
"@schematics/angular": "11.1.4",
|
|
35
|
+
"@schematics/update": "0.1101.4",
|
|
36
36
|
"@yarnpkg/lockfile": "1.1.0",
|
|
37
37
|
"ansi-colors": "4.1.1",
|
|
38
38
|
"debug": "4.3.1",
|
|
@@ -53,17 +53,17 @@
|
|
|
53
53
|
"ng-update": {
|
|
54
54
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
55
55
|
"packageGroup": {
|
|
56
|
-
"@angular/cli": "11.1.
|
|
57
|
-
"@angular-devkit/architect": "0.1101.
|
|
58
|
-
"@angular-devkit/build-angular": "0.1101.
|
|
59
|
-
"@angular-devkit/build-webpack": "0.1101.
|
|
60
|
-
"@angular-devkit/core": "11.1.
|
|
61
|
-
"@angular-devkit/schematics": "11.1.
|
|
56
|
+
"@angular/cli": "11.1.4",
|
|
57
|
+
"@angular-devkit/architect": "0.1101.4",
|
|
58
|
+
"@angular-devkit/build-angular": "0.1101.4",
|
|
59
|
+
"@angular-devkit/build-webpack": "0.1101.4",
|
|
60
|
+
"@angular-devkit/core": "11.1.4",
|
|
61
|
+
"@angular-devkit/schematics": "11.1.4"
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"engines": {
|
|
65
65
|
"node": ">= 10.13.0",
|
|
66
|
-
"npm": "
|
|
66
|
+
"npm": "^6.11.0",
|
|
67
67
|
"yarn": ">= 1.13.0"
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -2,3 +2,7 @@ import { PackageManager } from '../lib/config/schema';
|
|
|
2
2
|
export declare function supportsYarn(): boolean;
|
|
3
3
|
export declare function supportsNpm(): boolean;
|
|
4
4
|
export declare function getPackageManager(root: string): Promise<PackageManager>;
|
|
5
|
+
/**
|
|
6
|
+
* Checks if the npm version is version 6.x. If not, display a message and exit.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ensureCompatibleNpm(root: string): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPackageManager = exports.supportsNpm = exports.supportsYarn = void 0;
|
|
3
|
+
exports.ensureCompatibleNpm = exports.getPackageManager = exports.supportsNpm = exports.supportsYarn = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright Google Inc. All Rights Reserved.
|
|
@@ -56,3 +56,28 @@ async function getPackageManager(root) {
|
|
|
56
56
|
return packageManager || schema_1.PackageManager.Npm;
|
|
57
57
|
}
|
|
58
58
|
exports.getPackageManager = getPackageManager;
|
|
59
|
+
/**
|
|
60
|
+
* Checks if the npm version is version 6.x. If not, display a message and exit.
|
|
61
|
+
*/
|
|
62
|
+
async function ensureCompatibleNpm(root) {
|
|
63
|
+
var _a;
|
|
64
|
+
if ((await getPackageManager(root)) !== schema_1.PackageManager.Npm) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
const version = child_process_1.execSync('npm --version', { encoding: 'utf8', stdio: 'pipe' }).trim();
|
|
69
|
+
const major = Number((_a = version.match(/^(\d+)\./)) === null || _a === void 0 ? void 0 : _a[1]);
|
|
70
|
+
if (major === 6) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
// tslint:disable-next-line: no-console
|
|
74
|
+
console.error(`npm version ${version} detected.\n` +
|
|
75
|
+
'The Angular CLI currently requires npm version 6.\n\n' +
|
|
76
|
+
'Please install a compatible version to proceed (`npm install --global npm@6`).\n');
|
|
77
|
+
process.exit(3);
|
|
78
|
+
}
|
|
79
|
+
catch (_b) {
|
|
80
|
+
// npm is not installed
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.ensureCompatibleNpm = ensureCompatibleNpm;
|
|
@@ -81,7 +81,7 @@ function readOptions(logger, yarn = false, showPotentials = false) {
|
|
|
81
81
|
if (typeof value === 'string') {
|
|
82
82
|
const cafile = path.resolve(path.dirname(location), value);
|
|
83
83
|
try {
|
|
84
|
-
options['ca'] = fs_1.readFileSync(cafile, 'utf8').replace(/\r?\n
|
|
84
|
+
options['ca'] = fs_1.readFileSync(cafile, 'utf8').replace(/\r?\n/g, '\n');
|
|
85
85
|
}
|
|
86
86
|
catch (_a) { }
|
|
87
87
|
}
|