@angular/cli 14.0.0 → 14.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/lib/cli/index.js +35 -9
- package/lib/init.js +18 -2
- package/package.json +11 -11
- package/src/command-builder/architect-base-command-module.d.ts +1 -1
- package/src/command-builder/architect-base-command-module.js +2 -2
- package/src/command-builder/architect-command-module.js +16 -8
- package/src/command-builder/command-module.d.ts +4 -2
- package/src/command-builder/command-module.js +26 -3
- package/src/command-builder/command-runner.js +1 -7
- package/src/command-builder/schematics-command-module.d.ts +1 -1
- package/src/command-builder/schematics-command-module.js +2 -2
- package/src/command-builder/utilities/command.js +13 -2
- package/src/commands/cache/clean/cli.d.ts +1 -1
- package/src/commands/cache/clean/cli.js +1 -0
- package/src/commands/cache/cli.d.ts +1 -1
- package/src/commands/cache/cli.js +1 -0
- package/src/commands/cache/info/cli.d.ts +1 -1
- package/src/commands/cache/info/cli.js +1 -0
- package/src/commands/cache/settings/cli.d.ts +2 -2
- package/src/commands/cache/settings/cli.js +2 -0
- package/src/commands/config/cli.js +2 -2
- package/src/commands/deploy/cli.js +0 -4
- package/src/commands/new/cli.d.ts +1 -1
- package/src/commands/new/cli.js +1 -1
- package/src/commands/run/cli.d.ts +1 -1
- package/src/commands/run/cli.js +11 -1
- package/src/commands/update/cli.d.ts +1 -1
- package/src/commands/update/cli.js +2 -2
- package/src/utilities/config.d.ts +10 -3
- package/src/utilities/config.js +26 -23
- package/src/utilities/package-manager.d.ts +1 -1
- package/src/utilities/package-manager.js +2 -2
package/lib/cli/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.VERSION = void 0;
|
|
11
|
-
const
|
|
11
|
+
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const util_1 = require("util");
|
|
13
13
|
const command_module_1 = require("../../src/command-builder/command-module");
|
|
14
14
|
const command_runner_1 = require("../../src/command-builder/command-runner");
|
|
@@ -17,22 +17,44 @@ const environment_options_1 = require("../../src/utilities/environment-options")
|
|
|
17
17
|
const log_file_1 = require("../../src/utilities/log-file");
|
|
18
18
|
var version_1 = require("../../src/utilities/version");
|
|
19
19
|
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
|
|
20
|
+
const MIN_NODEJS_VERISON = [14, 15];
|
|
20
21
|
/* eslint-disable no-console */
|
|
21
22
|
async function default_1(options) {
|
|
22
23
|
// This node version check ensures that the requirements of the project instance of the CLI are met
|
|
23
24
|
const [major, minor] = process.versions.node.split('.').map((part) => Number(part));
|
|
24
|
-
if (major <
|
|
25
|
+
if (major < MIN_NODEJS_VERISON[0] ||
|
|
26
|
+
(major === MIN_NODEJS_VERISON[0] && minor < MIN_NODEJS_VERISON[1])) {
|
|
25
27
|
process.stderr.write(`Node.js version ${process.version} detected.\n` +
|
|
26
|
-
|
|
28
|
+
`The Angular CLI requires a minimum of v${MIN_NODEJS_VERISON[0]}.${MIN_NODEJS_VERISON[1]}.\n\n` +
|
|
27
29
|
'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n');
|
|
28
30
|
return 3;
|
|
29
31
|
}
|
|
30
|
-
const
|
|
31
|
-
info: (s) =>
|
|
32
|
-
debug: (s) =>
|
|
33
|
-
warn: (s) =>
|
|
34
|
-
error: (s) =>
|
|
35
|
-
fatal: (s) =>
|
|
32
|
+
const colorLevels = {
|
|
33
|
+
info: (s) => s,
|
|
34
|
+
debug: (s) => s,
|
|
35
|
+
warn: (s) => color_1.colors.bold.yellow(s),
|
|
36
|
+
error: (s) => color_1.colors.bold.red(s),
|
|
37
|
+
fatal: (s) => color_1.colors.bold.red(s),
|
|
38
|
+
};
|
|
39
|
+
const logger = new core_1.logging.IndentLogger('cli-main-logger');
|
|
40
|
+
const logInfo = console.log;
|
|
41
|
+
const logError = console.error;
|
|
42
|
+
const loggerFinished = logger.forEach((entry) => {
|
|
43
|
+
if (!environment_options_1.ngDebug && entry.level === 'debug') {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const color = color_1.colors.enabled ? colorLevels[entry.level] : color_1.removeColor;
|
|
47
|
+
const message = color(entry.message);
|
|
48
|
+
switch (entry.level) {
|
|
49
|
+
case 'warn':
|
|
50
|
+
case 'fatal':
|
|
51
|
+
case 'error':
|
|
52
|
+
logError(message);
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
logInfo(message);
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
36
58
|
});
|
|
37
59
|
// Redirect console to logger
|
|
38
60
|
console.info = console.log = function (...args) {
|
|
@@ -77,5 +99,9 @@ async function default_1(options) {
|
|
|
77
99
|
}
|
|
78
100
|
return 1;
|
|
79
101
|
}
|
|
102
|
+
finally {
|
|
103
|
+
logger.complete();
|
|
104
|
+
await loggerFinished;
|
|
105
|
+
}
|
|
80
106
|
}
|
|
81
107
|
exports.default = default_1;
|
package/lib/init.js
CHANGED
|
@@ -39,6 +39,13 @@ const color_1 = require("../src/utilities/color");
|
|
|
39
39
|
const config_1 = require("../src/utilities/config");
|
|
40
40
|
const environment_options_1 = require("../src/utilities/environment-options");
|
|
41
41
|
const version_1 = require("../src/utilities/version");
|
|
42
|
+
/**
|
|
43
|
+
* Angular CLI versions prior to v14 may not exit correctly if not forcibly exited
|
|
44
|
+
* via `process.exit()`. When bootstrapping, `forceExit` will be set to `true`
|
|
45
|
+
* if the local CLI version is less than v14 to prevent the CLI from hanging on
|
|
46
|
+
* exit in those cases.
|
|
47
|
+
*/
|
|
48
|
+
let forceExit = false;
|
|
42
49
|
(async () => {
|
|
43
50
|
var _a;
|
|
44
51
|
/**
|
|
@@ -74,6 +81,10 @@ const version_1 = require("../src/utilities/version");
|
|
|
74
81
|
console.error('Version mismatch check skipped. Unable to retrieve local version: ' + error);
|
|
75
82
|
}
|
|
76
83
|
}
|
|
84
|
+
// Ensure older versions of the CLI fully exit
|
|
85
|
+
if ((0, semver_1.major)(localVersion) < 14) {
|
|
86
|
+
forceExit = true;
|
|
87
|
+
}
|
|
77
88
|
let isGlobalGreater = false;
|
|
78
89
|
try {
|
|
79
90
|
isGlobalGreater = !!localVersion && globalVersion.compare(localVersion) > 0;
|
|
@@ -82,10 +93,12 @@ const version_1 = require("../src/utilities/version");
|
|
|
82
93
|
// eslint-disable-next-line no-console
|
|
83
94
|
console.error('Version mismatch check skipped. Unable to compare local version: ' + error);
|
|
84
95
|
}
|
|
85
|
-
|
|
96
|
+
const rawCommandName = process.argv[2];
|
|
97
|
+
// When using the completion command, don't show the warning as otherwise this will break completion.
|
|
98
|
+
if (isGlobalGreater && rawCommandName !== 'completion') {
|
|
86
99
|
// If using the update command and the global version is greater, use the newer update command
|
|
87
100
|
// This allows improvements in update to be used in older versions that do not have bootstrapping
|
|
88
|
-
if (
|
|
101
|
+
if (rawCommandName === 'update' &&
|
|
89
102
|
cli.VERSION &&
|
|
90
103
|
cli.VERSION.major - globalVersion.major <= 1) {
|
|
91
104
|
cli = await Promise.resolve().then(() => __importStar(require('./cli')));
|
|
@@ -120,6 +133,9 @@ const version_1 = require("../src/utilities/version");
|
|
|
120
133
|
});
|
|
121
134
|
})
|
|
122
135
|
.then((exitCode) => {
|
|
136
|
+
if (forceExit) {
|
|
137
|
+
process.exit(exitCode);
|
|
138
|
+
}
|
|
123
139
|
process.exitCode = exitCode;
|
|
124
140
|
})
|
|
125
141
|
.catch((err) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.3",
|
|
4
4
|
"description": "CLI tool for Angular",
|
|
5
5
|
"main": "lib/cli/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/angular/angular-cli",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@angular-devkit/architect": "0.1400.
|
|
29
|
-
"@angular-devkit/core": "14.0.
|
|
30
|
-
"@angular-devkit/schematics": "14.0.
|
|
31
|
-
"@schematics/angular": "14.0.
|
|
28
|
+
"@angular-devkit/architect": "0.1400.3",
|
|
29
|
+
"@angular-devkit/core": "14.0.3",
|
|
30
|
+
"@angular-devkit/schematics": "14.0.3",
|
|
31
|
+
"@schematics/angular": "14.0.3",
|
|
32
32
|
"@yarnpkg/lockfile": "1.1.0",
|
|
33
33
|
"ansi-colors": "4.1.1",
|
|
34
34
|
"debug": "4.3.4",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"ng-update": {
|
|
50
50
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
51
51
|
"packageGroup": {
|
|
52
|
-
"@angular/cli": "14.0.
|
|
53
|
-
"@angular-devkit/architect": "0.1400.
|
|
54
|
-
"@angular-devkit/build-angular": "14.0.
|
|
55
|
-
"@angular-devkit/build-webpack": "0.1400.
|
|
56
|
-
"@angular-devkit/core": "14.0.
|
|
57
|
-
"@angular-devkit/schematics": "14.0.
|
|
52
|
+
"@angular/cli": "14.0.3",
|
|
53
|
+
"@angular-devkit/architect": "0.1400.3",
|
|
54
|
+
"@angular-devkit/build-angular": "14.0.3",
|
|
55
|
+
"@angular-devkit/build-webpack": "0.1400.3",
|
|
56
|
+
"@angular-devkit/core": "14.0.3",
|
|
57
|
+
"@angular-devkit/schematics": "14.0.3"
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
@@ -14,7 +14,7 @@ export interface MissingTargetChoice {
|
|
|
14
14
|
value: string;
|
|
15
15
|
}
|
|
16
16
|
export declare abstract class ArchitectBaseCommandModule<T extends object> extends CommandModule<T> implements CommandModuleImplementation<T> {
|
|
17
|
-
|
|
17
|
+
scope: CommandScope;
|
|
18
18
|
protected shouldReportAnalytics: boolean;
|
|
19
19
|
protected readonly missingTargetChoices: MissingTargetChoice[] | undefined;
|
|
20
20
|
protected runSingleTarget(target: Target, options: OtherOptions): Promise<number>;
|
|
@@ -22,6 +22,7 @@ const json_schema_1 = require("./utilities/json-schema");
|
|
|
22
22
|
class ArchitectBaseCommandModule extends command_module_1.CommandModule {
|
|
23
23
|
constructor() {
|
|
24
24
|
super(...arguments);
|
|
25
|
+
this.scope = command_module_1.CommandScope.In;
|
|
25
26
|
this.shouldReportAnalytics = false;
|
|
26
27
|
}
|
|
27
28
|
async runSingleTarget(target, options) {
|
|
@@ -104,7 +105,7 @@ class ArchitectBaseCommandModule extends command_module_1.CommandModule {
|
|
|
104
105
|
(0, fs_1.existsSync)((0, path_1.resolve)(basePath, '.pnp.mjs'))) {
|
|
105
106
|
return;
|
|
106
107
|
}
|
|
107
|
-
this.context.logger.warn(`Node packages may not be installed. Try installing with '${this.context.packageManager} install'.`);
|
|
108
|
+
this.context.logger.warn(`Node packages may not be installed. Try installing with '${this.context.packageManager.name} install'.`);
|
|
108
109
|
}
|
|
109
110
|
getArchitectTarget() {
|
|
110
111
|
return this.commandName;
|
|
@@ -162,4 +163,3 @@ class ArchitectBaseCommandModule extends command_module_1.CommandModule {
|
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
165
|
exports.ArchitectBaseCommandModule = ArchitectBaseCommandModule;
|
|
165
|
-
ArchitectBaseCommandModule.scope = command_module_1.CommandScope.In;
|
|
@@ -17,6 +17,7 @@ exports.ArchitectCommandModule = void 0;
|
|
|
17
17
|
const config_1 = require("../utilities/config");
|
|
18
18
|
const memoize_1 = require("../utilities/memoize");
|
|
19
19
|
const architect_base_command_module_1 = require("./architect-base-command-module");
|
|
20
|
+
const command_module_1 = require("./command-module");
|
|
20
21
|
class ArchitectCommandModule extends architect_base_command_module_1.ArchitectBaseCommandModule {
|
|
21
22
|
async builder(argv) {
|
|
22
23
|
const project = this.getArchitectProject();
|
|
@@ -73,13 +74,14 @@ class ArchitectCommandModule extends architect_base_command_module_1.ArchitectBa
|
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
getArchitectProject() {
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
return undefined;
|
|
79
|
-
}
|
|
80
|
-
const [, projectName] = this.context.args.positional;
|
|
77
|
+
const { options, positional } = this.context.args;
|
|
78
|
+
const [, projectName] = positional;
|
|
81
79
|
if (projectName) {
|
|
82
|
-
return
|
|
80
|
+
return projectName;
|
|
81
|
+
}
|
|
82
|
+
// Yargs allows positional args to be used as flags.
|
|
83
|
+
if (typeof options['project'] === 'string') {
|
|
84
|
+
return options['project'];
|
|
83
85
|
}
|
|
84
86
|
const target = this.getArchitectTarget();
|
|
85
87
|
const projectFromTarget = this.getProjectNamesByTarget(target);
|
|
@@ -105,8 +107,14 @@ class ArchitectCommandModule extends architect_base_command_module_1.ArchitectBa
|
|
|
105
107
|
return allProjectsForTargetName;
|
|
106
108
|
}
|
|
107
109
|
const maybeProject = (0, config_1.getProjectByCwd)(workspace);
|
|
108
|
-
if (maybeProject
|
|
109
|
-
return [maybeProject];
|
|
110
|
+
if (maybeProject) {
|
|
111
|
+
return allProjectsForTargetName.includes(maybeProject) ? [maybeProject] : undefined;
|
|
112
|
+
}
|
|
113
|
+
const { getYargsCompletions, help } = this.context.args.options;
|
|
114
|
+
if (!getYargsCompletions && !help) {
|
|
115
|
+
// Only issue the below error when not in help / completion mode.
|
|
116
|
+
throw new command_module_1.CommandModuleError('Cannot determine project for command. ' +
|
|
117
|
+
'Pass the project name as a command line argument or change the current working directory to a project directory.');
|
|
110
118
|
}
|
|
111
119
|
}
|
|
112
120
|
return undefined;
|
|
@@ -25,7 +25,7 @@ export interface CommandContext {
|
|
|
25
25
|
currentDirectory: string;
|
|
26
26
|
root: string;
|
|
27
27
|
workspace?: AngularWorkspace;
|
|
28
|
-
globalConfiguration
|
|
28
|
+
globalConfiguration: AngularWorkspace;
|
|
29
29
|
logger: logging.Logger;
|
|
30
30
|
packageManager: PackageManagerUtils;
|
|
31
31
|
/** Arguments parsed in free-from without parser configuration. */
|
|
@@ -40,6 +40,8 @@ export interface CommandContext {
|
|
|
40
40
|
}
|
|
41
41
|
export declare type OtherOptions = Record<string, unknown>;
|
|
42
42
|
export interface CommandModuleImplementation<T extends {} = {}> extends Omit<YargsCommandModule<{}, T>, 'builder' | 'handler'> {
|
|
43
|
+
/** Scope in which the command can be executed in. */
|
|
44
|
+
scope: CommandScope;
|
|
43
45
|
/** Path used to load the long description for the command in JSON help text. */
|
|
44
46
|
longDescriptionPath?: string;
|
|
45
47
|
/** Object declaring the options the command accepts, or a function accepting and returning a yargs instance. */
|
|
@@ -58,7 +60,7 @@ export declare abstract class CommandModule<T extends {} = {}> implements Comman
|
|
|
58
60
|
abstract readonly describe: string | false;
|
|
59
61
|
abstract readonly longDescriptionPath?: string;
|
|
60
62
|
protected readonly shouldReportAnalytics: boolean;
|
|
61
|
-
|
|
63
|
+
readonly scope: CommandScope;
|
|
62
64
|
private readonly optionsWithAnalytics;
|
|
63
65
|
constructor(context: CommandContext);
|
|
64
66
|
/**
|
|
@@ -57,6 +57,7 @@ class CommandModule {
|
|
|
57
57
|
constructor(context) {
|
|
58
58
|
this.context = context;
|
|
59
59
|
this.shouldReportAnalytics = true;
|
|
60
|
+
this.scope = CommandScope.Both;
|
|
60
61
|
this.optionsWithAnalytics = new Map();
|
|
61
62
|
}
|
|
62
63
|
/**
|
|
@@ -148,6 +149,7 @@ class CommandModule {
|
|
|
148
149
|
* **Note:** This method should be called from the command bundler method.
|
|
149
150
|
*/
|
|
150
151
|
addSchemaOptionsToCommand(localYargs, options) {
|
|
152
|
+
const booleanOptionsWithNoPrefix = new Set();
|
|
151
153
|
for (const option of options) {
|
|
152
154
|
const { default: defaultVal, positional, deprecated, description, alias, userAnalytics, type, hidden, name, choices, } = option;
|
|
153
155
|
const sharedOptions = {
|
|
@@ -159,14 +161,24 @@ class CommandModule {
|
|
|
159
161
|
// This should only be done when `--help` is used otherwise default will override options set in angular.json.
|
|
160
162
|
...(this.context.args.options.help ? { default: defaultVal } : {}),
|
|
161
163
|
};
|
|
164
|
+
// TODO(alanagius4): remove in a major version.
|
|
165
|
+
// the below is an interim workaround to handle options which have been defined in the schema with `no` prefix.
|
|
166
|
+
let dashedName = core_1.strings.dasherize(name);
|
|
167
|
+
if (type === 'boolean' && dashedName.startsWith('no-')) {
|
|
168
|
+
dashedName = dashedName.slice(3);
|
|
169
|
+
booleanOptionsWithNoPrefix.add(dashedName);
|
|
170
|
+
// eslint-disable-next-line no-console
|
|
171
|
+
console.warn(`Warning: '${name}' option has been declared with a 'no' prefix in the schema.` +
|
|
172
|
+
'Please file an issue with the author of this package.');
|
|
173
|
+
}
|
|
162
174
|
if (positional === undefined) {
|
|
163
|
-
localYargs = localYargs.option(
|
|
175
|
+
localYargs = localYargs.option(dashedName, {
|
|
164
176
|
type,
|
|
165
177
|
...sharedOptions,
|
|
166
178
|
});
|
|
167
179
|
}
|
|
168
180
|
else {
|
|
169
|
-
localYargs = localYargs.positional(
|
|
181
|
+
localYargs = localYargs.positional(dashedName, {
|
|
170
182
|
type: type === 'array' || type === 'count' ? 'string' : type,
|
|
171
183
|
...sharedOptions,
|
|
172
184
|
});
|
|
@@ -176,6 +188,18 @@ class CommandModule {
|
|
|
176
188
|
this.optionsWithAnalytics.set(name, userAnalytics);
|
|
177
189
|
}
|
|
178
190
|
}
|
|
191
|
+
// TODO(alanagius4): remove in a major version.
|
|
192
|
+
// the below is an interim workaround to handle options which have been defined in the schema with `no` prefix.
|
|
193
|
+
if (booleanOptionsWithNoPrefix.size) {
|
|
194
|
+
localYargs.middleware((options) => {
|
|
195
|
+
for (const key of booleanOptionsWithNoPrefix) {
|
|
196
|
+
if (key in options) {
|
|
197
|
+
options[`no-${key}`] = !options[key];
|
|
198
|
+
delete options[key];
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}, false);
|
|
202
|
+
}
|
|
179
203
|
return localYargs;
|
|
180
204
|
}
|
|
181
205
|
getWorkspaceOrThrow() {
|
|
@@ -186,7 +210,6 @@ class CommandModule {
|
|
|
186
210
|
return workspace;
|
|
187
211
|
}
|
|
188
212
|
}
|
|
189
|
-
CommandModule.scope = CommandScope.Both;
|
|
190
213
|
__decorate([
|
|
191
214
|
memoize_1.memoize
|
|
192
215
|
], CommandModule.prototype, "getAnalytics", null);
|
|
@@ -101,13 +101,6 @@ async function runCommand(args, logger) {
|
|
|
101
101
|
};
|
|
102
102
|
let localYargs = (0, yargs_1.default)(args);
|
|
103
103
|
for (const CommandModule of COMMANDS) {
|
|
104
|
-
if (!jsonHelp) {
|
|
105
|
-
// Skip scope validation when running with '--json-help' since it's easier to generate the output for all commands this way.
|
|
106
|
-
const scope = CommandModule.scope;
|
|
107
|
-
if ((scope === command_module_1.CommandScope.In && !workspace) || (scope === command_module_1.CommandScope.Out && workspace)) {
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
104
|
localYargs = (0, command_1.addCommandModuleToYargs)(localYargs, CommandModule, context);
|
|
112
105
|
}
|
|
113
106
|
if (jsonHelp) {
|
|
@@ -143,6 +136,7 @@ async function runCommand(args, logger) {
|
|
|
143
136
|
'deprecated: %s': color_1.colors.yellow('deprecated:') + ' %s',
|
|
144
137
|
'Did you mean %s?': 'Unknown command. Did you mean %s?',
|
|
145
138
|
})
|
|
139
|
+
.epilogue(color_1.colors.gray('For more information, see https://angular.io/cli/.\n'))
|
|
146
140
|
.demandCommand(1, command_1.demandCommandFailureMessage)
|
|
147
141
|
.recommendCommands()
|
|
148
142
|
.middleware(normalize_options_middleware_1.normalizeOptionsMiddleware)
|
|
@@ -21,7 +21,7 @@ export interface SchematicsExecutionOptions extends Options<SchematicsCommandArg
|
|
|
21
21
|
packageRegistry?: string;
|
|
22
22
|
}
|
|
23
23
|
export declare abstract class SchematicsCommandModule extends CommandModule<SchematicsCommandArgs> implements CommandModuleImplementation<SchematicsCommandArgs> {
|
|
24
|
-
|
|
24
|
+
scope: CommandScope;
|
|
25
25
|
protected readonly allowPrivateSchematics: boolean;
|
|
26
26
|
protected readonly shouldReportAnalytics = false;
|
|
27
27
|
builder(argv: Argv): Promise<Argv<SchematicsCommandArgs>>;
|
|
@@ -52,6 +52,7 @@ exports.DEFAULT_SCHEMATICS_COLLECTION = '@schematics/angular';
|
|
|
52
52
|
class SchematicsCommandModule extends command_module_1.CommandModule {
|
|
53
53
|
constructor() {
|
|
54
54
|
super(...arguments);
|
|
55
|
+
this.scope = command_module_1.CommandScope.In;
|
|
55
56
|
this.allowPrivateSchematics = false;
|
|
56
57
|
this.shouldReportAnalytics = false;
|
|
57
58
|
this.defaultProjectDeprecationWarningShown = false;
|
|
@@ -261,7 +262,7 @@ class SchematicsCommandModule extends command_module_1.CommandModule {
|
|
|
261
262
|
}
|
|
262
263
|
}
|
|
263
264
|
}
|
|
264
|
-
const value = (_a = getSchematicCollections(workspace === null || workspace === void 0 ? void 0 : workspace.getCli())) !== null && _a !== void 0 ? _a : getSchematicCollections(globalConfiguration
|
|
265
|
+
const value = (_a = getSchematicCollections(workspace === null || workspace === void 0 ? void 0 : workspace.getCli())) !== null && _a !== void 0 ? _a : getSchematicCollections(globalConfiguration.getCli());
|
|
265
266
|
if (value) {
|
|
266
267
|
return value;
|
|
267
268
|
}
|
|
@@ -349,7 +350,6 @@ class SchematicsCommandModule extends command_module_1.CommandModule {
|
|
|
349
350
|
[__dirname, process.cwd()];
|
|
350
351
|
}
|
|
351
352
|
}
|
|
352
|
-
SchematicsCommandModule.scope = command_module_1.CommandScope.In;
|
|
353
353
|
__decorate([
|
|
354
354
|
memoize_1.memoize
|
|
355
355
|
], SchematicsCommandModule.prototype, "getOrCreateWorkflowForBuilder", null);
|
|
@@ -8,10 +8,12 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.addCommandModuleToYargs = exports.demandCommandFailureMessage = void 0;
|
|
11
|
+
const command_module_1 = require("../command-module");
|
|
11
12
|
exports.demandCommandFailureMessage = `You need to specify a command before moving on. Use '--help' to view the available commands.`;
|
|
12
13
|
function addCommandModuleToYargs(localYargs, commandModule, context) {
|
|
13
14
|
const cmd = new commandModule(context);
|
|
14
|
-
const
|
|
15
|
+
const { args: { options: { jsonHelp }, }, workspace, } = context;
|
|
16
|
+
const describe = jsonHelp ? cmd.fullDescribe : cmd.describe;
|
|
15
17
|
return localYargs.command({
|
|
16
18
|
command: cmd.command,
|
|
17
19
|
aliases: cmd.aliases,
|
|
@@ -20,7 +22,16 @@ function addCommandModuleToYargs(localYargs, commandModule, context) {
|
|
|
20
22
|
// Therefore, we get around this by adding a complex object as a string which we later parse when generating the help files.
|
|
21
23
|
typeof describe === 'object' ? JSON.stringify(describe) : describe,
|
|
22
24
|
deprecated: cmd.deprecated,
|
|
23
|
-
builder: (argv) =>
|
|
25
|
+
builder: (argv) => {
|
|
26
|
+
// Skip scope validation when running with '--json-help' since it's easier to generate the output for all commands this way.
|
|
27
|
+
const isInvalidScope = !jsonHelp &&
|
|
28
|
+
((cmd.scope === command_module_1.CommandScope.In && !workspace) ||
|
|
29
|
+
(cmd.scope === command_module_1.CommandScope.Out && workspace));
|
|
30
|
+
if (isInvalidScope) {
|
|
31
|
+
throw new command_module_1.CommandModuleError(`This command is not available when running the Angular CLI ${workspace ? 'inside' : 'outside'} a workspace.`);
|
|
32
|
+
}
|
|
33
|
+
return cmd.builder(argv);
|
|
34
|
+
},
|
|
24
35
|
handler: (args) => cmd.handler(args),
|
|
25
36
|
});
|
|
26
37
|
}
|
|
@@ -11,7 +11,7 @@ export declare class CacheCleanModule extends CommandModule implements CommandMo
|
|
|
11
11
|
command: string;
|
|
12
12
|
describe: string;
|
|
13
13
|
longDescriptionPath: string | undefined;
|
|
14
|
-
|
|
14
|
+
scope: CommandScope;
|
|
15
15
|
builder(localYargs: Argv): Argv;
|
|
16
16
|
run(): Promise<void>;
|
|
17
17
|
}
|
|
@@ -16,6 +16,7 @@ class CacheCleanModule extends command_module_1.CommandModule {
|
|
|
16
16
|
super(...arguments);
|
|
17
17
|
this.command = 'clean';
|
|
18
18
|
this.describe = 'Deletes persistent disk cache from disk.';
|
|
19
|
+
this.scope = command_module_1.CommandScope.In;
|
|
19
20
|
}
|
|
20
21
|
builder(localYargs) {
|
|
21
22
|
return localYargs.strict();
|
|
@@ -11,7 +11,7 @@ export declare class CacheCommandModule extends CommandModule implements Command
|
|
|
11
11
|
command: string;
|
|
12
12
|
describe: string;
|
|
13
13
|
longDescriptionPath: string;
|
|
14
|
-
|
|
14
|
+
scope: CommandScope;
|
|
15
15
|
builder(localYargs: Argv): Argv;
|
|
16
16
|
run(_options: Options<{}>): void;
|
|
17
17
|
}
|
|
@@ -20,6 +20,7 @@ class CacheCommandModule extends command_module_1.CommandModule {
|
|
|
20
20
|
this.command = 'cache';
|
|
21
21
|
this.describe = 'Configure persistent disk cache and retrieve cache statistics.';
|
|
22
22
|
this.longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
|
23
|
+
this.scope = command_module_1.CommandScope.In;
|
|
23
24
|
}
|
|
24
25
|
builder(localYargs) {
|
|
25
26
|
const subcommands = [
|
|
@@ -11,7 +11,7 @@ export declare class CacheInfoCommandModule extends CommandModule implements Com
|
|
|
11
11
|
command: string;
|
|
12
12
|
describe: string;
|
|
13
13
|
longDescriptionPath?: string | undefined;
|
|
14
|
-
|
|
14
|
+
scope: CommandScope;
|
|
15
15
|
builder(localYargs: Argv): Argv;
|
|
16
16
|
run(): Promise<void>;
|
|
17
17
|
private getSizeOfDirectory;
|
|
@@ -19,6 +19,7 @@ class CacheInfoCommandModule extends command_module_1.CommandModule {
|
|
|
19
19
|
super(...arguments);
|
|
20
20
|
this.command = 'info';
|
|
21
21
|
this.describe = 'Prints persistent disk cache configuration and statistics in the console.';
|
|
22
|
+
this.scope = command_module_1.CommandScope.In;
|
|
22
23
|
}
|
|
23
24
|
builder(localYargs) {
|
|
24
25
|
return localYargs.strict();
|
|
@@ -12,7 +12,7 @@ export declare class CacheDisableModule extends CommandModule implements Command
|
|
|
12
12
|
aliases: string;
|
|
13
13
|
describe: string;
|
|
14
14
|
longDescriptionPath: string | undefined;
|
|
15
|
-
|
|
15
|
+
scope: CommandScope;
|
|
16
16
|
builder(localYargs: Argv): Argv;
|
|
17
17
|
run(): Promise<void>;
|
|
18
18
|
}
|
|
@@ -21,7 +21,7 @@ export declare class CacheEnableModule extends CommandModule implements CommandM
|
|
|
21
21
|
aliases: string;
|
|
22
22
|
describe: string;
|
|
23
23
|
longDescriptionPath: string | undefined;
|
|
24
|
-
|
|
24
|
+
scope: CommandScope;
|
|
25
25
|
builder(localYargs: Argv): Argv;
|
|
26
26
|
run(): Promise<void>;
|
|
27
27
|
}
|
|
@@ -16,6 +16,7 @@ class CacheDisableModule extends command_module_1.CommandModule {
|
|
|
16
16
|
this.command = 'disable';
|
|
17
17
|
this.aliases = 'off';
|
|
18
18
|
this.describe = 'Disables persistent disk cache for all projects in the workspace.';
|
|
19
|
+
this.scope = command_module_1.CommandScope.In;
|
|
19
20
|
}
|
|
20
21
|
builder(localYargs) {
|
|
21
22
|
return localYargs;
|
|
@@ -31,6 +32,7 @@ class CacheEnableModule extends command_module_1.CommandModule {
|
|
|
31
32
|
this.command = 'enable';
|
|
32
33
|
this.aliases = 'on';
|
|
33
34
|
this.describe = 'Enables disk cache for all projects in the workspace.';
|
|
35
|
+
this.scope = command_module_1.CommandScope.In;
|
|
34
36
|
}
|
|
35
37
|
builder(localYargs) {
|
|
36
38
|
return localYargs;
|
|
@@ -41,7 +41,7 @@ class ConfigCommandModule extends command_module_1.CommandModule {
|
|
|
41
41
|
}
|
|
42
42
|
async run(options) {
|
|
43
43
|
const level = options.global ? 'global' : 'local';
|
|
44
|
-
const [config] = (0, config_1.getWorkspaceRaw)(level);
|
|
44
|
+
const [config] = await (0, config_1.getWorkspaceRaw)(level);
|
|
45
45
|
if (options.value == undefined) {
|
|
46
46
|
if (!config) {
|
|
47
47
|
this.context.logger.error('No config found.');
|
|
@@ -90,7 +90,7 @@ class ConfigCommandModule extends command_module_1.CommandModule {
|
|
|
90
90
|
!validGlobalCliPaths.has(options.jsonPath)) {
|
|
91
91
|
throw new command_module_1.CommandModuleError('Invalid Path.');
|
|
92
92
|
}
|
|
93
|
-
const [config, configPath] = (0, config_1.getWorkspaceRaw)(options.global ? 'global' : 'local');
|
|
93
|
+
const [config, configPath] = await (0, config_1.getWorkspaceRaw)(options.global ? 'global' : 'local');
|
|
94
94
|
const { logger } = this.context;
|
|
95
95
|
if (!config || !configPath) {
|
|
96
96
|
throw new command_module_1.CommandModuleError('Confguration file cannot be found.');
|
|
@@ -19,10 +19,6 @@ class DeployCommandModule extends architect_command_module_1.ArchitectCommandMod
|
|
|
19
19
|
name: 'Amazon S3',
|
|
20
20
|
value: '@jefiozie/ngx-aws-deploy',
|
|
21
21
|
},
|
|
22
|
-
{
|
|
23
|
-
name: 'Azure',
|
|
24
|
-
value: '@azure/ng-deploy',
|
|
25
|
-
},
|
|
26
22
|
{
|
|
27
23
|
name: 'Firebase',
|
|
28
24
|
value: '@angular/fire',
|
|
@@ -13,7 +13,7 @@ interface NewCommandArgs extends SchematicsCommandArgs {
|
|
|
13
13
|
}
|
|
14
14
|
export declare class NewCommandModule extends SchematicsCommandModule implements CommandModuleImplementation<NewCommandArgs> {
|
|
15
15
|
private readonly schematicName;
|
|
16
|
-
|
|
16
|
+
scope: CommandScope;
|
|
17
17
|
protected allowPrivateSchematics: boolean;
|
|
18
18
|
command: string;
|
|
19
19
|
aliases: string;
|
package/src/commands/new/cli.js
CHANGED
|
@@ -15,6 +15,7 @@ class NewCommandModule extends schematics_command_module_1.SchematicsCommandModu
|
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
17
|
this.schematicName = 'ng-new';
|
|
18
|
+
this.scope = command_module_1.CommandScope.Out;
|
|
18
19
|
this.allowPrivateSchematics = true;
|
|
19
20
|
this.command = 'new [name]';
|
|
20
21
|
this.aliases = 'n';
|
|
@@ -79,4 +80,3 @@ class NewCommandModule extends schematics_command_module_1.SchematicsCommandModu
|
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
exports.NewCommandModule = NewCommandModule;
|
|
82
|
-
NewCommandModule.scope = command_module_1.CommandScope.Out;
|
|
@@ -13,7 +13,7 @@ export interface RunCommandArgs {
|
|
|
13
13
|
target: string;
|
|
14
14
|
}
|
|
15
15
|
export declare class RunCommandModule extends ArchitectBaseCommandModule<RunCommandArgs> implements CommandModuleImplementation<RunCommandArgs> {
|
|
16
|
-
|
|
16
|
+
scope: CommandScope;
|
|
17
17
|
command: string;
|
|
18
18
|
describe: string;
|
|
19
19
|
longDescriptionPath: string;
|
package/src/commands/run/cli.js
CHANGED
|
@@ -14,6 +14,7 @@ const command_module_1 = require("../../command-builder/command-module");
|
|
|
14
14
|
class RunCommandModule extends architect_base_command_module_1.ArchitectBaseCommandModule {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
|
+
this.scope = command_module_1.CommandScope.In;
|
|
17
18
|
this.command = 'run <target>';
|
|
18
19
|
this.describe = 'Runs an Architect target with an optional custom builder configuration defined in your project.';
|
|
19
20
|
this.longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
|
@@ -29,6 +30,16 @@ class RunCommandModule extends architect_base_command_module_1.ArchitectBaseComm
|
|
|
29
30
|
// Also, hide choices from JSON help so that we don't display them in AIO.
|
|
30
31
|
choices: (getYargsCompletions || help) && !jsonHelp ? this.getTargetChoices() : undefined,
|
|
31
32
|
})
|
|
33
|
+
.middleware((args) => {
|
|
34
|
+
// TODO: remove in version 15.
|
|
35
|
+
const { configuration, target } = args;
|
|
36
|
+
if (typeof configuration === 'string' && target) {
|
|
37
|
+
const targetWithConfig = target.split(':', 2);
|
|
38
|
+
targetWithConfig.push(configuration);
|
|
39
|
+
throw new command_module_1.CommandModuleError('Unknown argument: configuration.\n' +
|
|
40
|
+
`Provide the configuration as part of the target 'ng run ${targetWithConfig.join(':')}'.`);
|
|
41
|
+
}
|
|
42
|
+
}, true)
|
|
32
43
|
.strict();
|
|
33
44
|
const target = this.makeTargetSpecifier();
|
|
34
45
|
if (!target) {
|
|
@@ -80,4 +91,3 @@ class RunCommandModule extends architect_base_command_module_1.ArchitectBaseComm
|
|
|
80
91
|
}
|
|
81
92
|
}
|
|
82
93
|
exports.RunCommandModule = RunCommandModule;
|
|
83
|
-
RunCommandModule.scope = command_module_1.CommandScope.In;
|
|
@@ -20,7 +20,7 @@ interface UpdateCommandArgs {
|
|
|
20
20
|
'create-commits': boolean;
|
|
21
21
|
}
|
|
22
22
|
export declare class UpdateCommandModule extends CommandModule<UpdateCommandArgs> {
|
|
23
|
-
|
|
23
|
+
scope: CommandScope;
|
|
24
24
|
protected shouldReportAnalytics: boolean;
|
|
25
25
|
command: string;
|
|
26
26
|
describe: string;
|
|
@@ -58,6 +58,7 @@ const UPDATE_SCHEMATIC_COLLECTION = path.join(__dirname, 'schematic/collection.j
|
|
|
58
58
|
class UpdateCommandModule extends command_module_1.CommandModule {
|
|
59
59
|
constructor() {
|
|
60
60
|
super(...arguments);
|
|
61
|
+
this.scope = command_module_1.CommandScope.In;
|
|
61
62
|
this.shouldReportAnalytics = false;
|
|
62
63
|
this.command = 'update [packages..]';
|
|
63
64
|
this.describe = 'Updates your workspace and its dependencies. See https://update.angular.io/.';
|
|
@@ -510,7 +511,7 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
510
511
|
});
|
|
511
512
|
}
|
|
512
513
|
catch { }
|
|
513
|
-
let forceInstall =
|
|
514
|
+
let forceInstall = false;
|
|
514
515
|
// npm 7+ can fail due to it incorrectly resolving peer dependencies that have valid SemVer
|
|
515
516
|
// ranges during an update. Update will set correct versions of dependencies within the
|
|
516
517
|
// package.json file. The force option is set to workaround these errors.
|
|
@@ -740,7 +741,6 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
740
741
|
}
|
|
741
742
|
}
|
|
742
743
|
exports.UpdateCommandModule = UpdateCommandModule;
|
|
743
|
-
UpdateCommandModule.scope = command_module_1.CommandScope.In;
|
|
744
744
|
/**
|
|
745
745
|
* @return Whether or not the working directory has Git changes to commit.
|
|
746
746
|
*/
|
|
@@ -21,9 +21,16 @@ export declare class AngularWorkspace {
|
|
|
21
21
|
save(): Promise<void>;
|
|
22
22
|
static load(workspaceFilePath: string): Promise<AngularWorkspace>;
|
|
23
23
|
}
|
|
24
|
-
export declare function getWorkspace(level
|
|
25
|
-
export declare function
|
|
26
|
-
export declare function
|
|
24
|
+
export declare function getWorkspace(level: 'global'): Promise<AngularWorkspace>;
|
|
25
|
+
export declare function getWorkspace(level: 'local'): Promise<AngularWorkspace | undefined>;
|
|
26
|
+
export declare function getWorkspace(level: 'local' | 'global'): Promise<AngularWorkspace | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* This method will load the workspace configuration in raw JSON format.
|
|
29
|
+
* When `level` is `global` and file doesn't exists, it will be created.
|
|
30
|
+
*
|
|
31
|
+
* NB: This method is intended to be used only for `ng config`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getWorkspaceRaw(level?: 'local' | 'global'): Promise<[JSONFile | null, string | null]>;
|
|
27
34
|
export declare function validateWorkspace(data: json.JsonObject): Promise<void>;
|
|
28
35
|
export declare function getProjectByCwd(workspace: AngularWorkspace): string | null;
|
|
29
36
|
export declare function getConfiguredPackageManager(): Promise<PackageManager | null>;
|
package/src/utilities/config.js
CHANGED
|
@@ -30,7 +30,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.isWarningEnabled = exports.getSchematicDefaults = exports.getConfiguredPackageManager = exports.getProjectByCwd = exports.validateWorkspace = exports.getWorkspaceRaw = exports.
|
|
33
|
+
exports.isWarningEnabled = exports.getSchematicDefaults = exports.getConfiguredPackageManager = exports.getProjectByCwd = exports.validateWorkspace = exports.getWorkspaceRaw = exports.getWorkspace = exports.AngularWorkspace = exports.workspaceSchemaPath = void 0;
|
|
34
34
|
const core_1 = require("@angular-devkit/core");
|
|
35
35
|
const fs_1 = require("fs");
|
|
36
36
|
const os = __importStar(require("os"));
|
|
@@ -71,6 +71,7 @@ function createWorkspaceHost() {
|
|
|
71
71
|
exports.workspaceSchemaPath = path.join(__dirname, '../../lib/config/schema.json');
|
|
72
72
|
const configNames = ['angular.json', '.angular.json'];
|
|
73
73
|
const globalFileName = '.angular-config.json';
|
|
74
|
+
const defaultGlobalFilePath = path.join(os.homedir(), globalFileName);
|
|
74
75
|
function xdgConfigHome(home, configFile) {
|
|
75
76
|
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
|
76
77
|
const xdgConfigHome = process.env['XDG_CONFIG_HOME'] || path.join(home, '.config');
|
|
@@ -113,9 +114,8 @@ function globalFilePath() {
|
|
|
113
114
|
`Please move the file to the new location ~/.config/angular/config.json`);
|
|
114
115
|
return xdgConfigOld;
|
|
115
116
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return p;
|
|
117
|
+
if ((0, fs_1.existsSync)(defaultGlobalFilePath)) {
|
|
118
|
+
return defaultGlobalFilePath;
|
|
119
119
|
}
|
|
120
120
|
return null;
|
|
121
121
|
}
|
|
@@ -142,7 +142,7 @@ class AngularWorkspace {
|
|
|
142
142
|
return project === null || project === void 0 ? void 0 : project.extensions['cli'];
|
|
143
143
|
}
|
|
144
144
|
save() {
|
|
145
|
-
return core_1.workspaces.writeWorkspace(this.workspace, createWorkspaceHost(), this.filePath);
|
|
145
|
+
return core_1.workspaces.writeWorkspace(this.workspace, createWorkspaceHost(), this.filePath, core_1.workspaces.WorkspaceFormat.JSON);
|
|
146
146
|
}
|
|
147
147
|
static async load(workspaceFilePath) {
|
|
148
148
|
const result = await core_1.workspaces.readWorkspace(workspaceFilePath, createWorkspaceHost(), core_1.workspaces.WorkspaceFormat.JSON);
|
|
@@ -151,17 +151,21 @@ class AngularWorkspace {
|
|
|
151
151
|
}
|
|
152
152
|
exports.AngularWorkspace = AngularWorkspace;
|
|
153
153
|
const cachedWorkspaces = new Map();
|
|
154
|
-
async function getWorkspace(level
|
|
154
|
+
async function getWorkspace(level) {
|
|
155
155
|
if (cachedWorkspaces.has(level)) {
|
|
156
156
|
return cachedWorkspaces.get(level);
|
|
157
157
|
}
|
|
158
|
-
|
|
158
|
+
const configPath = level === 'local' ? projectFilePath() : globalFilePath();
|
|
159
159
|
if (!configPath) {
|
|
160
|
-
if (level === '
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
if (level === 'global') {
|
|
161
|
+
// Unlike a local config, a global config is not mandatory.
|
|
162
|
+
// So we create an empty one in memory and keep it as such until it has been modified and saved.
|
|
163
|
+
const globalWorkspace = new AngularWorkspace({ extensions: {}, projects: new core_1.workspaces.ProjectDefinitionCollection() }, defaultGlobalFilePath);
|
|
164
|
+
cachedWorkspaces.set(level, globalWorkspace);
|
|
165
|
+
return globalWorkspace;
|
|
163
166
|
}
|
|
164
|
-
|
|
167
|
+
cachedWorkspaces.set(level, undefined);
|
|
168
|
+
return undefined;
|
|
165
169
|
}
|
|
166
170
|
try {
|
|
167
171
|
const workspace = await AngularWorkspace.load(configPath);
|
|
@@ -174,21 +178,20 @@ async function getWorkspace(level = 'local') {
|
|
|
174
178
|
}
|
|
175
179
|
}
|
|
176
180
|
exports.getWorkspace = getWorkspace;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
return globalPath;
|
|
185
|
-
}
|
|
186
|
-
exports.createGlobalSettings = createGlobalSettings;
|
|
187
|
-
function getWorkspaceRaw(level = 'local') {
|
|
181
|
+
/**
|
|
182
|
+
* This method will load the workspace configuration in raw JSON format.
|
|
183
|
+
* When `level` is `global` and file doesn't exists, it will be created.
|
|
184
|
+
*
|
|
185
|
+
* NB: This method is intended to be used only for `ng config`.
|
|
186
|
+
*/
|
|
187
|
+
async function getWorkspaceRaw(level = 'local') {
|
|
188
188
|
let configPath = level === 'local' ? projectFilePath() : globalFilePath();
|
|
189
189
|
if (!configPath) {
|
|
190
190
|
if (level === 'global') {
|
|
191
|
-
configPath =
|
|
191
|
+
configPath = defaultGlobalFilePath;
|
|
192
|
+
// Config doesn't exist, force create it.
|
|
193
|
+
const globalWorkspace = await getWorkspace('global');
|
|
194
|
+
await globalWorkspace.save();
|
|
192
195
|
}
|
|
193
196
|
else {
|
|
194
197
|
return [null, null];
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { PackageManager } from '../../lib/config/workspace-schema';
|
|
9
9
|
import { AngularWorkspace } from './config';
|
|
10
10
|
export interface PackageManagerUtilsContext {
|
|
11
|
-
globalConfiguration
|
|
11
|
+
globalConfiguration: AngularWorkspace;
|
|
12
12
|
workspace?: AngularWorkspace;
|
|
13
13
|
root: string;
|
|
14
14
|
}
|
|
@@ -82,7 +82,7 @@ class PackageManagerUtils {
|
|
|
82
82
|
// clean up temp directory on process exit
|
|
83
83
|
process.on('exit', () => {
|
|
84
84
|
try {
|
|
85
|
-
(0, fs_1.
|
|
85
|
+
(0, fs_1.rmSync)(tempPath, { recursive: true, maxRetries: 3 });
|
|
86
86
|
}
|
|
87
87
|
catch { }
|
|
88
88
|
});
|
|
@@ -268,7 +268,7 @@ class PackageManagerUtils {
|
|
|
268
268
|
result !== null && result !== void 0 ? result : (result = getPackageManager(localWorkspace.extensions['cli']));
|
|
269
269
|
}
|
|
270
270
|
if (!result) {
|
|
271
|
-
result = getPackageManager(globalWorkspace
|
|
271
|
+
result = getPackageManager(globalWorkspace.extensions['cli']);
|
|
272
272
|
}
|
|
273
273
|
return result;
|
|
274
274
|
}
|