@angular/cli 12.0.0-rc.0 → 12.0.0
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/README.md +34 -30
- package/bin/ng +3 -3
- package/bin/postinstall/analytics-prompt.js +1 -1
- package/commands/add-impl.d.ts +7 -0
- package/commands/add-impl.js +18 -20
- package/commands/add.json +1 -2
- package/commands/add.md +1 -0
- package/commands/analytics-impl.d.ts +8 -1
- package/commands/analytics-impl.js +7 -7
- package/commands/analytics-long.md +8 -7
- package/commands/analytics.json +3 -15
- package/commands/build-impl.d.ts +1 -1
- package/commands/build-impl.js +3 -3
- package/commands/build.json +1 -1
- package/commands/config-impl.d.ts +2 -2
- package/commands/config-impl.js +16 -11
- package/commands/config-long.md +1 -1
- package/commands/config.json +1 -2
- package/commands/definitions.json +3 -5
- package/commands/deploy-impl.d.ts +1 -1
- package/commands/deploy-impl.js +3 -3
- package/commands/deploy-long.md +1 -1
- package/commands/deploy.json +1 -3
- package/commands/doc-impl.d.ts +1 -1
- package/commands/doc-impl.js +2 -2
- package/commands/doc.json +3 -4
- package/commands/e2e-impl.d.ts +1 -1
- package/commands/e2e-impl.js +1 -1
- package/commands/e2e-long.md +1 -1
- package/commands/e2e.json +1 -1
- package/commands/easter-egg-impl.d.ts +1 -1
- package/commands/easter-egg-impl.js +3 -3
- package/commands/easter-egg.json +1 -3
- package/commands/extract-i18n-impl.d.ts +1 -1
- package/commands/extract-i18n-impl.js +5 -4
- package/commands/generate-impl.d.ts +1 -1
- package/commands/generate-impl.js +9 -2
- package/commands/generate.json +2 -3
- package/commands/help-impl.d.ts +1 -1
- package/commands/help-impl.js +3 -3
- package/commands/help-long.md +5 -5
- package/commands/help.json +1 -3
- package/commands/lint-impl.d.ts +1 -1
- package/commands/lint-impl.js +3 -3
- package/commands/lint-long.md +1 -1
- package/commands/lint.json +1 -3
- package/commands/new-impl.d.ts +1 -1
- package/commands/new-impl.js +8 -1
- package/commands/new.json +3 -3
- package/commands/new.md +5 -5
- package/commands/run-impl.d.ts +1 -1
- package/commands/run-impl.js +1 -1
- package/commands/run-long.md +1 -1
- package/commands/run.json +2 -3
- package/commands/serve-impl.d.ts +2 -2
- package/commands/serve-impl.js +4 -4
- package/commands/serve.json +1 -1
- package/commands/test-impl.d.ts +1 -1
- package/commands/test-impl.js +1 -1
- package/commands/test-long.md +1 -1
- package/commands/test.json +1 -1
- package/commands/update-impl.d.ts +9 -2
- package/commands/update-impl.js +29 -23
- package/commands/update.d.ts +2 -1
- package/commands/update.json +1 -1
- package/commands/version-impl.d.ts +8 -0
- package/commands/version-impl.js +19 -6
- package/commands/version.json +2 -4
- package/lib/cli/index.d.ts +7 -0
- package/lib/cli/index.js +14 -16
- package/lib/config/schema.json +20 -12
- package/lib/config/workspace-schema.d.ts +4 -0
- package/lib/init.d.ts +1 -1
- package/lib/init.js +11 -10
- package/models/analytics-collector.d.ts +1 -2
- package/models/analytics-collector.js +7 -8
- package/models/analytics.d.ts +7 -0
- package/models/analytics.js +6 -8
- package/models/architect-command.d.ts +2 -2
- package/models/architect-command.js +10 -11
- package/models/command-runner.d.ts +1 -1
- package/models/command-runner.js +8 -7
- package/models/command.d.ts +3 -4
- package/models/command.js +17 -21
- package/models/error.d.ts +1 -1
- package/models/error.js +1 -1
- package/models/interface.d.ts +2 -2
- package/models/interface.js +7 -0
- package/models/parser.d.ts +1 -2
- package/models/parser.js +12 -15
- package/models/schematic-command.d.ts +1 -1
- package/models/schematic-command.js +48 -49
- package/models/schematic-engine-host.d.ts +1 -1
- package/models/schematic-engine-host.js +4 -4
- package/models/version.d.ts +1 -1
- package/models/version.js +1 -1
- package/package.json +14 -14
- package/src/commands/update/schematic/index.d.ts +7 -0
- package/src/commands/update/schematic/index.js +59 -56
- package/src/commands/update/schematic/npm-package-json.d.ts +1 -1
- package/src/commands/update/schematic/npm-package-json.js +7 -0
- package/src/commands/update/schematic/npm.d.ts +1 -1
- package/src/commands/update/schematic/npm.js +9 -4
- package/src/commands/update/schematic/package-json.d.ts +1 -1
- package/src/commands/update/schematic/package-json.js +1 -7
- package/src/commands/update/schematic/schema.json +2 -8
- package/utilities/color.d.ts +1 -1
- package/utilities/color.js +3 -3
- package/utilities/config.d.ts +1 -1
- package/utilities/config.js +24 -7
- package/utilities/find-up.d.ts +1 -1
- package/utilities/find-up.js +1 -1
- package/utilities/install-package.d.ts +7 -5
- package/utilities/install-package.js +37 -23
- package/utilities/json-file.d.ts +1 -1
- package/utilities/json-file.js +4 -4
- package/utilities/json-schema.d.ts +1 -1
- package/utilities/json-schema.js +30 -27
- package/utilities/log-file.d.ts +1 -1
- package/utilities/log-file.js +1 -1
- package/utilities/package-manager.d.ts +7 -0
- package/utilities/package-manager.js +5 -5
- package/utilities/package-metadata.d.ts +1 -1
- package/utilities/package-metadata.js +8 -1
- package/utilities/package-tree.d.ts +1 -1
- package/utilities/package-tree.js +1 -1
- package/utilities/project.d.ts +7 -0
- package/utilities/project.js +3 -3
- package/utilities/prompt.d.ts +7 -0
- package/utilities/prompt.js +3 -3
- package/utilities/spinner.d.ts +1 -1
- package/utilities/spinner.js +1 -1
- package/utilities/tty.d.ts +1 -1
- package/utilities/tty.js +1 -1
package/commands/update-impl.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UpdateCommand = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.UpdateCommand = void 0;
|
|
11
11
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
12
12
|
const tools_1 = require("@angular-devkit/schematics/tools");
|
|
13
13
|
const child_process_1 = require("child_process");
|
|
@@ -42,10 +42,11 @@ class UpdateCommand extends command_1.Command {
|
|
|
42
42
|
this.allowMissingWorkspace = true;
|
|
43
43
|
this.packageManager = workspace_schema_1.PackageManager.Npm;
|
|
44
44
|
}
|
|
45
|
-
async initialize() {
|
|
45
|
+
async initialize(options) {
|
|
46
46
|
this.packageManager = await package_manager_1.getPackageManager(this.context.root);
|
|
47
47
|
this.workflow = new tools_1.NodeWorkflow(this.context.root, {
|
|
48
48
|
packageManager: this.packageManager,
|
|
49
|
+
packageManagerForce: options.force,
|
|
49
50
|
// __dirname -> favor @schematics/update from this package
|
|
50
51
|
// Otherwise, use packages from the active workspace (migrations)
|
|
51
52
|
resolvePaths: [__dirname, this.context.root],
|
|
@@ -57,7 +58,7 @@ class UpdateCommand extends command_1.Command {
|
|
|
57
58
|
let error = false;
|
|
58
59
|
let logs = [];
|
|
59
60
|
const files = new Set();
|
|
60
|
-
const reporterSubscription = this.workflow.reporter.subscribe(event => {
|
|
61
|
+
const reporterSubscription = this.workflow.reporter.subscribe((event) => {
|
|
61
62
|
// Strip leading slash to prevent confusion.
|
|
62
63
|
const eventPath = event.path.startsWith('/') ? event.path.substr(1) : event.path;
|
|
63
64
|
switch (event.kind) {
|
|
@@ -85,11 +86,11 @@ class UpdateCommand extends command_1.Command {
|
|
|
85
86
|
break;
|
|
86
87
|
}
|
|
87
88
|
});
|
|
88
|
-
const lifecycleSubscription = this.workflow.lifeCycle.subscribe(event => {
|
|
89
|
+
const lifecycleSubscription = this.workflow.lifeCycle.subscribe((event) => {
|
|
89
90
|
if (event.kind == 'end' || event.kind == 'post-tasks-start') {
|
|
90
91
|
if (!error) {
|
|
91
92
|
// Output the logging queue, no error happened.
|
|
92
|
-
logs.forEach(log => this.logger.info(` ${log}`));
|
|
93
|
+
logs.forEach((log) => this.logger.info(` ${log}`));
|
|
93
94
|
logs = [];
|
|
94
95
|
}
|
|
95
96
|
}
|
|
@@ -125,7 +126,7 @@ class UpdateCommand extends command_1.Command {
|
|
|
125
126
|
*/
|
|
126
127
|
async executeMigration(packageName, collectionPath, migrationName, commit) {
|
|
127
128
|
const collection = this.workflow.engine.createCollection(collectionPath);
|
|
128
|
-
const name = collection.listSchematicNames().find(name => name === migrationName);
|
|
129
|
+
const name = collection.listSchematicNames().find((name) => name === migrationName);
|
|
129
130
|
if (!name) {
|
|
130
131
|
this.logger.error(`Cannot find migration '${migrationName}' in '${packageName}'.`);
|
|
131
132
|
return false;
|
|
@@ -162,7 +163,8 @@ class UpdateCommand extends command_1.Command {
|
|
|
162
163
|
async executePackageMigrations(migrations, packageName, commit = false) {
|
|
163
164
|
for (const migration of migrations) {
|
|
164
165
|
const [title, ...description] = migration.description.split('. ');
|
|
165
|
-
this.logger.info(color_1.colors.cyan(color_1.colors.symbols.pointer) +
|
|
166
|
+
this.logger.info(color_1.colors.cyan(color_1.colors.symbols.pointer) +
|
|
167
|
+
' ' +
|
|
166
168
|
color_1.colors.bold(title.endsWith('.') ? title : title + '.'));
|
|
167
169
|
if (description.length) {
|
|
168
170
|
this.logger.info(' ' + description.join('.\n '));
|
|
@@ -188,15 +190,14 @@ class UpdateCommand extends command_1.Command {
|
|
|
188
190
|
}
|
|
189
191
|
return true;
|
|
190
192
|
}
|
|
191
|
-
//
|
|
193
|
+
// eslint-disable-next-line max-lines-per-function
|
|
192
194
|
async run(options) {
|
|
193
195
|
var _a, _b;
|
|
194
196
|
await package_manager_1.ensureCompatibleNpm(this.context.root);
|
|
195
197
|
// Check if the current installed CLI version is older than the latest version.
|
|
196
|
-
if (!disableVersionCheck && await this.checkCLILatestVersion(options.verbose, options.next)) {
|
|
197
|
-
this.logger.warn(`The installed local Angular CLI version is older than the latest ${options.next ? 'pre-release' : 'stable'} version.\n` +
|
|
198
|
-
|
|
199
|
-
return install_package_1.runTempPackageBin(`@angular/cli@${options.next ? 'next' : 'latest'}`, this.logger, this.packageManager, process.argv.slice(2));
|
|
198
|
+
if (!disableVersionCheck && (await this.checkCLILatestVersion(options.verbose, options.next))) {
|
|
199
|
+
this.logger.warn(`The installed local Angular CLI version is older than the latest ${options.next ? 'pre-release' : 'stable'} version.\n` + 'Installing a temporary version to perform the update.');
|
|
200
|
+
return install_package_1.runTempPackageBin(`@angular/cli@${options.next ? 'next' : 'latest'}`, this.packageManager, process.argv.slice(2));
|
|
200
201
|
}
|
|
201
202
|
const logVerbose = (message) => {
|
|
202
203
|
if (options.verbose) {
|
|
@@ -223,7 +224,7 @@ class UpdateCommand extends command_1.Command {
|
|
|
223
224
|
this.logger.error(`Package '${request}' is not a registry package identifer.`);
|
|
224
225
|
return 1;
|
|
225
226
|
}
|
|
226
|
-
if (packages.some(v => v.name === packageIdentifier.name)) {
|
|
227
|
+
if (packages.some((v) => v.name === packageIdentifier.name)) {
|
|
227
228
|
this.logger.error(`Duplicate package '${packageIdentifier.name}' specified.`);
|
|
228
229
|
return 1;
|
|
229
230
|
}
|
|
@@ -360,10 +361,10 @@ class UpdateCommand extends command_1.Command {
|
|
|
360
361
|
success = await this.executeMigrations(packageName, migrations, from, options.to || packageNode.version, options.createCommits);
|
|
361
362
|
}
|
|
362
363
|
if (success) {
|
|
363
|
-
if (packageName === '@angular/core'
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
if (packageName === '@angular/core' &&
|
|
365
|
+
options.from &&
|
|
366
|
+
+options.from.split('.')[0] < 9 &&
|
|
367
|
+
(options.to || packageNode.version).split('.')[0] === '9') {
|
|
367
368
|
this.logger.info(NG_VERSION_9_POST_MSG);
|
|
368
369
|
}
|
|
369
370
|
return 0;
|
|
@@ -481,7 +482,7 @@ class UpdateCommand extends command_1.Command {
|
|
|
481
482
|
}
|
|
482
483
|
}
|
|
483
484
|
// This is a temporary workaround to allow data to be passed back from the update schematic
|
|
484
|
-
//
|
|
485
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
485
486
|
const migrations = global.externalMigrations;
|
|
486
487
|
if (success && migrations) {
|
|
487
488
|
for (const migration of migrations) {
|
|
@@ -545,7 +546,9 @@ class UpdateCommand extends command_1.Command {
|
|
|
545
546
|
return 0;
|
|
546
547
|
}
|
|
547
548
|
}
|
|
548
|
-
if (migrations.some(m => m.package === '@angular/core' &&
|
|
549
|
+
if (migrations.some((m) => m.package === '@angular/core' &&
|
|
550
|
+
m.to.split('.')[0] === '9' &&
|
|
551
|
+
+m.from.split('.')[0] < 9)) {
|
|
549
552
|
this.logger.info(NG_VERSION_9_POST_MSG);
|
|
550
553
|
}
|
|
551
554
|
}
|
|
@@ -592,7 +595,10 @@ class UpdateCommand extends command_1.Command {
|
|
|
592
595
|
}
|
|
593
596
|
checkCleanGit() {
|
|
594
597
|
try {
|
|
595
|
-
const topLevel = child_process_1.execSync('git rev-parse --show-toplevel', {
|
|
598
|
+
const topLevel = child_process_1.execSync('git rev-parse --show-toplevel', {
|
|
599
|
+
encoding: 'utf8',
|
|
600
|
+
stdio: 'pipe',
|
|
601
|
+
});
|
|
596
602
|
const result = child_process_1.execSync('git status --porcelain', { encoding: 'utf8', stdio: 'pipe' });
|
|
597
603
|
if (result.trim().length === 0) {
|
|
598
604
|
return true;
|
|
@@ -611,7 +617,7 @@ class UpdateCommand extends command_1.Command {
|
|
|
611
617
|
/**
|
|
612
618
|
* Checks if the current installed CLI version is older than the latest version.
|
|
613
619
|
* @returns `true` when the installed version is older.
|
|
614
|
-
|
|
620
|
+
*/
|
|
615
621
|
async checkCLILatestVersion(verbose = false, next = false) {
|
|
616
622
|
const { version: installedCLIVersion } = require('../package.json');
|
|
617
623
|
const LatestCLIManifest = await package_metadata_1.fetchPackageManifest(`@angular/cli@${next ? 'next' : 'latest'}`, this.logger, {
|
package/commands/update.d.ts
CHANGED
|
@@ -15,7 +15,8 @@ export interface Schema {
|
|
|
15
15
|
*/
|
|
16
16
|
createCommits?: boolean;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Ignore peer dependency version mismatches. Passes the `--force` flag to the package
|
|
19
|
+
* manager when installing packages.
|
|
19
20
|
*/
|
|
20
21
|
force?: boolean;
|
|
21
22
|
/**
|
package/commands/update.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"force": {
|
|
31
|
-
"description": "
|
|
31
|
+
"description": "Ignore peer dependency version mismatches. Passes the `--force` flag to the package manager when installing packages.",
|
|
32
32
|
"default": false,
|
|
33
33
|
"type": "boolean"
|
|
34
34
|
},
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC 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
|
+
*/
|
|
1
8
|
import { Command } from '../models/command';
|
|
2
9
|
import { Schema as VersionCommandSchema } from './version';
|
|
3
10
|
export declare class VersionCommand extends Command<VersionCommandSchema> {
|
|
4
11
|
static aliases: string[];
|
|
5
12
|
run(): Promise<void>;
|
|
6
13
|
private getVersion;
|
|
14
|
+
private getPackageManager;
|
|
7
15
|
}
|
package/commands/version-impl.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VersionCommand = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.VersionCommand = void 0;
|
|
11
|
+
const child_process_1 = require("child_process");
|
|
11
12
|
const path = require("path");
|
|
12
13
|
const command_1 = require("../models/command");
|
|
13
14
|
const color_1 = require("../utilities/color");
|
|
15
|
+
const package_manager_1 = require("../utilities/package-manager");
|
|
14
16
|
class VersionCommand extends command_1.Command {
|
|
15
17
|
async run() {
|
|
16
18
|
const cliPackage = require('../package.json');
|
|
@@ -38,7 +40,7 @@ class VersionCommand extends command_1.Command {
|
|
|
38
40
|
...Object.keys((workspacePackage === null || workspacePackage === void 0 ? void 0 : workspacePackage.devDependencies) || {}),
|
|
39
41
|
];
|
|
40
42
|
const versions = packageNames
|
|
41
|
-
.filter(x => patterns.some(p => p.test(x)))
|
|
43
|
+
.filter((x) => patterns.some((p) => p.test(x)))
|
|
42
44
|
.reduce((acc, name) => {
|
|
43
45
|
if (name in acc) {
|
|
44
46
|
return acc;
|
|
@@ -74,12 +76,13 @@ class VersionCommand extends command_1.Command {
|
|
|
74
76
|
|___/
|
|
75
77
|
`
|
|
76
78
|
.split('\n')
|
|
77
|
-
.map(x => color_1.colors.red(x))
|
|
79
|
+
.map((x) => color_1.colors.red(x))
|
|
78
80
|
.join('\n');
|
|
79
81
|
this.logger.info(asciiArt);
|
|
80
82
|
this.logger.info(`
|
|
81
83
|
Angular CLI: ${ngCliVersion}
|
|
82
84
|
Node: ${process.versions.node}
|
|
85
|
+
Package Manager: ${await this.getPackageManager()}
|
|
83
86
|
OS: ${process.platform} ${process.arch}
|
|
84
87
|
|
|
85
88
|
Angular: ${angularCoreVersion}
|
|
@@ -103,7 +106,7 @@ class VersionCommand extends command_1.Command {
|
|
|
103
106
|
Package${namePad.slice(7)}Version
|
|
104
107
|
-------${namePad.replace(/ /g, '-')}------------------
|
|
105
108
|
${Object.keys(versions)
|
|
106
|
-
.map(module => `${module}${namePad.slice(module.length)}${versions[module]}`)
|
|
109
|
+
.map((module) => `${module}${namePad.slice(module.length)}${versions[module]}`)
|
|
107
110
|
.sort()
|
|
108
111
|
.join('\n')}
|
|
109
112
|
`.replace(/^ {6}/gm, ''));
|
|
@@ -134,6 +137,16 @@ class VersionCommand extends command_1.Command {
|
|
|
134
137
|
}
|
|
135
138
|
return version || '<error>';
|
|
136
139
|
}
|
|
140
|
+
async getPackageManager() {
|
|
141
|
+
try {
|
|
142
|
+
const manager = await package_manager_1.getPackageManager(this.context.root);
|
|
143
|
+
const version = child_process_1.execSync(`${manager} --version`, { encoding: 'utf8', stdio: 'pipe' }).trim();
|
|
144
|
+
return `${manager} ${version}`;
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
return '<error>';
|
|
148
|
+
}
|
|
149
|
+
}
|
|
137
150
|
}
|
|
138
151
|
exports.VersionCommand = VersionCommand;
|
|
139
152
|
VersionCommand.aliases = ['v'];
|
package/commands/version.json
CHANGED
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
"description": "Outputs Angular CLI version.",
|
|
5
5
|
"$longDescription": "",
|
|
6
6
|
|
|
7
|
-
"$aliases": [
|
|
7
|
+
"$aliases": ["v"],
|
|
8
8
|
"$scope": "all",
|
|
9
9
|
"$impl": "./version-impl#VersionCommand",
|
|
10
10
|
|
|
11
11
|
"type": "object",
|
|
12
|
-
"allOf": [
|
|
13
|
-
{ "$ref": "./definitions.json#/definitions/base" }
|
|
14
|
-
]
|
|
12
|
+
"allOf": [{ "$ref": "./definitions.json#/definitions/base" }]
|
|
15
13
|
}
|
package/lib/cli/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC 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
|
+
*/
|
|
1
8
|
export { VERSION, Version } from '../../models/version';
|
|
2
9
|
export default function (options: {
|
|
3
10
|
testing?: boolean;
|
package/lib/cli/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Version = exports.VERSION = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.Version = exports.VERSION = void 0;
|
|
11
11
|
const node_1 = require("@angular-devkit/core/node");
|
|
12
12
|
const util_1 = require("util");
|
|
13
13
|
const command_runner_1 = require("../../models/command-runner");
|
|
@@ -19,25 +19,23 @@ var version_1 = require("../../models/version");
|
|
|
19
19
|
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
|
|
20
20
|
Object.defineProperty(exports, "Version", { enumerable: true, get: function () { return version_1.Version; } });
|
|
21
21
|
const debugEnv = process.env['NG_DEBUG'];
|
|
22
|
-
const isDebug = debugEnv !== undefined &&
|
|
23
|
-
|
|
24
|
-
debugEnv.toLowerCase() !== 'false';
|
|
25
|
-
// tslint:disable: no-console
|
|
22
|
+
const isDebug = debugEnv !== undefined && debugEnv !== '0' && debugEnv.toLowerCase() !== 'false';
|
|
23
|
+
/* eslint-disable no-console */
|
|
26
24
|
async function default_1(options) {
|
|
27
25
|
// This node version check ensures that the requirements of the project instance of the CLI are met
|
|
28
|
-
const version = process.versions.node.split('.').map(part => Number(part));
|
|
29
|
-
if (version[0] <
|
|
26
|
+
const version = process.versions.node.split('.').map((part) => Number(part));
|
|
27
|
+
if (version[0] < 12 || (version[0] === 12 && version[1] < 14)) {
|
|
30
28
|
process.stderr.write(`Node.js version ${process.version} detected.\n` +
|
|
31
|
-
'The Angular CLI requires a minimum
|
|
29
|
+
'The Angular CLI requires a minimum v12.14.\n\n' +
|
|
32
30
|
'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n');
|
|
33
31
|
return 3;
|
|
34
32
|
}
|
|
35
33
|
const logger = node_1.createConsoleLogger(isDebug, process.stdout, process.stderr, {
|
|
36
|
-
info: s => (color_1.colors.enabled ? s : color_1.removeColor(s)),
|
|
37
|
-
debug: s => (color_1.colors.enabled ? s : color_1.removeColor(s)),
|
|
38
|
-
warn: s => (color_1.colors.enabled ? color_1.colors.bold.yellow(s) : color_1.removeColor(s)),
|
|
39
|
-
error: s => (color_1.colors.enabled ? color_1.colors.bold.red(s) : color_1.removeColor(s)),
|
|
40
|
-
fatal: s => (color_1.colors.enabled ? color_1.colors.bold.red(s) : color_1.removeColor(s)),
|
|
34
|
+
info: (s) => (color_1.colors.enabled ? s : color_1.removeColor(s)),
|
|
35
|
+
debug: (s) => (color_1.colors.enabled ? s : color_1.removeColor(s)),
|
|
36
|
+
warn: (s) => (color_1.colors.enabled ? color_1.colors.bold.yellow(s) : color_1.removeColor(s)),
|
|
37
|
+
error: (s) => (color_1.colors.enabled ? color_1.colors.bold.red(s) : color_1.removeColor(s)),
|
|
38
|
+
fatal: (s) => (color_1.colors.enabled ? color_1.colors.bold.red(s) : color_1.removeColor(s)),
|
|
41
39
|
});
|
|
42
40
|
// Redirect console to logger
|
|
43
41
|
console.info = console.log = function (...args) {
|
|
@@ -102,7 +100,7 @@ async function default_1(options) {
|
|
|
102
100
|
logger.fatal('An unexpected error occurred: ' + JSON.stringify(err));
|
|
103
101
|
}
|
|
104
102
|
if (options.testing) {
|
|
105
|
-
//
|
|
103
|
+
// eslint-disable-next-line no-debugger
|
|
106
104
|
debugger;
|
|
107
105
|
throw err;
|
|
108
106
|
}
|
package/lib/config/schema.json
CHANGED
|
@@ -351,12 +351,14 @@
|
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
},
|
|
354
|
+
"additionalProperties": false,
|
|
354
355
|
"required": [
|
|
355
356
|
"builder"
|
|
356
357
|
]
|
|
357
358
|
},
|
|
358
359
|
{
|
|
359
360
|
"type": "object",
|
|
361
|
+
"additionalProperties": false,
|
|
360
362
|
"properties": {
|
|
361
363
|
"builder": {
|
|
362
364
|
"const": "@angular-devkit/build-angular:app-shell"
|
|
@@ -378,6 +380,7 @@
|
|
|
378
380
|
},
|
|
379
381
|
{
|
|
380
382
|
"type": "object",
|
|
383
|
+
"additionalProperties": false,
|
|
381
384
|
"properties": {
|
|
382
385
|
"builder": {
|
|
383
386
|
"const": "@angular-devkit/build-angular:browser"
|
|
@@ -399,6 +402,7 @@
|
|
|
399
402
|
},
|
|
400
403
|
{
|
|
401
404
|
"type": "object",
|
|
405
|
+
"additionalProperties": false,
|
|
402
406
|
"properties": {
|
|
403
407
|
"builder": {
|
|
404
408
|
"const": "@angular-devkit/build-angular:dev-server"
|
|
@@ -420,6 +424,7 @@
|
|
|
420
424
|
},
|
|
421
425
|
{
|
|
422
426
|
"type": "object",
|
|
427
|
+
"additionalProperties": false,
|
|
423
428
|
"properties": {
|
|
424
429
|
"builder": {
|
|
425
430
|
"const": "@angular-devkit/build-angular:extract-i18n"
|
|
@@ -441,6 +446,7 @@
|
|
|
441
446
|
},
|
|
442
447
|
{
|
|
443
448
|
"type": "object",
|
|
449
|
+
"additionalProperties": false,
|
|
444
450
|
"properties": {
|
|
445
451
|
"builder": {
|
|
446
452
|
"const": "@angular-devkit/build-angular:karma"
|
|
@@ -462,6 +468,7 @@
|
|
|
462
468
|
},
|
|
463
469
|
{
|
|
464
470
|
"type": "object",
|
|
471
|
+
"additionalProperties": false,
|
|
465
472
|
"properties": {
|
|
466
473
|
"builder": {
|
|
467
474
|
"const": "@angular-devkit/build-angular:protractor"
|
|
@@ -483,6 +490,7 @@
|
|
|
483
490
|
},
|
|
484
491
|
{
|
|
485
492
|
"type": "object",
|
|
493
|
+
"additionalProperties": false,
|
|
486
494
|
"properties": {
|
|
487
495
|
"builder": {
|
|
488
496
|
"const": "@angular-devkit/build-angular:server"
|
|
@@ -504,6 +512,7 @@
|
|
|
504
512
|
},
|
|
505
513
|
{
|
|
506
514
|
"type": "object",
|
|
515
|
+
"additionalProperties": false,
|
|
507
516
|
"properties": {
|
|
508
517
|
"builder": {
|
|
509
518
|
"const": "@angular-devkit/build-angular:tslint"
|
|
@@ -525,10 +534,15 @@
|
|
|
525
534
|
},
|
|
526
535
|
{
|
|
527
536
|
"type": "object",
|
|
537
|
+
"additionalProperties": false,
|
|
528
538
|
"properties": {
|
|
529
539
|
"builder": {
|
|
530
540
|
"const": "@angular-devkit/build-angular:ng-packagr"
|
|
531
541
|
},
|
|
542
|
+
"defaultConfiguration": {
|
|
543
|
+
"type": "string",
|
|
544
|
+
"description": "A default named configuration to use when a target configuration is not provided."
|
|
545
|
+
},
|
|
532
546
|
"options": {
|
|
533
547
|
"$ref": "#/definitions/AngularDevkitBuildAngularNgPackagrSchema"
|
|
534
548
|
},
|
|
@@ -1003,6 +1017,10 @@
|
|
|
1003
1017
|
"$source": "projectName"
|
|
1004
1018
|
}
|
|
1005
1019
|
},
|
|
1020
|
+
"type": {
|
|
1021
|
+
"type": "string",
|
|
1022
|
+
"description": "Adds a developer-defined type to the filename, in the format \"name.type.ts\"."
|
|
1023
|
+
},
|
|
1006
1024
|
"lintFix": {
|
|
1007
1025
|
"type": "boolean",
|
|
1008
1026
|
"description": "Apply lint fixes after generating the enum.",
|
|
@@ -1906,7 +1924,7 @@
|
|
|
1906
1924
|
"type": "boolean",
|
|
1907
1925
|
"description": "Show circular dependency warnings on builds.",
|
|
1908
1926
|
"default": false,
|
|
1909
|
-
"x-deprecated": "The recommended method to detect circular dependencies in project code is to use
|
|
1927
|
+
"x-deprecated": "The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tooling."
|
|
1910
1928
|
},
|
|
1911
1929
|
"buildOptimizer": {
|
|
1912
1930
|
"type": "boolean",
|
|
@@ -1963,11 +1981,6 @@
|
|
|
1963
1981
|
"description": "Generates a 'stats.json' file which can be analyzed using tools such as 'webpack-bundle-analyzer'.",
|
|
1964
1982
|
"default": false
|
|
1965
1983
|
},
|
|
1966
|
-
"forkTypeChecker": {
|
|
1967
|
-
"type": "boolean",
|
|
1968
|
-
"description": "Run the TypeScript type checker in a forked process.",
|
|
1969
|
-
"default": true
|
|
1970
|
-
},
|
|
1971
1984
|
"budgets": {
|
|
1972
1985
|
"description": "Budget thresholds to ensure parts of your application stay within boundaries which you set.",
|
|
1973
1986
|
"type": "array",
|
|
@@ -2892,7 +2905,7 @@
|
|
|
2892
2905
|
"type": "boolean",
|
|
2893
2906
|
"description": "Show circular dependency warnings on builds.",
|
|
2894
2907
|
"default": false,
|
|
2895
|
-
"x-deprecated": "The recommended method to detect circular dependencies in project code is to use
|
|
2908
|
+
"x-deprecated": "The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tooling."
|
|
2896
2909
|
},
|
|
2897
2910
|
"namedChunks": {
|
|
2898
2911
|
"type": "boolean",
|
|
@@ -2928,11 +2941,6 @@
|
|
|
2928
2941
|
"description": "Generates a 'stats.json' file which can be analyzed using tools such as 'webpack-bundle-analyzer'.",
|
|
2929
2942
|
"default": false
|
|
2930
2943
|
},
|
|
2931
|
-
"forkTypeChecker": {
|
|
2932
|
-
"type": "boolean",
|
|
2933
|
-
"description": "Run the TypeScript type checker in a forked process.",
|
|
2934
|
-
"default": true
|
|
2935
|
-
},
|
|
2936
2944
|
"watch": {
|
|
2937
2945
|
"type": "boolean",
|
|
2938
2946
|
"description": "Run build when files change.",
|
|
@@ -372,6 +372,10 @@ export interface AngularEnumOptionsSchema {
|
|
|
372
372
|
* project for the workspace.
|
|
373
373
|
*/
|
|
374
374
|
project?: string;
|
|
375
|
+
/**
|
|
376
|
+
* Adds a developer-defined type to the filename, in the format "name.type.ts".
|
|
377
|
+
*/
|
|
378
|
+
type?: string;
|
|
375
379
|
}
|
|
376
380
|
/**
|
|
377
381
|
* Generates a new, generic route guard definition in the given or default project.
|
package/lib/init.d.ts
CHANGED
package/lib/init.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
/**
|
|
4
3
|
* @license
|
|
5
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6
5
|
*
|
|
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
|
-
// tslint:disable-next-line:ordered-imports import-groups
|
|
13
12
|
const fs = require("fs");
|
|
14
13
|
const path = require("path");
|
|
15
14
|
const semver_1 = require("semver");
|
|
@@ -19,7 +18,7 @@ const config_1 = require("../utilities/config");
|
|
|
19
18
|
if (process.env['NG_CLI_PROFILING']) {
|
|
20
19
|
let profiler;
|
|
21
20
|
try {
|
|
22
|
-
profiler = require('v8-profiler-node8'); //
|
|
21
|
+
profiler = require('v8-profiler-node8'); // eslint-disable-line import/no-extraneous-dependencies
|
|
23
22
|
}
|
|
24
23
|
catch (err) {
|
|
25
24
|
throw new Error(`Could not require 'v8-profiler-node8'. You must install it separetely with ` +
|
|
@@ -74,7 +73,7 @@ if (process.env['NG_CLI_PROFILING']) {
|
|
|
74
73
|
.version;
|
|
75
74
|
}
|
|
76
75
|
catch (error) {
|
|
77
|
-
//
|
|
76
|
+
// eslint-disable-next-line no-console
|
|
78
77
|
console.error('Version mismatch check skipped. Unable to retrieve local version: ' + error);
|
|
79
78
|
}
|
|
80
79
|
}
|
|
@@ -83,7 +82,7 @@ if (process.env['NG_CLI_PROFILING']) {
|
|
|
83
82
|
isGlobalGreater = !!localVersion && globalVersion.compare(localVersion) > 0;
|
|
84
83
|
}
|
|
85
84
|
catch (error) {
|
|
86
|
-
//
|
|
85
|
+
// eslint-disable-next-line no-console
|
|
87
86
|
console.error('Version mismatch check skipped. Unable to compare local version: ' + error);
|
|
88
87
|
}
|
|
89
88
|
if (isGlobalGreater) {
|
|
@@ -97,7 +96,7 @@ if (process.env['NG_CLI_PROFILING']) {
|
|
|
97
96
|
const warning = `Your global Angular CLI version (${globalVersion}) is greater than your local ` +
|
|
98
97
|
`version (${localVersion}). The local Angular CLI version is used.\n\n` +
|
|
99
98
|
'To disable this warning use "ng config -g cli.warnings.versionMismatch false".';
|
|
100
|
-
//
|
|
99
|
+
// eslint-disable-next-line no-console
|
|
101
100
|
console.error(color_1.colors.yellow(warning));
|
|
102
101
|
}
|
|
103
102
|
}
|
|
@@ -113,17 +112,19 @@ if (process.env['NG_CLI_PROFILING']) {
|
|
|
113
112
|
cli = cli['default'];
|
|
114
113
|
}
|
|
115
114
|
return cli;
|
|
116
|
-
})()
|
|
115
|
+
})()
|
|
116
|
+
.then((cli) => {
|
|
117
117
|
return cli({
|
|
118
118
|
cliArgs: process.argv.slice(2),
|
|
119
119
|
inputStream: process.stdin,
|
|
120
120
|
outputStream: process.stdout,
|
|
121
121
|
});
|
|
122
|
-
})
|
|
122
|
+
})
|
|
123
|
+
.then((exitCode) => {
|
|
123
124
|
process.exit(exitCode);
|
|
124
125
|
})
|
|
125
126
|
.catch((err) => {
|
|
126
|
-
//
|
|
127
|
+
// eslint-disable-next-line no-console
|
|
127
128
|
console.error('Unknown error: ' + err.toString());
|
|
128
129
|
process.exit(127);
|
|
129
130
|
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright Google
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*
|
|
8
7
|
*/
|
|
9
8
|
import { analytics } from '@angular-devkit/core';
|
|
10
9
|
/**
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AnalyticsCollector = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
|
-
*
|
|
11
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AnalyticsCollector = void 0;
|
|
12
11
|
const core_1 = require("@angular-devkit/core");
|
|
13
12
|
const child_process_1 = require("child_process");
|
|
14
13
|
const debug = require("debug");
|
|
@@ -100,14 +99,14 @@ class AnalyticsCollector {
|
|
|
100
99
|
host: 'www.google-analytics.com',
|
|
101
100
|
method: 'POST',
|
|
102
101
|
path: data.length > 1 ? '/batch' : '/collect',
|
|
103
|
-
}, response => {
|
|
102
|
+
}, (response) => {
|
|
104
103
|
if (response.statusCode !== 200) {
|
|
105
104
|
reject(new Error(`Analytics reporting failed with status code: ${response.statusCode}.`));
|
|
106
105
|
return;
|
|
107
106
|
}
|
|
108
107
|
});
|
|
109
108
|
request.on('error', reject);
|
|
110
|
-
const queryParameters = data.map(p => querystring.stringify(p)).join('\n');
|
|
109
|
+
const queryParameters = data.map((p) => querystring.stringify(p)).join('\n');
|
|
111
110
|
request.write(queryParameters);
|
|
112
111
|
request.end(resolve);
|
|
113
112
|
});
|
|
@@ -119,8 +118,8 @@ class AnalyticsCollector {
|
|
|
119
118
|
customVariables(options) {
|
|
120
119
|
const additionals = {};
|
|
121
120
|
const { dimensions, metrics } = options;
|
|
122
|
-
dimensions === null || dimensions === void 0 ? void 0 : dimensions.forEach((v, i) => additionals[`cd${i}`] = v);
|
|
123
|
-
metrics === null || metrics === void 0 ? void 0 : metrics.forEach((v, i) => additionals[`cm${i}`] = v);
|
|
121
|
+
dimensions === null || dimensions === void 0 ? void 0 : dimensions.forEach((v, i) => (additionals[`cd${i}`] = v));
|
|
122
|
+
metrics === null || metrics === void 0 ? void 0 : metrics.forEach((v, i) => (additionals[`cm${i}`] = v));
|
|
124
123
|
return additionals;
|
|
125
124
|
}
|
|
126
125
|
}
|
package/models/analytics.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC 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
|
+
*/
|
|
1
8
|
import { AnalyticsCollector } from './analytics-collector';
|
|
2
9
|
export declare const AnalyticsProperties: {
|
|
3
10
|
AngularCliProd: string;
|