@angular/cli 8.0.0-rc.4 → 8.0.3
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-long.md +8 -4
- 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 +88 -21
- package/commands/update.d.ts +4 -0
- package/commands/update.json +4 -0
- package/commands/xi18n-impl.js +6 -0
- package/commands/xi18n.d.ts +1 -1
- package/lib/config/schema.d.ts +4 -0
- package/lib/config/schema.json +4 -0
- 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 +18 -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-long.md
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
The command can be used to build a project of type "application" or "library".
|
|
2
|
+
When used to build a library, a different builder is invoked, and only the `ts-config`, `configuration`, and `watch` options are applied.
|
|
3
|
+
All other options apply only to building applications.
|
|
4
|
+
|
|
5
|
+
The application builder uses the [webpack](https://webpack.js.org/) build tool, with default configuration options specified in the workspace configuration file (`angular.json`) or with a named alternative configuration.
|
|
6
|
+
A "production" configuration is created by default when you use the CLI to create the project, and you can use that configuration by specifying the `--configuration="production"` or the `--prod="true"` option.
|
|
3
7
|
|
|
4
8
|
The configuration options generally correspond to the command options.
|
|
5
|
-
You can override individual configuration defaults by specifying the corresponding options on the command line.
|
|
9
|
+
You can override individual configuration defaults by specifying the corresponding options on the command line.
|
|
6
10
|
The command can accept option names given in either dash-case or camelCase.
|
|
7
11
|
Note that in the configuration file, you must specify names in camelCase.
|
|
8
12
|
|
|
9
13
|
Some additional options can only be set through the configuration file,
|
|
10
14
|
either by direct editing or with the `ng config` command.
|
|
11
|
-
These include `assets`, `styles`, and `scripts` objects that provide runtime-global resources to include in the project.
|
|
15
|
+
These include `assets`, `styles`, and `scripts` objects that provide runtime-global resources to include in the project.
|
|
12
16
|
Resources in CSS, such as images and fonts, are automatically written and fingerprinted at the root of the output folder.
|
|
13
17
|
|
|
14
18
|
For further details, see [Workspace Configuration](guide/workspace-config).
|
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,18 +7,16 @@ 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");
|
|
11
|
+
const fs = require("fs");
|
|
10
12
|
const path = require("path");
|
|
11
13
|
const semver = require("semver");
|
|
12
14
|
const schematic_command_1 = require("../models/schematic-command");
|
|
13
|
-
const find_up_1 = require("../utilities/find-up");
|
|
14
15
|
const package_manager_1 = require("../utilities/package-manager");
|
|
15
16
|
const package_metadata_1 = require("../utilities/package-metadata");
|
|
16
17
|
const package_tree_1 = require("../utilities/package-tree");
|
|
17
18
|
const npa = require('npm-package-arg');
|
|
18
|
-
const oldConfigFileNames = [
|
|
19
|
-
'.angular-cli.json',
|
|
20
|
-
'angular-cli.json',
|
|
21
|
-
];
|
|
19
|
+
const oldConfigFileNames = ['.angular-cli.json', 'angular-cli.json'];
|
|
22
20
|
class UpdateCommand extends schematic_command_1.SchematicCommand {
|
|
23
21
|
constructor() {
|
|
24
22
|
super(...arguments);
|
|
@@ -65,17 +63,30 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
|
|
|
65
63
|
this.logger.error('Can only use "from" or "to" options with "migrate-only" option.');
|
|
66
64
|
return 1;
|
|
67
65
|
}
|
|
66
|
+
// If not asking for status then check for a clean git repository.
|
|
67
|
+
// This allows the user to easily reset any changes from the update.
|
|
68
|
+
const statusCheck = packages.length === 0 && !options.all;
|
|
69
|
+
if (!statusCheck && !this.checkCleanGit()) {
|
|
70
|
+
if (options.allowDirty) {
|
|
71
|
+
this.logger.warn('Repository is not clean. Update changes will be mixed with pre-existing changes.');
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
this.logger.error('Repository is not clean. Please commit or stash any changes before updating.');
|
|
75
|
+
return 2;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
68
78
|
const packageManager = package_manager_1.getPackageManager(this.workspace.root);
|
|
69
79
|
this.logger.info(`Using package manager: '${packageManager}'`);
|
|
70
80
|
// Special handling for Angular CLI 1.x migrations
|
|
71
|
-
if (options.migrateOnly === undefined &&
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
if (options.migrateOnly === undefined &&
|
|
82
|
+
options.from === undefined &&
|
|
83
|
+
!options.all &&
|
|
84
|
+
packages.length === 1 &&
|
|
85
|
+
packages[0].name === '@angular/cli' &&
|
|
86
|
+
this.workspace.configFile &&
|
|
87
|
+
oldConfigFileNames.includes(this.workspace.configFile)) {
|
|
88
|
+
options.migrateOnly = true;
|
|
89
|
+
options.from = '1.0.0';
|
|
79
90
|
}
|
|
80
91
|
this.logger.info('Collecting installed dependencies...');
|
|
81
92
|
const packageTree = await package_tree_1.readPackageTree(this.workspace.root);
|
|
@@ -138,9 +149,37 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
|
|
|
138
149
|
this.logger.error('Package contains a malformed migrations field.');
|
|
139
150
|
return 1;
|
|
140
151
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
152
|
+
else if (path.posix.isAbsolute(migrations) || path.win32.isAbsolute(migrations)) {
|
|
153
|
+
this.logger.error('Package contains an invalid migrations field. Absolute paths are not permitted.');
|
|
154
|
+
return 1;
|
|
155
|
+
}
|
|
156
|
+
// Normalize slashes
|
|
157
|
+
migrations = migrations.replace(/\\/g, '/');
|
|
158
|
+
if (migrations.startsWith('../')) {
|
|
159
|
+
this.logger.error('Package contains an invalid migrations field. ' +
|
|
160
|
+
'Paths outside the package root are not permitted.');
|
|
161
|
+
return 1;
|
|
162
|
+
}
|
|
163
|
+
// Check if it is a package-local location
|
|
164
|
+
const localMigrations = path.join(packageNode.path, migrations);
|
|
165
|
+
if (fs.existsSync(localMigrations)) {
|
|
166
|
+
migrations = localMigrations;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
// Try to resolve from package location.
|
|
170
|
+
// This avoids issues with package hoisting.
|
|
171
|
+
try {
|
|
172
|
+
migrations = require.resolve(migrations, { paths: [packageNode.path] });
|
|
173
|
+
}
|
|
174
|
+
catch (e) {
|
|
175
|
+
if (e.code === 'MODULE_NOT_FOUND') {
|
|
176
|
+
this.logger.error('Migrations for package were not found.');
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
this.logger.error(`Unable to resolve migrations for package. [${e.message}]`);
|
|
180
|
+
}
|
|
181
|
+
return 1;
|
|
182
|
+
}
|
|
144
183
|
}
|
|
145
184
|
return this.runSchematic({
|
|
146
185
|
collectionName: '@schematics/update',
|
|
@@ -171,21 +210,23 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
|
|
|
171
210
|
this.logger.info(`Package '${pkg.name}' is already at '${pkg.fetchSpec}'.`);
|
|
172
211
|
continue;
|
|
173
212
|
}
|
|
174
|
-
requests.push(pkg);
|
|
213
|
+
requests.push({ identifier: pkg, node });
|
|
175
214
|
}
|
|
176
215
|
if (requests.length === 0) {
|
|
177
216
|
return 0;
|
|
178
217
|
}
|
|
218
|
+
const packagesToUpdate = [];
|
|
179
219
|
this.logger.info('Fetching dependency metadata from registry...');
|
|
180
|
-
for (const requestIdentifier of requests) {
|
|
220
|
+
for (const { identifier: requestIdentifier, node } of requests) {
|
|
221
|
+
const packageName = requestIdentifier.name;
|
|
181
222
|
let metadata;
|
|
182
223
|
try {
|
|
183
224
|
// Metadata requests are internally cached; multiple requests for same name
|
|
184
225
|
// does not result in additional network traffic
|
|
185
|
-
metadata = await package_metadata_1.fetchPackageMetadata(
|
|
226
|
+
metadata = await package_metadata_1.fetchPackageMetadata(packageName, this.logger);
|
|
186
227
|
}
|
|
187
228
|
catch (e) {
|
|
188
|
-
this.logger.error(`Error fetching metadata for '${
|
|
229
|
+
this.logger.error(`Error fetching metadata for '${packageName}': ` + e.message);
|
|
189
230
|
return 1;
|
|
190
231
|
}
|
|
191
232
|
// Try to find a package version based on the user requested package specifier
|
|
@@ -207,6 +248,15 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
|
|
|
207
248
|
this.logger.error(`Package specified by '${requestIdentifier.raw}' does not exist within the registry.`);
|
|
208
249
|
return 1;
|
|
209
250
|
}
|
|
251
|
+
if ((typeof node === 'string' && manifest.version === node) ||
|
|
252
|
+
(typeof node === 'object' && manifest.version === node.package.version)) {
|
|
253
|
+
this.logger.info(`Package '${packageName}' is already up to date.`);
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
packagesToUpdate.push(requestIdentifier.toString());
|
|
257
|
+
}
|
|
258
|
+
if (packagesToUpdate.length === 0) {
|
|
259
|
+
return 0;
|
|
210
260
|
}
|
|
211
261
|
return this.runSchematic({
|
|
212
262
|
collectionName: '@schematics/update',
|
|
@@ -216,9 +266,26 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
|
|
|
216
266
|
additionalOptions: {
|
|
217
267
|
force: options.force || false,
|
|
218
268
|
packageManager,
|
|
219
|
-
packages:
|
|
269
|
+
packages: packagesToUpdate,
|
|
220
270
|
},
|
|
221
271
|
});
|
|
222
272
|
}
|
|
273
|
+
checkCleanGit() {
|
|
274
|
+
try {
|
|
275
|
+
const result = child_process_1.execSync('git status --porcelain', { encoding: 'utf8', stdio: 'pipe' });
|
|
276
|
+
if (result.trim().length === 0) {
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
// Only files inside the workspace root are relevant
|
|
280
|
+
for (const entry of result.split('\n')) {
|
|
281
|
+
const relativeEntry = path.relative(path.resolve(this.workspace.root), path.resolve(entry.slice(3).trim()));
|
|
282
|
+
if (!relativeEntry.startsWith('..') && !path.isAbsolute(relativeEntry)) {
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
catch (_a) { }
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
223
290
|
}
|
|
224
291
|
exports.UpdateCommand = UpdateCommand;
|
package/commands/update.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ export interface Schema {
|
|
|
6
6
|
* Whether to update all packages in package.json.
|
|
7
7
|
*/
|
|
8
8
|
all?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Whether to allow updating when the repository contains modified or untracked files.
|
|
11
|
+
*/
|
|
12
|
+
allowDirty?: boolean;
|
|
9
13
|
/**
|
|
10
14
|
* If false, will error out if installed packages are incompatible with the update.
|
|
11
15
|
*/
|
package/commands/update.json
CHANGED
|
@@ -53,6 +53,10 @@
|
|
|
53
53
|
"to": {
|
|
54
54
|
"description": "Version up to which to apply migrations. Only available with a single package being updated, and only on migrations only. Requires from to be specified. Default to the installed version detected.",
|
|
55
55
|
"type": "string"
|
|
56
|
+
},
|
|
57
|
+
"allowDirty": {
|
|
58
|
+
"description": "Whether to allow updating when the repository contains modified or untracked files.",
|
|
59
|
+
"type": "boolean"
|
|
56
60
|
}
|
|
57
61
|
}
|
|
58
62
|
}
|
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/lib/config/schema.d.ts
CHANGED
package/lib/config/schema.json
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.
|
|
3
|
+
"version": "8.0.3",
|
|
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.
|
|
32
|
-
"@angular-devkit/core": "8.0.
|
|
33
|
-
"@angular-devkit/schematics": "8.0.
|
|
34
|
-
"@schematics/angular": "8.0.
|
|
35
|
-
"@schematics/update": "0.800.
|
|
31
|
+
"@angular-devkit/architect": "0.800.3",
|
|
32
|
+
"@angular-devkit/core": "8.0.3",
|
|
33
|
+
"@angular-devkit/schematics": "8.0.3",
|
|
34
|
+
"@schematics/angular": "8.0.3",
|
|
35
|
+
"@schematics/update": "0.800.3",
|
|
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.
|
|
53
|
-
"@angular-devkit/build-angular": "0.800.
|
|
54
|
-
"@angular-devkit/build-ng-packagr": "0.800.
|
|
55
|
-
"@angular-devkit/build-webpack": "0.800.
|
|
52
|
+
"@angular/cli": "8.0.3",
|
|
53
|
+
"@angular-devkit/build-angular": "0.800.3",
|
|
54
|
+
"@angular-devkit/build-ng-packagr": "0.800.3",
|
|
55
|
+
"@angular-devkit/build-webpack": "0.800.3"
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
package/utilities/tty.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
const ci = process.env['CI'];
|
|
16
|
+
return !!process.stdout.isTTY && (!ci || ci === '0' || ci.toUpperCase() === 'FALSE');
|
|
17
|
+
}
|
|
18
|
+
exports.isTTY = isTTY;
|