@angular/cli 8.0.0 → 8.0.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/bin/postinstall/analytics-prompt.js +8 -6
- package/commands/build-long.md +8 -4
- package/commands/update-impl.js +79 -28
- package/commands/update.d.ts +4 -0
- package/commands/update.json +4 -0
- package/commands/version-impl.js +6 -2
- package/lib/config/schema.d.ts +4 -0
- package/lib/config/schema.json +4 -0
- package/models/architect-command.js +5 -2
- package/package.json +10 -10
- package/utilities/tty.js +2 -1
|
@@ -5,10 +5,12 @@ if ('NG_CLI_ANALYTICS' in process.env) {
|
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
(async () => {
|
|
9
|
+
try {
|
|
10
|
+
const analytics = require('../../models/analytics');
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} catch (_) {}
|
|
12
|
+
if (!analytics.hasGlobalAnalyticsConfiguration()) {
|
|
13
|
+
await analytics.promptGlobalAnalytics();
|
|
14
|
+
}
|
|
15
|
+
} catch (_) {}
|
|
16
|
+
})();
|
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/update-impl.js
CHANGED
|
@@ -8,18 +8,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
* found in the LICENSE file at https://angular.io/license
|
|
9
9
|
*/
|
|
10
10
|
const child_process_1 = require("child_process");
|
|
11
|
+
const fs = require("fs");
|
|
11
12
|
const path = require("path");
|
|
12
13
|
const semver = require("semver");
|
|
13
14
|
const schematic_command_1 = require("../models/schematic-command");
|
|
14
|
-
const find_up_1 = require("../utilities/find-up");
|
|
15
15
|
const package_manager_1 = require("../utilities/package-manager");
|
|
16
16
|
const package_metadata_1 = require("../utilities/package-metadata");
|
|
17
17
|
const package_tree_1 = require("../utilities/package-tree");
|
|
18
18
|
const npa = require('npm-package-arg');
|
|
19
|
-
const oldConfigFileNames = [
|
|
20
|
-
'.angular-cli.json',
|
|
21
|
-
'angular-cli.json',
|
|
22
|
-
];
|
|
19
|
+
const oldConfigFileNames = ['.angular-cli.json', 'angular-cli.json'];
|
|
23
20
|
class UpdateCommand extends schematic_command_1.SchematicCommand {
|
|
24
21
|
constructor() {
|
|
25
22
|
super(...arguments);
|
|
@@ -68,21 +65,28 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
|
|
|
68
65
|
}
|
|
69
66
|
// If not asking for status then check for a clean git repository.
|
|
70
67
|
// This allows the user to easily reset any changes from the update.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
+
}
|
|
74
77
|
}
|
|
75
78
|
const packageManager = package_manager_1.getPackageManager(this.workspace.root);
|
|
76
79
|
this.logger.info(`Using package manager: '${packageManager}'`);
|
|
77
80
|
// Special handling for Angular CLI 1.x migrations
|
|
78
|
-
if (options.migrateOnly === undefined &&
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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';
|
|
86
90
|
}
|
|
87
91
|
this.logger.info('Collecting installed dependencies...');
|
|
88
92
|
const packageTree = await package_tree_1.readPackageTree(this.workspace.root);
|
|
@@ -145,9 +149,37 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
|
|
|
145
149
|
this.logger.error('Package contains a malformed migrations field.');
|
|
146
150
|
return 1;
|
|
147
151
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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
|
+
}
|
|
151
183
|
}
|
|
152
184
|
return this.runSchematic({
|
|
153
185
|
collectionName: '@schematics/update',
|
|
@@ -178,21 +210,23 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
|
|
|
178
210
|
this.logger.info(`Package '${pkg.name}' is already at '${pkg.fetchSpec}'.`);
|
|
179
211
|
continue;
|
|
180
212
|
}
|
|
181
|
-
requests.push(pkg);
|
|
213
|
+
requests.push({ identifier: pkg, node });
|
|
182
214
|
}
|
|
183
215
|
if (requests.length === 0) {
|
|
184
216
|
return 0;
|
|
185
217
|
}
|
|
218
|
+
const packagesToUpdate = [];
|
|
186
219
|
this.logger.info('Fetching dependency metadata from registry...');
|
|
187
|
-
for (const requestIdentifier of requests) {
|
|
220
|
+
for (const { identifier: requestIdentifier, node } of requests) {
|
|
221
|
+
const packageName = requestIdentifier.name;
|
|
188
222
|
let metadata;
|
|
189
223
|
try {
|
|
190
224
|
// Metadata requests are internally cached; multiple requests for same name
|
|
191
225
|
// does not result in additional network traffic
|
|
192
|
-
metadata = await package_metadata_1.fetchPackageMetadata(
|
|
226
|
+
metadata = await package_metadata_1.fetchPackageMetadata(packageName, this.logger);
|
|
193
227
|
}
|
|
194
228
|
catch (e) {
|
|
195
|
-
this.logger.error(`Error fetching metadata for '${
|
|
229
|
+
this.logger.error(`Error fetching metadata for '${packageName}': ` + e.message);
|
|
196
230
|
return 1;
|
|
197
231
|
}
|
|
198
232
|
// Try to find a package version based on the user requested package specifier
|
|
@@ -214,6 +248,15 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
|
|
|
214
248
|
this.logger.error(`Package specified by '${requestIdentifier.raw}' does not exist within the registry.`);
|
|
215
249
|
return 1;
|
|
216
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;
|
|
217
260
|
}
|
|
218
261
|
return this.runSchematic({
|
|
219
262
|
collectionName: '@schematics/update',
|
|
@@ -223,18 +266,26 @@ class UpdateCommand extends schematic_command_1.SchematicCommand {
|
|
|
223
266
|
additionalOptions: {
|
|
224
267
|
force: options.force || false,
|
|
225
268
|
packageManager,
|
|
226
|
-
packages:
|
|
269
|
+
packages: packagesToUpdate,
|
|
227
270
|
},
|
|
228
271
|
});
|
|
229
272
|
}
|
|
230
273
|
checkCleanGit() {
|
|
231
274
|
try {
|
|
232
275
|
const result = child_process_1.execSync('git status --porcelain', { encoding: 'utf8', stdio: 'pipe' });
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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
|
+
}
|
|
237
286
|
}
|
|
287
|
+
catch (_a) { }
|
|
288
|
+
return true;
|
|
238
289
|
}
|
|
239
290
|
}
|
|
240
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/version-impl.js
CHANGED
|
@@ -72,8 +72,12 @@ class VersionCommand extends command_1.Command {
|
|
|
72
72
|
if (!__dirname.match(/node_modules/)) {
|
|
73
73
|
let gitBranch = '??';
|
|
74
74
|
try {
|
|
75
|
-
const gitRefName =
|
|
76
|
-
|
|
75
|
+
const gitRefName = child_process.execSync('git rev-parse --abbrev-ref HEAD', {
|
|
76
|
+
cwd: __dirname,
|
|
77
|
+
encoding: 'utf8',
|
|
78
|
+
stdio: 'pipe',
|
|
79
|
+
});
|
|
80
|
+
gitBranch = gitRefName.replace('\n', '');
|
|
77
81
|
}
|
|
78
82
|
catch (_a) {
|
|
79
83
|
}
|
package/lib/config/schema.d.ts
CHANGED
package/lib/config/schema.json
CHANGED
|
@@ -194,9 +194,12 @@ class ArchitectCommand extends command_1.Command {
|
|
|
194
194
|
logger: this.logger,
|
|
195
195
|
analytics: analytics_1.isPackageNameSafeForAnalytics(builderConf) ? this.analytics : undefined,
|
|
196
196
|
});
|
|
197
|
-
const
|
|
197
|
+
const { error, success } = await run.output.toPromise();
|
|
198
198
|
await run.stop();
|
|
199
|
-
|
|
199
|
+
if (error) {
|
|
200
|
+
this.logger.error(error);
|
|
201
|
+
}
|
|
202
|
+
return success ? 0 : 1;
|
|
200
203
|
}
|
|
201
204
|
}
|
|
202
205
|
async runArchitectTarget(options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.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.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.4",
|
|
32
|
+
"@angular-devkit/core": "8.0.4",
|
|
33
|
+
"@angular-devkit/schematics": "8.0.4",
|
|
34
|
+
"@schematics/angular": "8.0.4",
|
|
35
|
+
"@schematics/update": "0.800.4",
|
|
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.4",
|
|
53
|
+
"@angular-devkit/build-angular": "0.800.4",
|
|
54
|
+
"@angular-devkit/build-ng-packagr": "0.800.4",
|
|
55
|
+
"@angular-devkit/build-webpack": "0.800.4"
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
package/utilities/tty.js
CHANGED
|
@@ -12,6 +12,7 @@ function isTTY() {
|
|
|
12
12
|
if (force !== undefined) {
|
|
13
13
|
return !(force === '0' || force.toUpperCase() === 'FALSE');
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
const ci = process.env['CI'];
|
|
16
|
+
return !!process.stdout.isTTY && (!ci || ci === '0' || ci.toUpperCase() === 'FALSE');
|
|
16
17
|
}
|
|
17
18
|
exports.isTTY = isTTY;
|