@angular/cli 11.2.0-rc.0 → 11.2.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.
- package/commands/add-impl.js +1 -1
- package/commands/lint-long.md +1 -1
- package/commands/new-impl.js +0 -2
- package/commands/update-impl.js +37 -2
- package/models/analytics.js +2 -2
- package/models/schematic-command.js +7 -0
- package/package.json +13 -13
- package/utilities/package-manager.d.ts +2 -2
- package/utilities/package-manager.js +15 -12
package/commands/add-impl.js
CHANGED
|
@@ -36,7 +36,7 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
36
36
|
}
|
|
37
37
|
async run(options) {
|
|
38
38
|
var _a;
|
|
39
|
-
package_manager_1.ensureCompatibleNpm();
|
|
39
|
+
await package_manager_1.ensureCompatibleNpm(this.context.root);
|
|
40
40
|
if (!options.collection) {
|
|
41
41
|
this.logger.fatal(`The "ng add" command requires a name argument to be specified eg. ` +
|
|
42
42
|
`${color_1.colors.yellow('ng add [name] ')}. For more details, use "ng help".`);
|
package/commands/lint-long.md
CHANGED
|
@@ -4,4 +4,4 @@ When a project name is not supplied, it will execute for all projects.
|
|
|
4
4
|
The default linting tool is [TSLint](https://palantir.github.io/tslint/), and the default configuration is specified in the project's `tslint.json` file.
|
|
5
5
|
|
|
6
6
|
**Note**: TSLint has been discontinued and support has been deprecated in the Angular CLI. The options shown below are for the deprecated TSLint builder.
|
|
7
|
-
To opt-in using the community driven ESLint builder, see [angular-eslint](https://github.com/angular-eslint/angular-eslint#migrating-from-codelyzer-and-tslint) README.
|
|
7
|
+
To opt-in using the community driven ESLint builder, see [angular-eslint](https://github.com/angular-eslint/angular-eslint#migrating-an-angular-cli-project-from-codelyzer-and-tslint) README.
|
package/commands/new-impl.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
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");
|
|
6
5
|
class NewCommand extends schematic_command_1.SchematicCommand {
|
|
7
6
|
constructor() {
|
|
8
7
|
super(...arguments);
|
|
@@ -14,7 +13,6 @@ class NewCommand extends schematic_command_1.SchematicCommand {
|
|
|
14
13
|
return super.initialize(options);
|
|
15
14
|
}
|
|
16
15
|
async run(options) {
|
|
17
|
-
package_manager_1.ensureCompatibleNpm();
|
|
18
16
|
// Register the version of the CLI in the registry.
|
|
19
17
|
const packageJson = require('../package.json');
|
|
20
18
|
const version = packageJson.version;
|
package/commands/update-impl.js
CHANGED
|
@@ -190,13 +190,18 @@ class UpdateCommand extends command_1.Command {
|
|
|
190
190
|
// tslint:disable-next-line:no-big-function
|
|
191
191
|
async run(options) {
|
|
192
192
|
var _a;
|
|
193
|
-
package_manager_1.ensureCompatibleNpm();
|
|
193
|
+
await package_manager_1.ensureCompatibleNpm(this.context.root);
|
|
194
194
|
// Check if the current installed CLI version is older than the latest version.
|
|
195
195
|
if (!disableVersionCheck && await this.checkCLILatestVersion(options.verbose, options.next)) {
|
|
196
196
|
this.logger.warn(`The installed local Angular CLI version is older than the latest ${options.next ? 'pre-release' : 'stable'} version.\n` +
|
|
197
197
|
'Installing a temporary version to perform the update.');
|
|
198
198
|
return install_package_1.runTempPackageBin(`@angular/cli@${options.next ? 'next' : 'latest'}`, this.logger, this.packageManager, process.argv.slice(2));
|
|
199
199
|
}
|
|
200
|
+
const logVerbose = (message) => {
|
|
201
|
+
if (options.verbose) {
|
|
202
|
+
this.logger.info(message);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
200
205
|
if (options.all) {
|
|
201
206
|
const updateCmd = this.packageManager === schema_1.PackageManager.Yarn
|
|
202
207
|
? `'yarn upgrade-interactive' or 'yarn upgrade'`
|
|
@@ -474,7 +479,37 @@ class UpdateCommand extends command_1.Command {
|
|
|
474
479
|
for (const migration of migrations) {
|
|
475
480
|
// Resolve the package from the workspace root, as otherwise it will be resolved from the temp
|
|
476
481
|
// installed CLI version.
|
|
477
|
-
|
|
482
|
+
let packagePath;
|
|
483
|
+
logVerbose(`Resolving migration package '${migration.package}' from '${this.context.root}'...`);
|
|
484
|
+
try {
|
|
485
|
+
try {
|
|
486
|
+
packagePath = path.dirname(
|
|
487
|
+
// This may fail if the `package.json` is not exported as an entry point
|
|
488
|
+
require.resolve(path.join(migration.package, 'package.json'), {
|
|
489
|
+
paths: [this.context.root],
|
|
490
|
+
}));
|
|
491
|
+
}
|
|
492
|
+
catch (e) {
|
|
493
|
+
if (e.code === 'MODULE_NOT_FOUND') {
|
|
494
|
+
// Fallback to trying to resolve the package's main entry point
|
|
495
|
+
packagePath = require.resolve(migration.package, { paths: [this.context.root] });
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
throw e;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
catch (e) {
|
|
503
|
+
if (e.code === 'MODULE_NOT_FOUND') {
|
|
504
|
+
logVerbose(e.toString());
|
|
505
|
+
this.logger.error(`Migrations for package (${migration.package}) were not found.` +
|
|
506
|
+
' The package could not be found in the workspace.');
|
|
507
|
+
}
|
|
508
|
+
else {
|
|
509
|
+
this.logger.error(`Unable to resolve migrations for package (${migration.package}). [${e.message}]`);
|
|
510
|
+
}
|
|
511
|
+
return 1;
|
|
512
|
+
}
|
|
478
513
|
let migrations;
|
|
479
514
|
// Check if it is a package-local location
|
|
480
515
|
const localMigrations = path.join(packagePath, migration.collection);
|
package/models/analytics.js
CHANGED
|
@@ -336,7 +336,7 @@ async function promptGlobalAnalytics(force = false) {
|
|
|
336
336
|
message: core_1.tags.stripIndents `
|
|
337
337
|
Would you like to share anonymous usage data with the Angular Team at Google under
|
|
338
338
|
Google’s Privacy Policy at https://policies.google.com/privacy? For more details and
|
|
339
|
-
how to change this setting, see
|
|
339
|
+
how to change this setting, see https://angular.io/analytics.
|
|
340
340
|
`,
|
|
341
341
|
default: false,
|
|
342
342
|
},
|
|
@@ -390,7 +390,7 @@ async function promptProjectAnalytics(force = false) {
|
|
|
390
390
|
message: core_1.tags.stripIndents `
|
|
391
391
|
Would you like to share anonymous usage data about this project with the Angular Team at
|
|
392
392
|
Google under Google’s Privacy Policy at https://policies.google.com/privacy? For more
|
|
393
|
-
details and how to change this setting, see
|
|
393
|
+
details and how to change this setting, see https://angular.io/analytics.
|
|
394
394
|
|
|
395
395
|
`,
|
|
396
396
|
default: false,
|
|
@@ -383,6 +383,13 @@ class SchematicCommand extends command_1.Command {
|
|
|
383
383
|
error = false;
|
|
384
384
|
}
|
|
385
385
|
});
|
|
386
|
+
// Temporary compatibility check for NPM 7
|
|
387
|
+
if (collectionName === '@schematics/angular' && schematicName === 'ng-new') {
|
|
388
|
+
if (!input.skipInstall &&
|
|
389
|
+
(input.packageManager === undefined || input.packageManager === 'npm')) {
|
|
390
|
+
await package_manager_1.ensureCompatibleNpm(this.context.root);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
386
393
|
return new Promise(resolve => {
|
|
387
394
|
workflow
|
|
388
395
|
.execute({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "11.2.
|
|
3
|
+
"version": "11.2.2",
|
|
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.1102.
|
|
32
|
-
"@angular-devkit/core": "11.2.
|
|
33
|
-
"@angular-devkit/schematics": "11.2.
|
|
34
|
-
"@schematics/angular": "11.2.
|
|
35
|
-
"@schematics/update": "0.1102.
|
|
31
|
+
"@angular-devkit/architect": "0.1102.2",
|
|
32
|
+
"@angular-devkit/core": "11.2.2",
|
|
33
|
+
"@angular-devkit/schematics": "11.2.2",
|
|
34
|
+
"@schematics/angular": "11.2.2",
|
|
35
|
+
"@schematics/update": "0.1102.2",
|
|
36
36
|
"@yarnpkg/lockfile": "1.1.0",
|
|
37
37
|
"ansi-colors": "4.1.1",
|
|
38
38
|
"debug": "4.3.1",
|
|
@@ -54,17 +54,17 @@
|
|
|
54
54
|
"ng-update": {
|
|
55
55
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
56
56
|
"packageGroup": {
|
|
57
|
-
"@angular/cli": "11.2.
|
|
58
|
-
"@angular-devkit/architect": "0.1102.
|
|
59
|
-
"@angular-devkit/build-angular": "0.1102.
|
|
60
|
-
"@angular-devkit/build-webpack": "0.1102.
|
|
61
|
-
"@angular-devkit/core": "11.2.
|
|
62
|
-
"@angular-devkit/schematics": "11.2.
|
|
57
|
+
"@angular/cli": "11.2.2",
|
|
58
|
+
"@angular-devkit/architect": "0.1102.2",
|
|
59
|
+
"@angular-devkit/build-angular": "0.1102.2",
|
|
60
|
+
"@angular-devkit/build-webpack": "0.1102.2",
|
|
61
|
+
"@angular-devkit/core": "11.2.2",
|
|
62
|
+
"@angular-devkit/schematics": "11.2.2"
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
"engines": {
|
|
66
66
|
"node": ">= 10.13.0",
|
|
67
|
-
"npm": "^6.11.0",
|
|
67
|
+
"npm": "^6.11.0 || ^7.5.6",
|
|
68
68
|
"yarn": ">= 1.13.0"
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -3,6 +3,6 @@ export declare function supportsYarn(): boolean;
|
|
|
3
3
|
export declare function supportsNpm(): boolean;
|
|
4
4
|
export declare function getPackageManager(root: string): Promise<PackageManager>;
|
|
5
5
|
/**
|
|
6
|
-
* Checks if the npm version is
|
|
6
|
+
* Checks if the npm version is a supported 7.x version. If not, display a warning.
|
|
7
7
|
*/
|
|
8
|
-
export declare function ensureCompatibleNpm(): void
|
|
8
|
+
export declare function ensureCompatibleNpm(root: string): Promise<void>;
|
|
@@ -11,6 +11,7 @@ exports.ensureCompatibleNpm = exports.getPackageManager = exports.supportsNpm =
|
|
|
11
11
|
const child_process_1 = require("child_process");
|
|
12
12
|
const fs_1 = require("fs");
|
|
13
13
|
const path_1 = require("path");
|
|
14
|
+
const semver_1 = require("semver");
|
|
14
15
|
const schema_1 = require("../lib/config/schema");
|
|
15
16
|
const config_1 = require("./config");
|
|
16
17
|
function supports(name) {
|
|
@@ -57,23 +58,25 @@ async function getPackageManager(root) {
|
|
|
57
58
|
}
|
|
58
59
|
exports.getPackageManager = getPackageManager;
|
|
59
60
|
/**
|
|
60
|
-
* Checks if the npm version is
|
|
61
|
+
* Checks if the npm version is a supported 7.x version. If not, display a warning.
|
|
61
62
|
*/
|
|
62
|
-
function ensureCompatibleNpm() {
|
|
63
|
-
|
|
63
|
+
async function ensureCompatibleNpm(root) {
|
|
64
|
+
if ((await getPackageManager(root)) !== schema_1.PackageManager.Npm) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
64
67
|
try {
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
+
const versionText = child_process_1.execSync('npm --version', { encoding: 'utf8', stdio: 'pipe' }).trim();
|
|
69
|
+
const version = semver_1.valid(versionText);
|
|
70
|
+
if (!version) {
|
|
68
71
|
return;
|
|
69
72
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
if (semver_1.satisfies(version, '>=7 <7.5.6')) {
|
|
74
|
+
// tslint:disable-next-line: no-console
|
|
75
|
+
console.warn(`npm version ${version} detected.` +
|
|
76
|
+
' When using npm 7 with the Angular CLI, npm version 7.5.6 or higher is recommended.');
|
|
77
|
+
}
|
|
75
78
|
}
|
|
76
|
-
catch (
|
|
79
|
+
catch (_a) {
|
|
77
80
|
// npm is not installed
|
|
78
81
|
}
|
|
79
82
|
}
|