@angular/cli 8.0.0-rc.4 → 8.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/commands/analytics.d.ts +1 -1
- package/commands/analytics.json +1 -1
- package/commands/build.d.ts +1 -1
- package/commands/config-impl.js +6 -3
- package/commands/definitions.json +1 -1
- package/commands/e2e.d.ts +1 -1
- package/commands/generate-impl.js +6 -6
- package/commands/new-impl.d.ts +1 -0
- package/commands/new-impl.js +7 -5
- package/commands/serve.d.ts +1 -1
- package/commands/test.d.ts +1 -1
- package/commands/update-impl.d.ts +1 -0
- package/commands/update-impl.js +16 -0
- package/commands/xi18n-impl.js +6 -0
- package/commands/xi18n.d.ts +1 -1
- package/models/analytics.js +4 -3
- package/models/schematic-command.d.ts +1 -0
- package/models/schematic-command.js +6 -4
- package/package.json +10 -10
- package/utilities/tty.d.ts +8 -0
- package/utilities/tty.js +17 -0
package/commands/analytics.d.ts
CHANGED
package/commands/analytics.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/schema",
|
|
3
3
|
"$id": "ng-cli://commands/analytics.json",
|
|
4
|
-
"description": "Configures the gathering of Angular CLI usage metrics. See https://
|
|
4
|
+
"description": "Configures the gathering of Angular CLI usage metrics. See https://v8.angular.io/cli/usage-analytics-gathering.",
|
|
5
5
|
"$longDescription": "",
|
|
6
6
|
|
|
7
7
|
"$aliases": [],
|
package/commands/build.d.ts
CHANGED
package/commands/config-impl.js
CHANGED
|
@@ -70,7 +70,7 @@ const validCliPaths = new Map([
|
|
|
70
70
|
* by the path. For example, a path of "a[3].foo.bar[2]" would give you a fragment array of
|
|
71
71
|
* ["a", 3, "foo", "bar", 2].
|
|
72
72
|
* @param path The JSON string to parse.
|
|
73
|
-
* @returns {string[]} The fragments for the string.
|
|
73
|
+
* @returns {(string|number)[]} The fragments for the string.
|
|
74
74
|
* @private
|
|
75
75
|
*/
|
|
76
76
|
function parseJsonPath(path) {
|
|
@@ -87,11 +87,14 @@ function parseJsonPath(path) {
|
|
|
87
87
|
}
|
|
88
88
|
result.push(match[1]);
|
|
89
89
|
if (match[2]) {
|
|
90
|
-
const indices = match[2]
|
|
90
|
+
const indices = match[2]
|
|
91
|
+
.slice(1, -1)
|
|
92
|
+
.split('][')
|
|
93
|
+
.map(x => /^\d$/.test(x) ? +x : x.replace(/\"|\'/g, ''));
|
|
91
94
|
result.push(...indices);
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
|
-
return result.filter(fragment =>
|
|
97
|
+
return result.filter(fragment => fragment != null);
|
|
95
98
|
}
|
|
96
99
|
function getValueFromPath(root, path) {
|
|
97
100
|
const fragments = parseJsonPath(path);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"properties": {
|
|
8
8
|
"project": {
|
|
9
9
|
"type": "string",
|
|
10
|
-
"description": "The name of the project to build. Can be an
|
|
10
|
+
"description": "The name of the project to build. Can be an application or a library.",
|
|
11
11
|
"$default": {
|
|
12
12
|
"$source": "argv",
|
|
13
13
|
"index": 0
|
package/commands/e2e.d.ts
CHANGED
|
@@ -7,15 +7,16 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
// tslint:disable:no-global-tslint-disable no-any
|
|
11
10
|
const core_1 = require("@angular-devkit/core");
|
|
12
11
|
const schematic_command_1 = require("../models/schematic-command");
|
|
13
12
|
const json_schema_1 = require("../utilities/json-schema");
|
|
14
13
|
class GenerateCommand extends schematic_command_1.SchematicCommand {
|
|
15
14
|
async initialize(options) {
|
|
16
|
-
await super.initialize(options);
|
|
17
15
|
// Fill up the schematics property of the command description.
|
|
18
16
|
const [collectionName, schematicName] = this.parseSchematicInfo(options);
|
|
17
|
+
this.collectionName = collectionName;
|
|
18
|
+
this.schematicName = schematicName;
|
|
19
|
+
await super.initialize(options);
|
|
19
20
|
const collection = this.getCollection(collectionName);
|
|
20
21
|
const subcommands = {};
|
|
21
22
|
const schematicNames = schematicName ? [schematicName] : collection.listSchematicNames();
|
|
@@ -45,13 +46,12 @@ class GenerateCommand extends schematic_command_1.SchematicCommand {
|
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
48
|
async run(options) {
|
|
48
|
-
|
|
49
|
-
if (!schematicName || !collectionName) {
|
|
49
|
+
if (!this.schematicName || !this.collectionName) {
|
|
50
50
|
return this.printHelp(options);
|
|
51
51
|
}
|
|
52
52
|
return this.runSchematic({
|
|
53
|
-
collectionName,
|
|
54
|
-
schematicName,
|
|
53
|
+
collectionName: this.collectionName,
|
|
54
|
+
schematicName: this.schematicName,
|
|
55
55
|
schematicOptions: options['--'] || [],
|
|
56
56
|
debug: !!options.debug || false,
|
|
57
57
|
dryRun: !!options.dryRun || false,
|
package/commands/new-impl.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { Schema as NewCommandSchema } from './new';
|
|
|
11
11
|
export declare class NewCommand extends SchematicCommand<NewCommandSchema> {
|
|
12
12
|
readonly allowMissingWorkspace = true;
|
|
13
13
|
schematicName: string;
|
|
14
|
+
initialize(options: NewCommandSchema & Arguments): Promise<void>;
|
|
14
15
|
run(options: NewCommandSchema & Arguments): Promise<number | void>;
|
|
15
16
|
private parseCollectionName;
|
|
16
17
|
}
|
package/commands/new-impl.js
CHANGED
|
@@ -14,20 +14,22 @@ class NewCommand extends schematic_command_1.SchematicCommand {
|
|
|
14
14
|
this.allowMissingWorkspace = true;
|
|
15
15
|
this.schematicName = 'ng-new';
|
|
16
16
|
}
|
|
17
|
-
async
|
|
18
|
-
let collectionName;
|
|
17
|
+
async initialize(options) {
|
|
19
18
|
if (options.collection) {
|
|
20
|
-
collectionName = options.collection;
|
|
19
|
+
this.collectionName = options.collection;
|
|
21
20
|
}
|
|
22
21
|
else {
|
|
23
|
-
collectionName = this.parseCollectionName(options);
|
|
22
|
+
this.collectionName = this.parseCollectionName(options);
|
|
24
23
|
}
|
|
24
|
+
return super.initialize(options);
|
|
25
|
+
}
|
|
26
|
+
async run(options) {
|
|
25
27
|
// Register the version of the CLI in the registry.
|
|
26
28
|
const packageJson = require('../package.json');
|
|
27
29
|
const version = packageJson.version;
|
|
28
30
|
this._workflow.registry.addSmartDefaultProvider('ng-cli-version', () => version);
|
|
29
31
|
return this.runSchematic({
|
|
30
|
-
collectionName: collectionName,
|
|
32
|
+
collectionName: this.collectionName,
|
|
31
33
|
schematicName: this.schematicName,
|
|
32
34
|
schematicOptions: options['--'] || [],
|
|
33
35
|
debug: !!options.debug,
|
package/commands/serve.d.ts
CHANGED
package/commands/test.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ export declare class UpdateCommand extends SchematicCommand<UpdateCommandSchema>
|
|
|
5
5
|
readonly allowMissingWorkspace = true;
|
|
6
6
|
parseArguments(_schematicOptions: string[], _schema: Option[]): Promise<Arguments>;
|
|
7
7
|
run(options: UpdateCommandSchema & Arguments): Promise<number | void>;
|
|
8
|
+
checkCleanGit(): boolean;
|
|
8
9
|
}
|
package/commands/update-impl.js
CHANGED
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
* Use of this source code is governed by an MIT-style license that can be
|
|
8
8
|
* found in the LICENSE file at https://angular.io/license
|
|
9
9
|
*/
|
|
10
|
+
const child_process_1 = require("child_process");
|
|
10
11
|
const path = require("path");
|
|
11
12
|
const semver = require("semver");
|
|
12
13
|
const schematic_command_1 = require("../models/schematic-command");
|
|
@@ -65,6 +66,12 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
|
|
|
65
66
|
this.logger.error('Can only use "from" or "to" options with "migrate-only" option.');
|
|
66
67
|
return 1;
|
|
67
68
|
}
|
|
69
|
+
// If not asking for status then check for a clean git repository.
|
|
70
|
+
// This allows the user to easily reset any changes from the update.
|
|
71
|
+
if ((packages.length !== 0 || options.all) && !this.checkCleanGit()) {
|
|
72
|
+
this.logger.error('Repository is not clean. Please commit or stash any changes before updating.');
|
|
73
|
+
return 2;
|
|
74
|
+
}
|
|
68
75
|
const packageManager = package_manager_1.getPackageManager(this.workspace.root);
|
|
69
76
|
this.logger.info(`Using package manager: '${packageManager}'`);
|
|
70
77
|
// Special handling for Angular CLI 1.x migrations
|
|
@@ -220,5 +227,14 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
|
|
|
220
227
|
},
|
|
221
228
|
});
|
|
222
229
|
}
|
|
230
|
+
checkCleanGit() {
|
|
231
|
+
try {
|
|
232
|
+
const result = child_process_1.execSync('git status --porcelain', { encoding: 'utf8', stdio: 'pipe' });
|
|
233
|
+
return result.trim().length === 0;
|
|
234
|
+
}
|
|
235
|
+
catch (_a) {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
223
239
|
}
|
|
224
240
|
exports.UpdateCommand = UpdateCommand;
|
package/commands/xi18n-impl.js
CHANGED
|
@@ -14,6 +14,12 @@ class Xi18nCommand extends architect_command_1.ArchitectCommand {
|
|
|
14
14
|
this.target = 'extract-i18n';
|
|
15
15
|
}
|
|
16
16
|
async run(options) {
|
|
17
|
+
const version = process.version.substr(1).split('.');
|
|
18
|
+
if (Number(version[0]) === 12 && Number(version[1]) === 0) {
|
|
19
|
+
this.logger.error('Due to a defect in Node.js 12.0, the command is not supported on this Node.js version. '
|
|
20
|
+
+ 'Please upgrade to Node.js 12.1 or later.');
|
|
21
|
+
return 1;
|
|
22
|
+
}
|
|
17
23
|
return this.runArchitectTarget(options);
|
|
18
24
|
}
|
|
19
25
|
}
|
package/commands/xi18n.d.ts
CHANGED
package/models/analytics.js
CHANGED
|
@@ -16,6 +16,7 @@ const os = require("os");
|
|
|
16
16
|
const ua = require("universal-analytics");
|
|
17
17
|
const uuid_1 = require("uuid");
|
|
18
18
|
const config_1 = require("../utilities/config");
|
|
19
|
+
const tty_1 = require("../utilities/tty");
|
|
19
20
|
const analyticsDebug = debug('ng:analytics'); // Generate analytics, including settings and users.
|
|
20
21
|
const analyticsLogDebug = debug('ng:analytics:log'); // Actual logs of events.
|
|
21
22
|
const BYTES_PER_MEGABYTES = 1024 * 1024;
|
|
@@ -309,7 +310,7 @@ exports.setAnalyticsConfig = setAnalyticsConfig;
|
|
|
309
310
|
*/
|
|
310
311
|
async function promptGlobalAnalytics(force = false) {
|
|
311
312
|
analyticsDebug('prompting global analytics.');
|
|
312
|
-
if (force ||
|
|
313
|
+
if (force || tty_1.isTTY()) {
|
|
313
314
|
const answers = await inquirer.prompt([
|
|
314
315
|
{
|
|
315
316
|
type: 'confirm',
|
|
@@ -353,7 +354,7 @@ async function promptProjectAnalytics(force = false) {
|
|
|
353
354
|
if (!config || !configPath) {
|
|
354
355
|
throw new Error(`Could not find a local workspace. Are you in a project?`);
|
|
355
356
|
}
|
|
356
|
-
if (force ||
|
|
357
|
+
if (force || tty_1.isTTY()) {
|
|
357
358
|
const answers = await inquirer.prompt([
|
|
358
359
|
{
|
|
359
360
|
type: 'confirm',
|
|
@@ -389,7 +390,7 @@ function hasGlobalAnalyticsConfiguration() {
|
|
|
389
390
|
const analyticsConfig = globalWorkspace
|
|
390
391
|
&& globalWorkspace.getCli()
|
|
391
392
|
&& globalWorkspace.getCli()['analytics'];
|
|
392
|
-
if (analyticsConfig !== undefined) {
|
|
393
|
+
if (analyticsConfig !== null && analyticsConfig !== undefined) {
|
|
393
394
|
return true;
|
|
394
395
|
}
|
|
395
396
|
}
|
|
@@ -35,6 +35,7 @@ export declare abstract class SchematicCommand<T extends (BaseSchematicSchema &
|
|
|
35
35
|
private _host;
|
|
36
36
|
private _workspace;
|
|
37
37
|
protected _workflow: NodeWorkflow;
|
|
38
|
+
private readonly defaultCollectionName;
|
|
38
39
|
protected collectionName: string;
|
|
39
40
|
protected schematicName?: string;
|
|
40
41
|
constructor(context: CommandContext, description: CommandDescription, logger: logging.Logger);
|
|
@@ -17,6 +17,7 @@ const workspace_loader_1 = require("../models/workspace-loader");
|
|
|
17
17
|
const config_1 = require("../utilities/config");
|
|
18
18
|
const json_schema_1 = require("../utilities/json-schema");
|
|
19
19
|
const package_manager_1 = require("../utilities/package-manager");
|
|
20
|
+
const tty_1 = require("../utilities/tty");
|
|
20
21
|
const analytics_1 = require("./analytics");
|
|
21
22
|
const command_1 = require("./command");
|
|
22
23
|
const parser_1 = require("./parser");
|
|
@@ -32,7 +33,8 @@ class SchematicCommand extends command_1.Command {
|
|
|
32
33
|
this.allowPrivateSchematics = false;
|
|
33
34
|
this.allowAdditionalArgs = false;
|
|
34
35
|
this._host = new node_1.NodeJsSyncHost();
|
|
35
|
-
this.
|
|
36
|
+
this.defaultCollectionName = '@schematics/angular';
|
|
37
|
+
this.collectionName = this.defaultCollectionName;
|
|
36
38
|
}
|
|
37
39
|
async initialize(options) {
|
|
38
40
|
await this._loadWorkspace();
|
|
@@ -202,7 +204,7 @@ class SchematicCommand extends command_1.Command {
|
|
|
202
204
|
}
|
|
203
205
|
return undefined;
|
|
204
206
|
});
|
|
205
|
-
if (options.interactive !== false &&
|
|
207
|
+
if (options.interactive !== false && tty_1.isTTY()) {
|
|
206
208
|
workflow.registry.usePromptProvider((definitions) => {
|
|
207
209
|
const questions = definitions.map(definition => {
|
|
208
210
|
const question = {
|
|
@@ -267,7 +269,7 @@ class SchematicCommand extends command_1.Command {
|
|
|
267
269
|
return value;
|
|
268
270
|
}
|
|
269
271
|
}
|
|
270
|
-
return this.
|
|
272
|
+
return this.defaultCollectionName;
|
|
271
273
|
}
|
|
272
274
|
async runSchematic(options) {
|
|
273
275
|
const { schematicOptions, debug, dryRun } = options;
|
|
@@ -284,7 +286,7 @@ class SchematicCommand extends command_1.Command {
|
|
|
284
286
|
collectionName = schematic.collection.description.name;
|
|
285
287
|
schematicName = schematic.description.name;
|
|
286
288
|
// TODO: Remove warning check when 'targets' is default
|
|
287
|
-
if (collectionName !== this.
|
|
289
|
+
if (collectionName !== this.defaultCollectionName) {
|
|
288
290
|
const [ast, configPath] = config_1.getWorkspaceRaw('local');
|
|
289
291
|
if (ast) {
|
|
290
292
|
const projectsKeyValue = ast.properties.find(p => p.key.value === 'projects');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "8.0.0
|
|
3
|
+
"version": "8.0.0",
|
|
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.800.0
|
|
32
|
-
"@angular-devkit/core": "8.0.0
|
|
33
|
-
"@angular-devkit/schematics": "8.0.0
|
|
34
|
-
"@schematics/angular": "8.0.0
|
|
35
|
-
"@schematics/update": "0.800.0
|
|
31
|
+
"@angular-devkit/architect": "0.800.0",
|
|
32
|
+
"@angular-devkit/core": "8.0.0",
|
|
33
|
+
"@angular-devkit/schematics": "8.0.0",
|
|
34
|
+
"@schematics/angular": "8.0.0",
|
|
35
|
+
"@schematics/update": "0.800.0",
|
|
36
36
|
"@yarnpkg/lockfile": "1.1.0",
|
|
37
37
|
"debug": "^4.1.1",
|
|
38
38
|
"ini": "1.3.5",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"ng-update": {
|
|
50
50
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
51
51
|
"packageGroup": {
|
|
52
|
-
"@angular/cli": "8.0.0
|
|
53
|
-
"@angular-devkit/build-angular": "0.800.0
|
|
54
|
-
"@angular-devkit/build-ng-packagr": "0.800.0
|
|
55
|
-
"@angular-devkit/build-webpack": "0.800.0
|
|
52
|
+
"@angular/cli": "8.0.0",
|
|
53
|
+
"@angular-devkit/build-angular": "0.800.0",
|
|
54
|
+
"@angular-devkit/build-ng-packagr": "0.800.0",
|
|
55
|
+
"@angular-devkit/build-webpack": "0.800.0"
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
package/utilities/tty.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
6
|
+
*
|
|
7
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
8
|
+
* found in the LICENSE file at https://angular.io/license
|
|
9
|
+
*/
|
|
10
|
+
function isTTY() {
|
|
11
|
+
const force = process.env['NG_FORCE_TTY'];
|
|
12
|
+
if (force !== undefined) {
|
|
13
|
+
return !(force === '0' || force.toUpperCase() === 'FALSE');
|
|
14
|
+
}
|
|
15
|
+
return !!process.stdout.isTTY && !!process.stdin.isTTY;
|
|
16
|
+
}
|
|
17
|
+
exports.isTTY = isTTY;
|