@angular/cli 10.2.3 → 10.2.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/update-impl.d.ts +5 -4
- package/commands/update-impl.js +78 -40
- package/lib/cli/index.d.ts +1 -0
- package/lib/cli/index.js +4 -0
- package/lib/init.js +45 -63
- package/models/version.d.ts +15 -0
- package/models/version.js +24 -0
- package/package.json +12 -12
|
@@ -23,8 +23,9 @@ export declare class UpdateCommand extends Command<UpdateCommandSchema> {
|
|
|
23
23
|
private commit;
|
|
24
24
|
private checkCleanGit;
|
|
25
25
|
/**
|
|
26
|
-
* Checks if the current installed CLI version is older than
|
|
27
|
-
* @returns
|
|
28
|
-
|
|
29
|
-
private
|
|
26
|
+
* Checks if the current installed CLI version is older or newer than a compatible version.
|
|
27
|
+
* @returns the version to install or null when there is no update to install.
|
|
28
|
+
*/
|
|
29
|
+
private checkCLIVersion;
|
|
30
|
+
private getCLIUpdateRunnerVersion;
|
|
30
31
|
}
|
package/commands/update-impl.js
CHANGED
|
@@ -16,6 +16,7 @@ const child_process_1 = require("child_process");
|
|
|
16
16
|
const fs = require("fs");
|
|
17
17
|
const path = require("path");
|
|
18
18
|
const semver = require("semver");
|
|
19
|
+
const cli_1 = require("../lib/cli");
|
|
19
20
|
const schema_1 = require("../lib/config/schema");
|
|
20
21
|
const command_1 = require("../models/command");
|
|
21
22
|
const install_package_1 = require("../tasks/install-package");
|
|
@@ -27,8 +28,6 @@ const package_tree_1 = require("../utilities/package-tree");
|
|
|
27
28
|
const npa = require('npm-package-arg');
|
|
28
29
|
const pickManifest = require('npm-pick-manifest');
|
|
29
30
|
const oldConfigFileNames = ['.angular-cli.json', 'angular-cli.json'];
|
|
30
|
-
const NG_VERSION_9_POST_MSG = color_1.colors.cyan('\nYour project has been updated to Angular version 9!\n' +
|
|
31
|
-
'For more info, please see: https://v9.angular.io/guide/updating-to-version-9');
|
|
32
31
|
/**
|
|
33
32
|
* Disable CLI version mismatch checks and forces usage of the invoked CLI
|
|
34
33
|
* instead of invoking the local installed version.
|
|
@@ -37,6 +36,7 @@ const disableVersionCheckEnv = process.env['NG_DISABLE_VERSION_CHECK'];
|
|
|
37
36
|
const disableVersionCheck = disableVersionCheckEnv !== undefined &&
|
|
38
37
|
disableVersionCheckEnv !== '0' &&
|
|
39
38
|
disableVersionCheckEnv.toLowerCase() !== 'false';
|
|
39
|
+
const ANGULAR_PACKAGES_REGEXP = /^@(?:angular|nguniversal)\//;
|
|
40
40
|
class UpdateCommand extends command_1.Command {
|
|
41
41
|
constructor() {
|
|
42
42
|
super(...arguments);
|
|
@@ -58,7 +58,7 @@ class UpdateCommand extends command_1.Command {
|
|
|
58
58
|
let error = false;
|
|
59
59
|
let logs = [];
|
|
60
60
|
const files = new Set();
|
|
61
|
-
const reporterSubscription = this.workflow.reporter.subscribe(event => {
|
|
61
|
+
const reporterSubscription = this.workflow.reporter.subscribe((event) => {
|
|
62
62
|
// Strip leading slash to prevent confusion.
|
|
63
63
|
const eventPath = event.path.startsWith('/') ? event.path.substr(1) : event.path;
|
|
64
64
|
switch (event.kind) {
|
|
@@ -86,11 +86,11 @@ class UpdateCommand extends command_1.Command {
|
|
|
86
86
|
break;
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
|
-
const lifecycleSubscription = this.workflow.lifeCycle.subscribe(event => {
|
|
89
|
+
const lifecycleSubscription = this.workflow.lifeCycle.subscribe((event) => {
|
|
90
90
|
if (event.kind == 'end' || event.kind == 'post-tasks-start') {
|
|
91
91
|
if (!error) {
|
|
92
92
|
// Output the logging queue, no error happened.
|
|
93
|
-
logs.forEach(log => this.logger.info(log));
|
|
93
|
+
logs.forEach((log) => this.logger.info(log));
|
|
94
94
|
logs = [];
|
|
95
95
|
}
|
|
96
96
|
}
|
|
@@ -126,7 +126,7 @@ class UpdateCommand extends command_1.Command {
|
|
|
126
126
|
*/
|
|
127
127
|
async executeMigration(packageName, collectionPath, migrationName, commit) {
|
|
128
128
|
const collection = this.workflow.engine.createCollection(collectionPath);
|
|
129
|
-
const name = collection.listSchematicNames().find(name => name === migrationName);
|
|
129
|
+
const name = collection.listSchematicNames().find((name) => name === migrationName);
|
|
130
130
|
if (!name) {
|
|
131
131
|
this.logger.error(`Cannot find migration '${migrationName}' in '${packageName}'.`);
|
|
132
132
|
return false;
|
|
@@ -185,6 +185,7 @@ class UpdateCommand extends command_1.Command {
|
|
|
185
185
|
}
|
|
186
186
|
// tslint:disable-next-line:no-big-function
|
|
187
187
|
async run(options) {
|
|
188
|
+
var _a;
|
|
188
189
|
await package_manager_1.ensureCompatibleNpm(this.workspace.root);
|
|
189
190
|
// Check if the @angular-devkit/schematics package can be resolved from the workspace root
|
|
190
191
|
// This works around issues with packages containing migrations that cannot directly depend on the package
|
|
@@ -204,11 +205,14 @@ class UpdateCommand extends command_1.Command {
|
|
|
204
205
|
}
|
|
205
206
|
throw e;
|
|
206
207
|
}
|
|
207
|
-
// Check if the current installed CLI version is older than the latest version.
|
|
208
|
-
if (!disableVersionCheck
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
208
|
+
// Check if the current installed CLI version is older than the latest compatible version.
|
|
209
|
+
if (!disableVersionCheck) {
|
|
210
|
+
const cliVersionToInstall = await this.checkCLIVersion(options['--'], options.verbose, options.next);
|
|
211
|
+
if (cliVersionToInstall) {
|
|
212
|
+
this.logger.warn('The installed Angular CLI version is outdated.\n' +
|
|
213
|
+
`Installing a temporary Angular CLI versioned ${cliVersionToInstall} to perform the update.`);
|
|
214
|
+
return install_package_1.runTempPackageBin(`@angular/cli@${cliVersionToInstall}`, this.logger, this.packageManager, process.argv.slice(2));
|
|
215
|
+
}
|
|
212
216
|
}
|
|
213
217
|
const packages = [];
|
|
214
218
|
for (const request of options['--'] || []) {
|
|
@@ -219,7 +223,7 @@ class UpdateCommand extends command_1.Command {
|
|
|
219
223
|
this.logger.error(`Package '${request}' is not a registry package identifer.`);
|
|
220
224
|
return 1;
|
|
221
225
|
}
|
|
222
|
-
if (packages.some(v => v.name === packageIdentifier.name)) {
|
|
226
|
+
if (packages.some((v) => v.name === packageIdentifier.name)) {
|
|
223
227
|
this.logger.error(`Duplicate package '${packageIdentifier.name}' specified.`);
|
|
224
228
|
return 1;
|
|
225
229
|
}
|
|
@@ -322,7 +326,7 @@ class UpdateCommand extends command_1.Command {
|
|
|
322
326
|
// Allow running migrations on transitively installed dependencies
|
|
323
327
|
// There can technically be nested multiple versions
|
|
324
328
|
// TODO: If multiple, this should find all versions and ask which one to use
|
|
325
|
-
const child = packageTree.children.find(c => c.name === packageName);
|
|
329
|
+
const child = packageTree.children.find((c) => c.name === packageName);
|
|
326
330
|
if (child) {
|
|
327
331
|
packageNode = child;
|
|
328
332
|
}
|
|
@@ -348,8 +352,7 @@ class UpdateCommand extends command_1.Command {
|
|
|
348
352
|
// Normalize slashes
|
|
349
353
|
migrations = migrations.replace(/\\/g, '/');
|
|
350
354
|
if (migrations.startsWith('../')) {
|
|
351
|
-
this.logger.error('Package contains an invalid migrations field. '
|
|
352
|
-
'Paths outside the package root are not permitted.');
|
|
355
|
+
this.logger.error('Package contains an invalid migrations field. Paths outside the package root are not permitted.');
|
|
353
356
|
return 1;
|
|
354
357
|
}
|
|
355
358
|
// Check if it is a package-local location
|
|
@@ -373,9 +376,9 @@ class UpdateCommand extends command_1.Command {
|
|
|
373
376
|
return 1;
|
|
374
377
|
}
|
|
375
378
|
}
|
|
376
|
-
let
|
|
379
|
+
let result;
|
|
377
380
|
if (typeof options.migrateOnly == 'string') {
|
|
378
|
-
|
|
381
|
+
result = await this.executeMigration(packageName, migrations, options.migrateOnly, options.createCommits);
|
|
379
382
|
}
|
|
380
383
|
else {
|
|
381
384
|
const from = coerceVersionNumber(options.from);
|
|
@@ -384,18 +387,9 @@ class UpdateCommand extends command_1.Command {
|
|
|
384
387
|
return 1;
|
|
385
388
|
}
|
|
386
389
|
const migrationRange = new semver.Range('>' + from + ' <=' + (options.to || packageNode.package.version));
|
|
387
|
-
|
|
388
|
-
}
|
|
389
|
-
if (success) {
|
|
390
|
-
if (packageName === '@angular/core'
|
|
391
|
-
&& options.from
|
|
392
|
-
&& +options.from.split('.')[0] < 9
|
|
393
|
-
&& (options.to || packageNode.package.version).split('.')[0] === '9') {
|
|
394
|
-
this.logger.info(NG_VERSION_9_POST_MSG);
|
|
395
|
-
}
|
|
396
|
-
return 0;
|
|
390
|
+
result = await this.executeMigrations(packageName, migrations, migrationRange, options.createCommits);
|
|
397
391
|
}
|
|
398
|
-
return 1;
|
|
392
|
+
return result ? 0 : 1;
|
|
399
393
|
}
|
|
400
394
|
const requests = [];
|
|
401
395
|
// Validate packages actually are part of the workspace
|
|
@@ -466,10 +460,32 @@ class UpdateCommand extends command_1.Command {
|
|
|
466
460
|
this.logger.error(`Package specified by '${requestIdentifier.raw}' does not exist within the registry.`);
|
|
467
461
|
return 1;
|
|
468
462
|
}
|
|
469
|
-
if (manifest.version === node.package.version) {
|
|
463
|
+
if (manifest.version === ((_a = node.package) === null || _a === void 0 ? void 0 : _a.version)) {
|
|
470
464
|
this.logger.info(`Package '${packageName}' is already up to date.`);
|
|
471
465
|
continue;
|
|
472
466
|
}
|
|
467
|
+
if (node.package && ANGULAR_PACKAGES_REGEXP.test(node.package.name)) {
|
|
468
|
+
const { name, version } = node.package;
|
|
469
|
+
const toBeInstalledMajorVersion = +manifest.version.split('.')[0];
|
|
470
|
+
const currentMajorVersion = +version.split('.')[0];
|
|
471
|
+
if (toBeInstalledMajorVersion - currentMajorVersion > 1) {
|
|
472
|
+
// Only allow updating a single version at a time.
|
|
473
|
+
if (currentMajorVersion < 6) {
|
|
474
|
+
// Before version 6, the major versions were not always sequential.
|
|
475
|
+
// Example @angular/core skipped version 3, @angular/cli skipped versions 2-5.
|
|
476
|
+
this.logger.error(`Updating multiple major versions of '${name}' at once is not supported. Please migrate each major version individually.\n` +
|
|
477
|
+
`For more information about the update process, see https://update.angular.io/.`);
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
const nextMajorVersionFromCurrent = currentMajorVersion + 1;
|
|
481
|
+
this.logger.error(`Updating multiple major versions of '${name}' at once is not supported. Please migrate each major version individually.\n` +
|
|
482
|
+
`Run 'ng update ${name}@${nextMajorVersionFromCurrent}' in your workspace directory ` +
|
|
483
|
+
`to update to latest '${nextMajorVersionFromCurrent}.x' version of '${name}'.\n\n` +
|
|
484
|
+
`For more information about the update process, see https://update.angular.io/?v=${currentMajorVersion}.0-${nextMajorVersionFromCurrent}.0`);
|
|
485
|
+
}
|
|
486
|
+
return 1;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
473
489
|
packagesToUpdate.push(requestIdentifier.toString());
|
|
474
490
|
}
|
|
475
491
|
if (packagesToUpdate.length === 0) {
|
|
@@ -502,9 +518,6 @@ class UpdateCommand extends command_1.Command {
|
|
|
502
518
|
return 0;
|
|
503
519
|
}
|
|
504
520
|
}
|
|
505
|
-
if (migrations.some(m => m.package === '@angular/core' && m.to.split('.')[0] === '9' && +m.from.split('.')[0] < 9)) {
|
|
506
|
-
this.logger.info(NG_VERSION_9_POST_MSG);
|
|
507
|
-
}
|
|
508
521
|
}
|
|
509
522
|
return success ? 0 : 1;
|
|
510
523
|
}
|
|
@@ -549,7 +562,10 @@ class UpdateCommand extends command_1.Command {
|
|
|
549
562
|
}
|
|
550
563
|
checkCleanGit() {
|
|
551
564
|
try {
|
|
552
|
-
const topLevel = child_process_1.execSync('git rev-parse --show-toplevel', {
|
|
565
|
+
const topLevel = child_process_1.execSync('git rev-parse --show-toplevel', {
|
|
566
|
+
encoding: 'utf8',
|
|
567
|
+
stdio: 'pipe',
|
|
568
|
+
});
|
|
553
569
|
const result = child_process_1.execSync('git status --porcelain', { encoding: 'utf8', stdio: 'pipe' });
|
|
554
570
|
if (result.trim().length === 0) {
|
|
555
571
|
return true;
|
|
@@ -566,16 +582,38 @@ class UpdateCommand extends command_1.Command {
|
|
|
566
582
|
return true;
|
|
567
583
|
}
|
|
568
584
|
/**
|
|
569
|
-
* Checks if the current installed CLI version is older than
|
|
570
|
-
* @returns
|
|
571
|
-
|
|
572
|
-
async
|
|
573
|
-
const { version
|
|
574
|
-
const LatestCLIManifest = await package_metadata_1.fetchPackageManifest(`@angular/cli@${next ? 'next' : 'latest'}`, this.logger, {
|
|
585
|
+
* Checks if the current installed CLI version is older or newer than a compatible version.
|
|
586
|
+
* @returns the version to install or null when there is no update to install.
|
|
587
|
+
*/
|
|
588
|
+
async checkCLIVersion(packagesToUpdate, verbose = false, next = false) {
|
|
589
|
+
const { version } = await package_metadata_1.fetchPackageManifest(`@angular/cli@${this.getCLIUpdateRunnerVersion(packagesToUpdate, next)}`, this.logger, {
|
|
575
590
|
verbose,
|
|
576
591
|
usingYarn: this.packageManager === schema_1.PackageManager.Yarn,
|
|
577
592
|
});
|
|
578
|
-
return
|
|
593
|
+
return cli_1.VERSION.full === version ? null : version;
|
|
594
|
+
}
|
|
595
|
+
getCLIUpdateRunnerVersion(packagesToUpdate, next) {
|
|
596
|
+
var _a, _b;
|
|
597
|
+
if (next) {
|
|
598
|
+
return 'next';
|
|
599
|
+
}
|
|
600
|
+
const updatingAngularPackage = packagesToUpdate === null || packagesToUpdate === void 0 ? void 0 : packagesToUpdate.find((r) => ANGULAR_PACKAGES_REGEXP.test(r));
|
|
601
|
+
if (updatingAngularPackage) {
|
|
602
|
+
// If we are updating any Angular package we can update the CLI to the target version because
|
|
603
|
+
// migrations for @angular/core@13 can be executed using Angular/cli@13.
|
|
604
|
+
// This is same behaviour as `npx @angular/cli@13 update @angular/core@13`.
|
|
605
|
+
// `@angular/cli@13` -> ['', 'angular/cli', '13']
|
|
606
|
+
// `@angular/cli` -> ['', 'angular/cli']
|
|
607
|
+
const tempVersion = coerceVersionNumber(updatingAngularPackage.split('@')[2]);
|
|
608
|
+
return (_b = (_a = semver.parse(tempVersion)) === null || _a === void 0 ? void 0 : _a.major) !== null && _b !== void 0 ? _b : 'latest';
|
|
609
|
+
}
|
|
610
|
+
// When not updating an Angular package we cannot determine which schematic runtime the migration should to be executed in.
|
|
611
|
+
// Typically, we can assume that the `@angular/cli` was updated previously.
|
|
612
|
+
// Example: Angular official packages are typically updated prior to NGRX etc...
|
|
613
|
+
// Therefore, we only update to the latest patch version of the installed major version of the Angular CLI.
|
|
614
|
+
// This is important because we might end up in a scenario where locally Angular v12 is installed, updating NGRX from 11 to 12.
|
|
615
|
+
// We end up using Angular ClI v13 to run the migrations if we run the migrations using the CLI installed major version + 1 logic.
|
|
616
|
+
return cli_1.VERSION.major;
|
|
579
617
|
}
|
|
580
618
|
}
|
|
581
619
|
exports.UpdateCommand = UpdateCommand;
|
package/lib/cli/index.d.ts
CHANGED
package/lib/cli/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Version = exports.VERSION = void 0;
|
|
3
4
|
/**
|
|
4
5
|
* @license
|
|
5
6
|
* Copyright Google Inc. All Rights Reserved.
|
|
@@ -14,6 +15,9 @@ const color_1 = require("../../utilities/color");
|
|
|
14
15
|
const config_1 = require("../../utilities/config");
|
|
15
16
|
const log_file_1 = require("../../utilities/log-file");
|
|
16
17
|
const project_1 = require("../../utilities/project");
|
|
18
|
+
var version_1 = require("../../models/version");
|
|
19
|
+
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
|
|
20
|
+
Object.defineProperty(exports, "Version", { enumerable: true, get: function () { return version_1.Version; } });
|
|
17
21
|
const debugEnv = process.env['NG_DEBUG'];
|
|
18
22
|
const isDebug = debugEnv !== undefined &&
|
|
19
23
|
debugEnv !== '0' &&
|
package/lib/init.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,34 +6,16 @@ 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
10
|
require("symbol-observable");
|
|
11
11
|
// symbol polyfill must go first
|
|
12
12
|
// tslint:disable-next-line:ordered-imports import-groups
|
|
13
|
-
const core_1 = require("@angular-devkit/core");
|
|
14
13
|
const fs = require("fs");
|
|
15
14
|
const path = require("path");
|
|
16
15
|
const semver_1 = require("semver");
|
|
17
|
-
const stream_1 = require("stream");
|
|
18
16
|
const color_1 = require("../utilities/color");
|
|
19
17
|
const config_1 = require("../utilities/config");
|
|
20
|
-
const
|
|
21
|
-
function _fromPackageJson(cwd = process.cwd()) {
|
|
22
|
-
do {
|
|
23
|
-
const packageJsonPath = path.join(cwd, 'node_modules/@angular/cli/package.json');
|
|
24
|
-
if (fs.existsSync(packageJsonPath)) {
|
|
25
|
-
const content = fs.readFileSync(packageJsonPath, 'utf-8');
|
|
26
|
-
if (content) {
|
|
27
|
-
const { version } = JSON.parse(content);
|
|
28
|
-
if (version) {
|
|
29
|
-
return new semver_1.SemVer(version);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
// Check the parent.
|
|
34
|
-
cwd = path.dirname(cwd);
|
|
35
|
-
} while (cwd != path.dirname(cwd));
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
18
|
+
const cli_1 = require("./cli");
|
|
38
19
|
// Check if we need to profile this CLI run.
|
|
39
20
|
if (process.env['NG_CLI_PROFILING']) {
|
|
40
21
|
let profiler;
|
|
@@ -60,6 +41,7 @@ if (process.env['NG_CLI_PROFILING']) {
|
|
|
60
41
|
process.on('uncaughtException', () => exitHandler({ exit: true }));
|
|
61
42
|
}
|
|
62
43
|
(async () => {
|
|
44
|
+
var _a;
|
|
63
45
|
/**
|
|
64
46
|
* Disable Browserslist old data warning as otherwise with every release we'd need to update this dependency
|
|
65
47
|
* which is cumbersome considering we pin versions and the warning is not user actionable.
|
|
@@ -80,43 +62,50 @@ if (process.env['NG_CLI_PROFILING']) {
|
|
|
80
62
|
}
|
|
81
63
|
let cli;
|
|
82
64
|
try {
|
|
65
|
+
// No error implies a projectLocalCli, which will load whatever
|
|
66
|
+
// version of ng-cli you have installed in a local package.json
|
|
83
67
|
const projectLocalCli = require.resolve('@angular/cli', { paths: [process.cwd()] });
|
|
84
|
-
|
|
85
|
-
const globalVersion = new semver_1.SemVer(
|
|
86
|
-
|
|
87
|
-
let
|
|
68
|
+
cli = await Promise.resolve().then(() => require(projectLocalCli));
|
|
69
|
+
const globalVersion = new semver_1.SemVer(cli_1.VERSION.full);
|
|
70
|
+
// Older versions might not have the VERSION export
|
|
71
|
+
let localVersion = (_a = cli.VERSION) === null || _a === void 0 ? void 0 : _a.full;
|
|
72
|
+
if (!localVersion) {
|
|
73
|
+
try {
|
|
74
|
+
const localPackageJson = fs.readFileSync(path.join(path.dirname(projectLocalCli), '../../package.json'), 'utf-8');
|
|
75
|
+
localVersion = JSON.parse(localPackageJson).version;
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
// tslint:disable-next-line:no-console
|
|
79
|
+
console.error('Version mismatch check skipped. Unable to retrieve local version: ' + error);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
let isGlobalGreater = false;
|
|
88
83
|
try {
|
|
89
|
-
|
|
90
|
-
shouldWarn = localVersion != null && globalVersion.compare(localVersion) > 0;
|
|
84
|
+
isGlobalGreater = !!localVersion && globalVersion.compare(localVersion) > 0;
|
|
91
85
|
}
|
|
92
|
-
catch (
|
|
93
|
-
// tslint:disable-next-line
|
|
94
|
-
console.error(
|
|
95
|
-
shouldWarn = true;
|
|
86
|
+
catch (error) {
|
|
87
|
+
// tslint:disable-next-line:no-console
|
|
88
|
+
console.error('Version mismatch check skipped. Unable to compare local version: ' + error);
|
|
96
89
|
}
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
// Don't show warning colorised on `ng completion`
|
|
105
|
-
if (process.argv[2] !== 'completion') {
|
|
106
|
-
// tslint:disable-next-line no-console
|
|
107
|
-
console.error(warning);
|
|
90
|
+
if (isGlobalGreater) {
|
|
91
|
+
// If using the update command and the global version is greater, use the newer update command
|
|
92
|
+
// This allows improvements in update to be used in older versions that do not have bootstrapping
|
|
93
|
+
if (process.argv[2] === 'update' &&
|
|
94
|
+
cli.VERSION &&
|
|
95
|
+
cli.VERSION.major - globalVersion.major <= 1) {
|
|
96
|
+
cli = await Promise.resolve().then(() => require('./cli'));
|
|
108
97
|
}
|
|
109
|
-
else {
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
|
|
98
|
+
else if (await config_1.isWarningEnabled('versionMismatch')) {
|
|
99
|
+
// Otherwise, use local version and warn if global is newer than local
|
|
100
|
+
const warning = `Your global Angular CLI version (${globalVersion}) is greater than your local ` +
|
|
101
|
+
`version (${localVersion}). The local Angular CLI version is used.\n\n` +
|
|
102
|
+
'To disable this warning use "ng config -g cli.warnings.versionMismatch false".';
|
|
103
|
+
// tslint:disable-next-line:no-console
|
|
104
|
+
console.error(color_1.colors.yellow(warning));
|
|
113
105
|
}
|
|
114
106
|
}
|
|
115
|
-
// No error implies a projectLocalCli, which will load whatever
|
|
116
|
-
// version of ng-cli you have installed in a local package.json
|
|
117
|
-
cli = await Promise.resolve().then(() => require(projectLocalCli));
|
|
118
107
|
}
|
|
119
|
-
catch (
|
|
108
|
+
catch (_b) {
|
|
120
109
|
// If there is an error, resolve could not find the ng-cli
|
|
121
110
|
// library from a package.json. Instead, include it from a relative
|
|
122
111
|
// path to this script file (which is likely a globally installed
|
|
@@ -127,26 +116,19 @@ if (process.env['NG_CLI_PROFILING']) {
|
|
|
127
116
|
cli = cli['default'];
|
|
128
117
|
}
|
|
129
118
|
return cli;
|
|
130
|
-
})()
|
|
131
|
-
|
|
132
|
-
let standardInput;
|
|
133
|
-
try {
|
|
134
|
-
standardInput = process.stdin;
|
|
135
|
-
}
|
|
136
|
-
catch (e) {
|
|
137
|
-
process.stdin = new stream_1.Duplex();
|
|
138
|
-
standardInput = process.stdin;
|
|
139
|
-
}
|
|
119
|
+
})()
|
|
120
|
+
.then((cli) => {
|
|
140
121
|
return cli({
|
|
141
122
|
cliArgs: process.argv.slice(2),
|
|
142
|
-
inputStream:
|
|
123
|
+
inputStream: process.stdin,
|
|
143
124
|
outputStream: process.stdout,
|
|
144
125
|
});
|
|
145
|
-
})
|
|
126
|
+
})
|
|
127
|
+
.then((exitCode) => {
|
|
146
128
|
process.exit(exitCode);
|
|
147
129
|
})
|
|
148
130
|
.catch((err) => {
|
|
149
|
-
// tslint:disable-next-line
|
|
131
|
+
// tslint:disable-next-line:no-console
|
|
150
132
|
console.error('Unknown error: ' + err.toString());
|
|
151
133
|
process.exit(127);
|
|
152
134
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export declare class Version {
|
|
9
|
+
readonly full: string;
|
|
10
|
+
readonly major: string;
|
|
11
|
+
readonly minor: string;
|
|
12
|
+
readonly patch: string;
|
|
13
|
+
constructor(full: string);
|
|
14
|
+
}
|
|
15
|
+
export declare const VERSION: Version;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.VERSION = exports.Version = void 0;
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
|
+
const path_1 = require("path");
|
|
13
|
+
// Same structure as used in framework packages
|
|
14
|
+
class Version {
|
|
15
|
+
constructor(full) {
|
|
16
|
+
this.full = full;
|
|
17
|
+
this.major = full.split('.')[0];
|
|
18
|
+
this.minor = full.split('.')[1];
|
|
19
|
+
this.patch = full.split('.').slice(2).join('.');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.Version = Version;
|
|
23
|
+
// TODO: Convert this to use build-time version stamping once implemented in the build system
|
|
24
|
+
exports.VERSION = new Version(JSON.parse(fs_1.readFileSync(path_1.resolve(__dirname, '../package.json'), 'utf-8')).version);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "10.2.
|
|
3
|
+
"version": "10.2.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.1002.
|
|
32
|
-
"@angular-devkit/core": "10.2.
|
|
33
|
-
"@angular-devkit/schematics": "10.2.
|
|
34
|
-
"@schematics/angular": "10.2.
|
|
35
|
-
"@schematics/update": "0.1002.
|
|
31
|
+
"@angular-devkit/architect": "0.1002.4",
|
|
32
|
+
"@angular-devkit/core": "10.2.4",
|
|
33
|
+
"@angular-devkit/schematics": "10.2.4",
|
|
34
|
+
"@schematics/angular": "10.2.4",
|
|
35
|
+
"@schematics/update": "0.1002.4",
|
|
36
36
|
"@yarnpkg/lockfile": "1.1.0",
|
|
37
37
|
"ansi-colors": "4.1.1",
|
|
38
38
|
"debug": "4.1.1",
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"ng-update": {
|
|
53
53
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
54
54
|
"packageGroup": {
|
|
55
|
-
"@angular/cli": "10.2.
|
|
56
|
-
"@angular-devkit/build-angular": "0.1002.
|
|
57
|
-
"@angular-devkit/build-ng-packagr": "0.1002.
|
|
58
|
-
"@angular-devkit/build-webpack": "0.1002.
|
|
59
|
-
"@angular-devkit/core": "10.2.
|
|
60
|
-
"@angular-devkit/schematics": "10.2.
|
|
55
|
+
"@angular/cli": "10.2.4",
|
|
56
|
+
"@angular-devkit/build-angular": "0.1002.4",
|
|
57
|
+
"@angular-devkit/build-ng-packagr": "0.1002.4",
|
|
58
|
+
"@angular-devkit/build-webpack": "0.1002.4",
|
|
59
|
+
"@angular-devkit/core": "10.2.4",
|
|
60
|
+
"@angular-devkit/schematics": "10.2.4"
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|