@angular/cli 14.0.0-next.0 → 14.0.0-next.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/config-impl.js +1 -13
- package/commands/extract-i18n-impl.js +0 -11
- package/commands/extract-i18n.json +0 -2
- package/models/architect-command.js +1 -13
- package/package.json +14 -14
- package/utilities/config.d.ts +2 -2
- package/utilities/config.js +6 -74
- package/utilities/package-manager.d.ts +0 -2
- package/utilities/package-manager.js +46 -23
- package/utilities/project.js +1 -6
package/commands/config-impl.js
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.ConfigCommand = void 0;
|
|
11
|
-
const core_1 = require("@angular-devkit/core");
|
|
12
11
|
const uuid_1 = require("uuid");
|
|
13
12
|
const command_1 = require("../models/command");
|
|
14
13
|
const interface_1 = require("../models/interface");
|
|
@@ -88,18 +87,7 @@ class ConfigCommand extends command_1.Command {
|
|
|
88
87
|
if (!options.global) {
|
|
89
88
|
await this.validateScope(interface_1.CommandScope.InProject);
|
|
90
89
|
}
|
|
91
|
-
|
|
92
|
-
if (options.global && !config) {
|
|
93
|
-
try {
|
|
94
|
-
if ((0, config_1.migrateLegacyGlobalConfig)()) {
|
|
95
|
-
config = (0, config_1.getWorkspaceRaw)(level)[0];
|
|
96
|
-
this.logger.info(core_1.tags.oneLine `
|
|
97
|
-
We found a global configuration that was used in Angular CLI 1.
|
|
98
|
-
It has been automatically migrated.`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
catch { }
|
|
102
|
-
}
|
|
90
|
+
const [config] = (0, config_1.getWorkspaceRaw)(level);
|
|
103
91
|
if (options.value == undefined) {
|
|
104
92
|
if (!config) {
|
|
105
93
|
this.logger.error('No config found.');
|
|
@@ -15,17 +15,6 @@ class ExtractI18nCommand extends architect_command_1.ArchitectCommand {
|
|
|
15
15
|
this.target = 'extract-i18n';
|
|
16
16
|
}
|
|
17
17
|
async run(options) {
|
|
18
|
-
const version = process.version.substr(1).split('.');
|
|
19
|
-
if (Number(version[0]) === 12 && Number(version[1]) === 0) {
|
|
20
|
-
this.logger.error('Due to a defect in Node.js 12.0, the command is not supported on this Node.js version. ' +
|
|
21
|
-
'Please upgrade to Node.js 12.1 or later.');
|
|
22
|
-
return 1;
|
|
23
|
-
}
|
|
24
|
-
const commandName = process.argv[2];
|
|
25
|
-
if (['xi18n', 'i18n-extract'].includes(commandName)) {
|
|
26
|
-
this.logger.warn(`Warning: "ng ${commandName}" has been deprecated and will be removed in a future major version. ` +
|
|
27
|
-
'Please use "ng extract-i18n" instead.');
|
|
28
|
-
}
|
|
29
18
|
return this.runArchitectTarget(options);
|
|
30
19
|
}
|
|
31
20
|
}
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
"$id": "ng-cli://commands/extract-i18n.json",
|
|
4
4
|
"description": "Extracts i18n messages from source code.",
|
|
5
5
|
"$longDescription": "",
|
|
6
|
-
|
|
7
|
-
"$aliases": ["i18n-extract", "xi18n"],
|
|
8
6
|
"$scope": "in",
|
|
9
7
|
"$type": "architect",
|
|
10
8
|
"$impl": "./extract-i18n-impl#ExtractI18nCommand",
|
|
@@ -218,19 +218,7 @@ class ArchitectCommand extends command_1.Command {
|
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
220
|
const packageManager = await (0, package_manager_1.getPackageManager)(basePath);
|
|
221
|
-
|
|
222
|
-
switch (packageManager) {
|
|
223
|
-
case 'npm':
|
|
224
|
-
installSuggestion += `'npm install'`;
|
|
225
|
-
break;
|
|
226
|
-
case 'yarn':
|
|
227
|
-
installSuggestion += `'yarn'`;
|
|
228
|
-
break;
|
|
229
|
-
default:
|
|
230
|
-
installSuggestion += `the project's package manager`;
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
this.logger.warn(`Node packages may not be installed. ${installSuggestion}.`);
|
|
221
|
+
this.logger.warn(`Node packages may not be installed. Try installing with '${packageManager} install'.`);
|
|
234
222
|
}
|
|
235
223
|
async run(options) {
|
|
236
224
|
return await this.runArchitectTarget(options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "14.0.0-next.
|
|
3
|
+
"version": "14.0.0-next.3",
|
|
4
4
|
"description": "CLI tool for Angular",
|
|
5
5
|
"main": "lib/cli/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -28,21 +28,21 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/angular/angular-cli",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@angular-devkit/architect": "0.1400.0-next.
|
|
32
|
-
"@angular-devkit/core": "14.0.0-next.
|
|
33
|
-
"@angular-devkit/schematics": "14.0.0-next.
|
|
34
|
-
"@schematics/angular": "14.0.0-next.
|
|
31
|
+
"@angular-devkit/architect": "0.1400.0-next.3",
|
|
32
|
+
"@angular-devkit/core": "14.0.0-next.3",
|
|
33
|
+
"@angular-devkit/schematics": "14.0.0-next.3",
|
|
34
|
+
"@schematics/angular": "14.0.0-next.3",
|
|
35
35
|
"@yarnpkg/lockfile": "1.1.0",
|
|
36
36
|
"ansi-colors": "4.1.1",
|
|
37
37
|
"debug": "4.3.3",
|
|
38
38
|
"ini": "2.0.0",
|
|
39
39
|
"inquirer": "8.2.0",
|
|
40
40
|
"jsonc-parser": "3.0.0",
|
|
41
|
-
"npm-package-arg": "
|
|
42
|
-
"npm-pick-manifest": "
|
|
41
|
+
"npm-package-arg": "9.0.0",
|
|
42
|
+
"npm-pick-manifest": "7.0.0",
|
|
43
43
|
"open": "8.4.0",
|
|
44
44
|
"ora": "5.4.1",
|
|
45
|
-
"pacote": "
|
|
45
|
+
"pacote": "13.0.2",
|
|
46
46
|
"resolve": "1.22.0",
|
|
47
47
|
"semver": "7.3.5",
|
|
48
48
|
"symbol-observable": "4.0.0",
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"ng-update": {
|
|
52
52
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
53
53
|
"packageGroup": {
|
|
54
|
-
"@angular/cli": "14.0.0-next.
|
|
55
|
-
"@angular-devkit/architect": "0.1400.0-next.
|
|
56
|
-
"@angular-devkit/build-angular": "14.0.0-next.
|
|
57
|
-
"@angular-devkit/build-webpack": "0.1400.0-next.
|
|
58
|
-
"@angular-devkit/core": "14.0.0-next.
|
|
59
|
-
"@angular-devkit/schematics": "14.0.0-next.
|
|
54
|
+
"@angular/cli": "14.0.0-next.3",
|
|
55
|
+
"@angular-devkit/architect": "0.1400.0-next.3",
|
|
56
|
+
"@angular-devkit/build-angular": "14.0.0-next.3",
|
|
57
|
+
"@angular-devkit/build-webpack": "0.1400.0-next.3",
|
|
58
|
+
"@angular-devkit/core": "14.0.0-next.3",
|
|
59
|
+
"@angular-devkit/schematics": "14.0.0-next.3"
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
package/utilities/config.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { json, workspaces } from '@angular-devkit/core';
|
|
9
|
+
import { PackageManager } from '../lib/config/workspace-schema';
|
|
9
10
|
import { JSONFile } from './json-file';
|
|
10
11
|
export declare const workspaceSchemaPath: string;
|
|
11
12
|
export declare class AngularWorkspace {
|
|
@@ -24,7 +25,6 @@ export declare function createGlobalSettings(): string;
|
|
|
24
25
|
export declare function getWorkspaceRaw(level?: 'local' | 'global'): [JSONFile | null, string | null];
|
|
25
26
|
export declare function validateWorkspace(data: json.JsonObject): Promise<void>;
|
|
26
27
|
export declare function getProjectByCwd(workspace: AngularWorkspace): string | null;
|
|
27
|
-
export declare function getConfiguredPackageManager(): Promise<
|
|
28
|
-
export declare function migrateLegacyGlobalConfig(): boolean;
|
|
28
|
+
export declare function getConfiguredPackageManager(): Promise<PackageManager | null>;
|
|
29
29
|
export declare function getSchematicDefaults(collection: string, schematic: string, project?: string | null): Promise<{}>;
|
|
30
30
|
export declare function isWarningEnabled(warning: string): Promise<boolean>;
|
package/utilities/config.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.isWarningEnabled = exports.getSchematicDefaults = exports.
|
|
29
|
+
exports.isWarningEnabled = exports.getSchematicDefaults = exports.getConfiguredPackageManager = exports.getProjectByCwd = exports.validateWorkspace = exports.getWorkspaceRaw = exports.createGlobalSettings = exports.getWorkspace = exports.AngularWorkspace = exports.workspaceSchemaPath = void 0;
|
|
30
30
|
const core_1 = require("@angular-devkit/core");
|
|
31
31
|
const fs_1 = require("fs");
|
|
32
32
|
const os = __importStar(require("os"));
|
|
@@ -139,12 +139,6 @@ class AngularWorkspace {
|
|
|
139
139
|
return (project === null || project === void 0 ? void 0 : project.extensions['cli']) || {};
|
|
140
140
|
}
|
|
141
141
|
static async load(workspaceFilePath) {
|
|
142
|
-
const oldConfigFileNames = ['.angular-cli.json', 'angular-cli.json'];
|
|
143
|
-
if (oldConfigFileNames.includes(path.basename(workspaceFilePath))) {
|
|
144
|
-
// 1.x file format
|
|
145
|
-
// Create an empty workspace to allow update to be used
|
|
146
|
-
return new AngularWorkspace({ extensions: {}, projects: new core_1.workspaces.ProjectDefinitionCollection() }, workspaceFilePath);
|
|
147
|
-
}
|
|
148
142
|
const result = await core_1.workspaces.readWorkspace(workspaceFilePath, createWorkspaceHost(), core_1.workspaces.WorkspaceFormat.JSON);
|
|
149
143
|
return new AngularWorkspace(result.workspace, workspaceFilePath);
|
|
150
144
|
}
|
|
@@ -268,86 +262,24 @@ async function getConfiguredPackageManager() {
|
|
|
268
262
|
return value;
|
|
269
263
|
}
|
|
270
264
|
}
|
|
265
|
+
return null;
|
|
271
266
|
};
|
|
272
|
-
let result;
|
|
267
|
+
let result = null;
|
|
273
268
|
const workspace = await getWorkspace('local');
|
|
274
269
|
if (workspace) {
|
|
275
270
|
const project = getProjectByCwd(workspace);
|
|
276
271
|
if (project) {
|
|
277
272
|
result = getPackageManager((_a = workspace.projects.get(project)) === null || _a === void 0 ? void 0 : _a.extensions['cli']);
|
|
278
273
|
}
|
|
279
|
-
result
|
|
274
|
+
result !== null && result !== void 0 ? result : (result = getPackageManager(workspace.extensions['cli']));
|
|
280
275
|
}
|
|
281
|
-
if (result
|
|
276
|
+
if (!result) {
|
|
282
277
|
const globalOptions = await getWorkspace('global');
|
|
283
278
|
result = getPackageManager(globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.extensions['cli']);
|
|
284
|
-
if (!workspace && !globalOptions) {
|
|
285
|
-
// Only check legacy if updated workspace is not found
|
|
286
|
-
result = getLegacyPackageManager();
|
|
287
|
-
}
|
|
288
279
|
}
|
|
289
|
-
|
|
290
|
-
return result !== null && result !== void 0 ? result : null;
|
|
280
|
+
return result;
|
|
291
281
|
}
|
|
292
282
|
exports.getConfiguredPackageManager = getConfiguredPackageManager;
|
|
293
|
-
function migrateLegacyGlobalConfig() {
|
|
294
|
-
const homeDir = os.homedir();
|
|
295
|
-
if (homeDir) {
|
|
296
|
-
const legacyGlobalConfigPath = path.join(homeDir, '.angular-cli.json');
|
|
297
|
-
if ((0, fs_1.existsSync)(legacyGlobalConfigPath)) {
|
|
298
|
-
const legacy = (0, json_file_1.readAndParseJson)(legacyGlobalConfigPath);
|
|
299
|
-
if (!isJsonObject(legacy)) {
|
|
300
|
-
return false;
|
|
301
|
-
}
|
|
302
|
-
const cli = {};
|
|
303
|
-
if (legacy.packageManager &&
|
|
304
|
-
typeof legacy.packageManager == 'string' &&
|
|
305
|
-
legacy.packageManager !== 'default') {
|
|
306
|
-
cli['packageManager'] = legacy.packageManager;
|
|
307
|
-
}
|
|
308
|
-
if (isJsonObject(legacy.defaults) &&
|
|
309
|
-
isJsonObject(legacy.defaults.schematics) &&
|
|
310
|
-
typeof legacy.defaults.schematics.collection == 'string') {
|
|
311
|
-
cli['defaultCollection'] = legacy.defaults.schematics.collection;
|
|
312
|
-
}
|
|
313
|
-
if (isJsonObject(legacy.warnings)) {
|
|
314
|
-
const warnings = {};
|
|
315
|
-
if (typeof legacy.warnings.versionMismatch == 'boolean') {
|
|
316
|
-
warnings['versionMismatch'] = legacy.warnings.versionMismatch;
|
|
317
|
-
}
|
|
318
|
-
if (Object.getOwnPropertyNames(warnings).length > 0) {
|
|
319
|
-
cli['warnings'] = warnings;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
if (Object.getOwnPropertyNames(cli).length > 0) {
|
|
323
|
-
const globalPath = path.join(homeDir, globalFileName);
|
|
324
|
-
(0, fs_1.writeFileSync)(globalPath, JSON.stringify({ version: 1, cli }, null, 2));
|
|
325
|
-
return true;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
return false;
|
|
330
|
-
}
|
|
331
|
-
exports.migrateLegacyGlobalConfig = migrateLegacyGlobalConfig;
|
|
332
|
-
// Fallback, check for packageManager in config file in v1.* global config.
|
|
333
|
-
function getLegacyPackageManager() {
|
|
334
|
-
const homeDir = os.homedir();
|
|
335
|
-
if (homeDir) {
|
|
336
|
-
const legacyGlobalConfigPath = path.join(homeDir, '.angular-cli.json');
|
|
337
|
-
if ((0, fs_1.existsSync)(legacyGlobalConfigPath)) {
|
|
338
|
-
const legacy = (0, json_file_1.readAndParseJson)(legacyGlobalConfigPath);
|
|
339
|
-
if (!isJsonObject(legacy)) {
|
|
340
|
-
return null;
|
|
341
|
-
}
|
|
342
|
-
if (legacy.packageManager &&
|
|
343
|
-
typeof legacy.packageManager === 'string' &&
|
|
344
|
-
legacy.packageManager !== 'default') {
|
|
345
|
-
return legacy.packageManager;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
return null;
|
|
350
|
-
}
|
|
351
283
|
async function getSchematicDefaults(collection, schematic, project) {
|
|
352
284
|
var _a;
|
|
353
285
|
const result = {};
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { PackageManager } from '../lib/config/workspace-schema';
|
|
9
|
-
export declare function supportsYarn(): boolean;
|
|
10
|
-
export declare function supportsNpm(): boolean;
|
|
11
9
|
export declare function getPackageManager(root: string): Promise<PackageManager>;
|
|
12
10
|
/**
|
|
13
11
|
* Checks if the npm version is a supported 7.x version. If not, display a warning.
|
|
@@ -7,54 +7,77 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.ensureCompatibleNpm = exports.getPackageManager =
|
|
10
|
+
exports.ensureCompatibleNpm = exports.getPackageManager = void 0;
|
|
11
11
|
const child_process_1 = require("child_process");
|
|
12
12
|
const fs_1 = require("fs");
|
|
13
13
|
const path_1 = require("path");
|
|
14
14
|
const semver_1 = require("semver");
|
|
15
|
+
const util_1 = require("util");
|
|
15
16
|
const workspace_schema_1 = require("../lib/config/workspace-schema");
|
|
16
17
|
const config_1 = require("./config");
|
|
17
|
-
|
|
18
|
+
const exec = (0, util_1.promisify)(child_process_1.exec);
|
|
19
|
+
async function supports(name) {
|
|
18
20
|
try {
|
|
19
|
-
|
|
21
|
+
await exec(`${name} --version`);
|
|
20
22
|
return true;
|
|
21
23
|
}
|
|
22
24
|
catch {
|
|
23
25
|
return false;
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
async function hasLockfile(root, packageManager) {
|
|
29
|
+
try {
|
|
30
|
+
let lockfileName;
|
|
31
|
+
switch (packageManager) {
|
|
32
|
+
case workspace_schema_1.PackageManager.Yarn:
|
|
33
|
+
lockfileName = 'yarn.lock';
|
|
34
|
+
break;
|
|
35
|
+
case workspace_schema_1.PackageManager.Pnpm:
|
|
36
|
+
lockfileName = 'pnpm-lock.yaml';
|
|
37
|
+
break;
|
|
38
|
+
case workspace_schema_1.PackageManager.Npm:
|
|
39
|
+
default:
|
|
40
|
+
lockfileName = 'package-lock.json';
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
await fs_1.promises.access((0, path_1.join)(root, lockfileName), fs_1.constants.F_OK);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
32
49
|
}
|
|
33
|
-
exports.supportsNpm = supportsNpm;
|
|
34
50
|
async function getPackageManager(root) {
|
|
35
|
-
|
|
51
|
+
const packageManager = await (0, config_1.getConfiguredPackageManager)();
|
|
36
52
|
if (packageManager) {
|
|
37
53
|
return packageManager;
|
|
38
54
|
}
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
55
|
+
const [hasYarnLock, hasNpmLock, hasPnpmLock] = await Promise.all([
|
|
56
|
+
hasLockfile(root, workspace_schema_1.PackageManager.Yarn),
|
|
57
|
+
hasLockfile(root, workspace_schema_1.PackageManager.Npm),
|
|
58
|
+
hasLockfile(root, workspace_schema_1.PackageManager.Pnpm),
|
|
59
|
+
]);
|
|
60
|
+
const hasYarn = await supports(workspace_schema_1.PackageManager.Yarn);
|
|
43
61
|
if (hasYarn && hasYarnLock && !hasNpmLock) {
|
|
44
|
-
|
|
62
|
+
return workspace_schema_1.PackageManager.Yarn;
|
|
63
|
+
}
|
|
64
|
+
const hasPnpm = await supports(workspace_schema_1.PackageManager.Pnpm);
|
|
65
|
+
if (hasPnpm && hasPnpmLock && !hasNpmLock) {
|
|
66
|
+
return workspace_schema_1.PackageManager.Pnpm;
|
|
45
67
|
}
|
|
46
|
-
|
|
47
|
-
|
|
68
|
+
const hasNpm = await supports(workspace_schema_1.PackageManager.Npm);
|
|
69
|
+
if (hasNpm && hasNpmLock && !hasYarnLock && !hasPnpmLock) {
|
|
70
|
+
return workspace_schema_1.PackageManager.Npm;
|
|
48
71
|
}
|
|
49
|
-
|
|
50
|
-
|
|
72
|
+
if (hasYarn && !hasNpm && !hasPnpm) {
|
|
73
|
+
return workspace_schema_1.PackageManager.Yarn;
|
|
51
74
|
}
|
|
52
|
-
|
|
53
|
-
|
|
75
|
+
if (hasPnpm && !hasYarn && !hasNpm) {
|
|
76
|
+
return workspace_schema_1.PackageManager.Pnpm;
|
|
54
77
|
}
|
|
55
78
|
// TODO: This should eventually inform the user of ambiguous package manager usage.
|
|
56
79
|
// Potentially with a prompt to choose and optionally set as the default.
|
|
57
|
-
return
|
|
80
|
+
return workspace_schema_1.PackageManager.Npm;
|
|
58
81
|
}
|
|
59
82
|
exports.getPackageManager = getPackageManager;
|
|
60
83
|
/**
|
package/utilities/project.js
CHANGED
|
@@ -33,12 +33,7 @@ const os = __importStar(require("os"));
|
|
|
33
33
|
const path = __importStar(require("path"));
|
|
34
34
|
const find_up_1 = require("./find-up");
|
|
35
35
|
function findWorkspaceFile(currentDirectory = process.cwd()) {
|
|
36
|
-
const possibleConfigFiles = [
|
|
37
|
-
'angular.json',
|
|
38
|
-
'.angular.json',
|
|
39
|
-
'angular-cli.json',
|
|
40
|
-
'.angular-cli.json',
|
|
41
|
-
];
|
|
36
|
+
const possibleConfigFiles = ['angular.json', '.angular.json'];
|
|
42
37
|
const configFilePath = (0, find_up_1.findUp)(possibleConfigFiles, currentDirectory);
|
|
43
38
|
if (configFilePath === null) {
|
|
44
39
|
return null;
|