@yarnpkg/plugin-essentials 4.0.0-rc.9 → 4.0.1
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/commands/add.d.ts +1 -1
- package/lib/commands/add.js +34 -25
- package/lib/commands/bin.d.ts +1 -1
- package/lib/commands/bin.js +1 -1
- package/lib/commands/cache/clean.d.ts +1 -1
- package/lib/commands/cache/clean.js +1 -1
- package/lib/commands/config/get.d.ts +2 -1
- package/lib/commands/config/get.js +4 -1
- package/lib/commands/config/set.d.ts +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/unset.d.ts +1 -1
- package/lib/commands/config/unset.js +1 -1
- package/lib/commands/config.d.ts +5 -3
- package/lib/commands/config.js +96 -39
- package/lib/commands/dedupe.d.ts +1 -1
- package/lib/commands/dedupe.js +7 -8
- package/lib/commands/entries/clipanion.js +1 -1
- package/lib/commands/entries/help.js +1 -1
- package/lib/commands/entries/version.js +1 -1
- package/lib/commands/exec.js +1 -1
- package/lib/commands/explain/peerRequirements.d.ts +3 -3
- package/lib/commands/explain/peerRequirements.js +75 -106
- package/lib/commands/explain.js +1 -1
- package/lib/commands/info.js +10 -18
- package/lib/commands/install.d.ts +1 -1
- package/lib/commands/install.js +245 -205
- package/lib/commands/link.d.ts +2 -2
- package/lib/commands/link.js +36 -32
- package/lib/commands/node.js +1 -1
- package/lib/commands/plugin/check.d.ts +8 -0
- package/lib/commands/plugin/check.js +61 -0
- package/lib/commands/plugin/import/sources.d.ts +3 -3
- package/lib/commands/plugin/import/sources.js +5 -5
- package/lib/commands/plugin/import.d.ts +5 -4
- package/lib/commands/plugin/import.js +15 -28
- package/lib/commands/plugin/list.d.ts +2 -2
- package/lib/commands/plugin/list.js +5 -6
- package/lib/commands/plugin/remove.d.ts +1 -1
- package/lib/commands/plugin/remove.js +14 -13
- package/lib/commands/plugin/runtime.d.ts +2 -2
- package/lib/commands/plugin/runtime.js +4 -4
- package/lib/commands/rebuild.d.ts +2 -2
- package/lib/commands/rebuild.js +10 -10
- package/lib/commands/remove.d.ts +1 -1
- package/lib/commands/remove.js +7 -8
- package/lib/commands/run.js +1 -1
- package/lib/commands/runIndex.d.ts +2 -2
- package/lib/commands/runIndex.js +3 -3
- package/lib/commands/set/resolution.d.ts +1 -1
- package/lib/commands/set/resolution.js +4 -6
- package/lib/commands/set/version/sources.d.ts +3 -2
- package/lib/commands/set/version/sources.js +21 -12
- package/lib/commands/set/version.d.ts +2 -3
- package/lib/commands/set/version.js +20 -16
- package/lib/commands/unlink.d.ts +1 -1
- package/lib/commands/unlink.js +7 -8
- package/lib/commands/up.d.ts +3 -3
- package/lib/commands/up.js +19 -17
- package/lib/commands/why.js +5 -13
- package/lib/commands/workspace.js +2 -5
- package/lib/commands/workspaces/list.d.ts +2 -1
- package/lib/commands/workspaces/list.js +8 -1
- package/lib/dedupeUtils.d.ts +3 -3
- package/lib/dedupeUtils.js +3 -5
- package/lib/index.d.ts +76 -1
- package/lib/index.js +40 -1
- package/lib/suggestUtils.d.ts +4 -4
- package/lib/suggestUtils.js +14 -12
- package/package.json +22 -17
package/lib/commands/add.d.ts
CHANGED
package/lib/commands/add.js
CHANGED
|
@@ -54,7 +54,6 @@ class AddCommand extends cli_1.BaseCommand {
|
|
|
54
54
|
this.packages = clipanion_1.Option.Rest();
|
|
55
55
|
}
|
|
56
56
|
async execute() {
|
|
57
|
-
var _a;
|
|
58
57
|
const configuration = await core_1.Configuration.find(this.context.cwd, this.context.plugins);
|
|
59
58
|
const { project, workspace } = await core_2.Project.find(configuration, this.context.cwd);
|
|
60
59
|
const cache = await core_1.Cache.find(configuration);
|
|
@@ -64,7 +63,7 @@ class AddCommand extends cli_1.BaseCommand {
|
|
|
64
63
|
restoreResolutions: false,
|
|
65
64
|
});
|
|
66
65
|
const fixed = this.fixed;
|
|
67
|
-
const interactive =
|
|
66
|
+
const interactive = this.interactive ?? configuration.get(`preferInteractive`);
|
|
68
67
|
const reuse = interactive || configuration.get(`preferReuse`);
|
|
69
68
|
const modifier = suggestUtils.getModifier(this, project);
|
|
70
69
|
const strategies = [
|
|
@@ -86,24 +85,27 @@ class AddCommand extends cli_1.BaseCommand {
|
|
|
86
85
|
: core_3.structUtils.tryParseDescriptor(pseudoDescriptor);
|
|
87
86
|
const unsupportedPrefix = pseudoDescriptor.match(/^(https?:|git@github)/);
|
|
88
87
|
if (unsupportedPrefix)
|
|
89
|
-
throw new clipanion_1.UsageError(`It seems you are trying to add a package using a ${core_1.formatUtils.pretty(configuration, `${unsupportedPrefix[0]}...`, core_1.
|
|
88
|
+
throw new clipanion_1.UsageError(`It seems you are trying to add a package using a ${core_1.formatUtils.pretty(configuration, `${unsupportedPrefix[0]}...`, core_1.formatUtils.Type.RANGE)} url; we now require package names to be explicitly specified.\nTry running the command again with the package name prefixed: ${core_1.formatUtils.pretty(configuration, `yarn add`, core_1.formatUtils.Type.CODE)} ${core_1.formatUtils.pretty(configuration, core_3.structUtils.makeDescriptor(core_3.structUtils.makeIdent(null, `my-package`), `${unsupportedPrefix[0]}...`), core_1.formatUtils.Type.DESCRIPTOR)}`);
|
|
90
89
|
if (!request)
|
|
91
|
-
throw new clipanion_1.UsageError(`The ${core_1.formatUtils.pretty(configuration, pseudoDescriptor, core_1.
|
|
92
|
-
const
|
|
90
|
+
throw new clipanion_1.UsageError(`The ${core_1.formatUtils.pretty(configuration, pseudoDescriptor, core_1.formatUtils.Type.CODE)} string didn't match the required format (package-name@range). Did you perhaps forget to explicitly reference the package name?`);
|
|
91
|
+
const targetList = suggestTargetList(workspace, request, {
|
|
93
92
|
dev: this.dev,
|
|
94
93
|
peer: this.peer,
|
|
95
94
|
preferDev: this.preferDev,
|
|
96
95
|
optional: this.optional,
|
|
97
96
|
});
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
const results = await Promise.all(targetList.map(async (target) => {
|
|
98
|
+
const suggestedDescriptors = await suggestUtils.getSuggestedDescriptors(request, { project, workspace, cache, fixed, target, modifier, strategies, maxResults });
|
|
99
|
+
return { request, suggestedDescriptors, target };
|
|
100
|
+
}));
|
|
101
|
+
return results;
|
|
102
|
+
})).then(results => results.flat());
|
|
101
103
|
const checkReport = await core_1.LightReport.start({
|
|
102
104
|
configuration,
|
|
103
105
|
stdout: this.context.stdout,
|
|
104
106
|
suggestInstall: false,
|
|
105
107
|
}, async (report) => {
|
|
106
|
-
for (const
|
|
108
|
+
for (const { request, suggestedDescriptors: { suggestions, rejections } } of allSuggestions) {
|
|
107
109
|
const nonNullSuggestions = suggestions.filter(suggestion => {
|
|
108
110
|
return suggestion.descriptor !== null;
|
|
109
111
|
});
|
|
@@ -125,7 +127,7 @@ class AddCommand extends cli_1.BaseCommand {
|
|
|
125
127
|
let askedQuestions = false;
|
|
126
128
|
const afterWorkspaceDependencyAdditionList = [];
|
|
127
129
|
const afterWorkspaceDependencyReplacementList = [];
|
|
128
|
-
for (const
|
|
130
|
+
for (const { suggestedDescriptors: { suggestions }, target } of allSuggestions) {
|
|
129
131
|
let selected;
|
|
130
132
|
const nonNullSuggestions = suggestions.filter(suggestion => {
|
|
131
133
|
return suggestion.descriptor !== null;
|
|
@@ -198,18 +200,16 @@ class AddCommand extends cli_1.BaseCommand {
|
|
|
198
200
|
await configuration.triggerMultipleHooks((hooks) => hooks.afterWorkspaceDependencyReplacement, afterWorkspaceDependencyReplacementList);
|
|
199
201
|
if (askedQuestions)
|
|
200
202
|
this.context.stdout.write(`\n`);
|
|
201
|
-
|
|
202
|
-
configuration,
|
|
203
|
+
return await project.installWithNewReport({
|
|
203
204
|
json: this.json,
|
|
204
205
|
stdout: this.context.stdout,
|
|
205
|
-
|
|
206
|
-
},
|
|
207
|
-
|
|
206
|
+
quiet: this.context.quiet,
|
|
207
|
+
}, {
|
|
208
|
+
cache,
|
|
209
|
+
mode: this.mode,
|
|
208
210
|
});
|
|
209
|
-
return installReport.exitCode();
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
|
-
exports.default = AddCommand;
|
|
213
213
|
AddCommand.paths = [
|
|
214
214
|
[`add`],
|
|
215
215
|
];
|
|
@@ -236,7 +236,7 @@ AddCommand.usage = clipanion_1.Command.Usage({
|
|
|
236
236
|
|
|
237
237
|
If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
|
|
238
238
|
|
|
239
|
-
- \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the
|
|
239
|
+
- \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.
|
|
240
240
|
|
|
241
241
|
- \`update-lockfile\` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.
|
|
242
242
|
|
|
@@ -262,7 +262,8 @@ AddCommand.usage = clipanion_1.Command.Usage({
|
|
|
262
262
|
`$0 add lodash-es@lodash/lodash#es`,
|
|
263
263
|
]],
|
|
264
264
|
});
|
|
265
|
-
|
|
265
|
+
exports.default = AddCommand;
|
|
266
|
+
function suggestTargetList(workspace, ident, { dev, peer, preferDev, optional }) {
|
|
266
267
|
const hasRegular = workspace.manifest[suggestUtils.Target.REGULAR].has(ident.identHash);
|
|
267
268
|
const hasDev = workspace.manifest[suggestUtils.Target.DEVELOPMENT].has(ident.identHash);
|
|
268
269
|
const hasPeer = workspace.manifest[suggestUtils.Target.PEER].has(ident.identHash);
|
|
@@ -276,13 +277,21 @@ function suggestTarget(workspace, ident, { dev, peer, preferDev, optional }) {
|
|
|
276
277
|
throw new clipanion_1.UsageError(`Package "${core_3.structUtils.prettyIdent(workspace.project.configuration, ident)}" is already listed as a peer dependency - remove the -O flag or add the -P flag or remove it from your peer dependencies first`);
|
|
277
278
|
if ((dev || preferDev) && optional)
|
|
278
279
|
throw new clipanion_1.UsageError(`Package "${core_3.structUtils.prettyIdent(workspace.project.configuration, ident)}" cannot simultaneously be a dev dependency and an optional dependency`);
|
|
280
|
+
// When the program executes this line, the command is expected to be legal
|
|
281
|
+
const targetList = [];
|
|
279
282
|
if (peer)
|
|
280
|
-
|
|
283
|
+
targetList.push(suggestUtils.Target.PEER);
|
|
281
284
|
if (dev || preferDev)
|
|
282
|
-
|
|
283
|
-
if (
|
|
284
|
-
|
|
285
|
+
targetList.push(suggestUtils.Target.DEVELOPMENT);
|
|
286
|
+
if (optional)
|
|
287
|
+
targetList.push(suggestUtils.Target.REGULAR);
|
|
288
|
+
// The user explicitly define the targets
|
|
289
|
+
if (targetList.length > 0)
|
|
290
|
+
return targetList;
|
|
291
|
+
// The user does not define the targets, find it from the `workspace.manifest`
|
|
285
292
|
if (hasDev)
|
|
286
|
-
return suggestUtils.Target.DEVELOPMENT;
|
|
287
|
-
|
|
293
|
+
return [suggestUtils.Target.DEVELOPMENT];
|
|
294
|
+
if (hasPeer)
|
|
295
|
+
return [suggestUtils.Target.PEER];
|
|
296
|
+
return [suggestUtils.Target.REGULAR];
|
|
288
297
|
}
|
package/lib/commands/bin.d.ts
CHANGED
package/lib/commands/bin.js
CHANGED
|
@@ -58,7 +58,6 @@ class BinCommand extends cli_1.BaseCommand {
|
|
|
58
58
|
return report.exitCode();
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
exports.default = BinCommand;
|
|
62
61
|
BinCommand.paths = [
|
|
63
62
|
[`bin`],
|
|
64
63
|
];
|
|
@@ -77,3 +76,4 @@ BinCommand.usage = clipanion_1.Command.Usage({
|
|
|
77
76
|
`$0 bin eslint`,
|
|
78
77
|
]],
|
|
79
78
|
});
|
|
79
|
+
exports.default = BinCommand;
|
|
@@ -35,7 +35,6 @@ class CacheCleanCommand extends cli_1.BaseCommand {
|
|
|
35
35
|
return report.exitCode();
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
exports.default = CacheCleanCommand;
|
|
39
38
|
CacheCleanCommand.paths = [
|
|
40
39
|
[`cache`, `clean`],
|
|
41
40
|
[`cache`, `clear`],
|
|
@@ -53,3 +52,4 @@ CacheCleanCommand.usage = clipanion_1.Command.Usage({
|
|
|
53
52
|
`$0 cache clean --mirror`,
|
|
54
53
|
]],
|
|
55
54
|
});
|
|
55
|
+
exports.default = CacheCleanCommand;
|
|
@@ -3,8 +3,9 @@ import { Usage } from 'clipanion';
|
|
|
3
3
|
export default class ConfigGetCommand extends BaseCommand {
|
|
4
4
|
static paths: string[][];
|
|
5
5
|
static usage: Usage;
|
|
6
|
+
why: boolean;
|
|
6
7
|
json: boolean;
|
|
7
8
|
unsafe: boolean;
|
|
8
9
|
name: string;
|
|
9
|
-
execute(): Promise<
|
|
10
|
+
execute(): Promise<0 | 1>;
|
|
10
11
|
}
|
|
@@ -10,6 +10,9 @@ const util_1 = require("util");
|
|
|
10
10
|
class ConfigGetCommand extends cli_1.BaseCommand {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
|
+
this.why = clipanion_1.Option.Boolean(`--why`, false, {
|
|
14
|
+
description: `Print the explanation for why a setting has its value`,
|
|
15
|
+
});
|
|
13
16
|
this.json = clipanion_1.Option.Boolean(`--json`, false, {
|
|
14
17
|
description: `Format the output as an NDJSON stream`,
|
|
15
18
|
});
|
|
@@ -57,7 +60,6 @@ class ConfigGetCommand extends cli_1.BaseCommand {
|
|
|
57
60
|
return report.exitCode();
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
|
-
exports.default = ConfigGetCommand;
|
|
61
63
|
ConfigGetCommand.paths = [
|
|
62
64
|
[`config`, `get`],
|
|
63
65
|
];
|
|
@@ -85,3 +87,4 @@ ConfigGetCommand.usage = clipanion_1.Command.Usage({
|
|
|
85
87
|
`yarn config get packageExtensions --json`,
|
|
86
88
|
]],
|
|
87
89
|
});
|
|
90
|
+
exports.default = ConfigGetCommand;
|
|
@@ -79,7 +79,6 @@ class ConfigSetCommand extends cli_1.BaseCommand {
|
|
|
79
79
|
return report.exitCode();
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
exports.default = ConfigSetCommand;
|
|
83
82
|
ConfigSetCommand.paths = [
|
|
84
83
|
[`config`, `set`],
|
|
85
84
|
];
|
|
@@ -112,3 +111,4 @@ ConfigSetCommand.usage = clipanion_1.Command.Usage({
|
|
|
112
111
|
`yarn config set 'npmRegistries["//npm.example.com"].npmAuthToken' "ffffffff-ffff-ffff-ffff-ffffffffffff"`,
|
|
113
112
|
]],
|
|
114
113
|
});
|
|
114
|
+
exports.default = ConfigSetCommand;
|
|
@@ -57,7 +57,6 @@ class ConfigUnsetCommand extends cli_1.BaseCommand {
|
|
|
57
57
|
return report.exitCode();
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
exports.default = ConfigUnsetCommand;
|
|
61
60
|
ConfigUnsetCommand.paths = [
|
|
62
61
|
[`config`, `unset`],
|
|
63
62
|
];
|
|
@@ -77,3 +76,4 @@ ConfigUnsetCommand.usage = clipanion_1.Command.Usage({
|
|
|
77
76
|
`yarn config unset npmScopes.company.npmRegistryServer`,
|
|
78
77
|
]],
|
|
79
78
|
});
|
|
79
|
+
exports.default = ConfigUnsetCommand;
|
package/lib/commands/config.d.ts
CHANGED
|
@@ -3,8 +3,10 @@ import { Usage } from 'clipanion';
|
|
|
3
3
|
export default class ConfigCommand extends BaseCommand {
|
|
4
4
|
static paths: string[][];
|
|
5
5
|
static usage: Usage;
|
|
6
|
-
|
|
7
|
-
why: boolean;
|
|
6
|
+
noDefaults: boolean;
|
|
8
7
|
json: boolean;
|
|
9
|
-
|
|
8
|
+
verbose: boolean | undefined;
|
|
9
|
+
why: boolean | undefined;
|
|
10
|
+
names: string[];
|
|
11
|
+
execute(): Promise<0 | 1>;
|
|
10
12
|
}
|
package/lib/commands/config.js
CHANGED
|
@@ -2,31 +2,50 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const cli_1 = require("@yarnpkg/cli");
|
|
4
4
|
const core_1 = require("@yarnpkg/core");
|
|
5
|
-
const
|
|
5
|
+
const fslib_1 = require("@yarnpkg/fslib");
|
|
6
6
|
const clipanion_1 = require("clipanion");
|
|
7
7
|
const util_1 = require("util");
|
|
8
8
|
// eslint-disable-next-line arca/no-default-export
|
|
9
9
|
class ConfigCommand extends cli_1.BaseCommand {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
|
-
this.
|
|
13
|
-
description: `
|
|
14
|
-
});
|
|
15
|
-
this.why = clipanion_1.Option.Boolean(`--why`, false, {
|
|
16
|
-
description: `Print the reason why a setting is set a particular way`,
|
|
12
|
+
this.noDefaults = clipanion_1.Option.Boolean(`--no-defaults`, false, {
|
|
13
|
+
description: `Omit the default values from the display`,
|
|
17
14
|
});
|
|
18
15
|
this.json = clipanion_1.Option.Boolean(`--json`, false, {
|
|
19
16
|
description: `Format the output as an NDJSON stream`,
|
|
20
17
|
});
|
|
18
|
+
// Legacy flags; will emit errors or warnings when used
|
|
19
|
+
this.verbose = clipanion_1.Option.Boolean(`-v,--verbose`, { hidden: true });
|
|
20
|
+
this.why = clipanion_1.Option.Boolean(`--why`, { hidden: true });
|
|
21
|
+
this.names = clipanion_1.Option.Rest();
|
|
21
22
|
}
|
|
22
23
|
async execute() {
|
|
23
24
|
const configuration = await core_1.Configuration.find(this.context.cwd, this.context.plugins, {
|
|
24
25
|
strict: false,
|
|
25
26
|
});
|
|
27
|
+
const deprecationExitCode = await (0, core_1.reportOptionDeprecations)({
|
|
28
|
+
configuration,
|
|
29
|
+
stdout: this.context.stdout,
|
|
30
|
+
forceError: this.json,
|
|
31
|
+
}, [{
|
|
32
|
+
option: this.verbose,
|
|
33
|
+
message: `The --verbose option is deprecated, the settings' descriptions are now always displayed`,
|
|
34
|
+
}, {
|
|
35
|
+
option: this.why,
|
|
36
|
+
message: `The --why option is deprecated, the settings' sources are now always displayed`,
|
|
37
|
+
}]);
|
|
38
|
+
if (deprecationExitCode !== null)
|
|
39
|
+
return deprecationExitCode;
|
|
40
|
+
const names = this.names.length > 0
|
|
41
|
+
? [...new Set(this.names)].sort()
|
|
42
|
+
: [...configuration.settings.keys()].sort();
|
|
43
|
+
let trailingValue;
|
|
26
44
|
const report = await core_1.StreamReport.start({
|
|
27
45
|
configuration,
|
|
28
46
|
json: this.json,
|
|
29
47
|
stdout: this.context.stdout,
|
|
48
|
+
includeFooter: false,
|
|
30
49
|
}, async (report) => {
|
|
31
50
|
if (configuration.invalid.size > 0 && !this.json) {
|
|
32
51
|
for (const [key, source] of configuration.invalid)
|
|
@@ -34,58 +53,95 @@ class ConfigCommand extends cli_1.BaseCommand {
|
|
|
34
53
|
report.reportSeparator();
|
|
35
54
|
}
|
|
36
55
|
if (this.json) {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
56
|
+
for (const name of names) {
|
|
57
|
+
const data = configuration.settings.get(name);
|
|
58
|
+
if (typeof data === `undefined`)
|
|
59
|
+
report.reportError(core_1.MessageName.INVALID_CONFIGURATION_KEY, `No configuration key named "${name}"`);
|
|
60
|
+
const effective = configuration.getSpecial(name, {
|
|
41
61
|
hideSecrets: true,
|
|
42
62
|
getNativePaths: true,
|
|
43
63
|
});
|
|
44
|
-
const source = configuration.sources.get(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
report.reportJson({ key, effective, source, ...data });
|
|
50
|
-
}
|
|
64
|
+
const source = configuration.sources.get(name) ?? `<default>`;
|
|
65
|
+
const sourceAsNativePath = source && source[0] !== `<`
|
|
66
|
+
? fslib_1.npath.fromPortablePath(source)
|
|
67
|
+
: source;
|
|
68
|
+
report.reportJson({ key: name, effective, source: sourceAsNativePath, ...data });
|
|
51
69
|
}
|
|
52
70
|
}
|
|
53
71
|
else {
|
|
54
|
-
const keys = core_2.miscUtils.sortMap(configuration.settings.keys(), key => key);
|
|
55
|
-
const maxKeyLength = keys.reduce((max, key) => Math.max(max, key.length), 0);
|
|
56
72
|
const inspectConfig = {
|
|
57
73
|
breakLength: Infinity,
|
|
58
74
|
colors: configuration.get(`enableColors`),
|
|
59
75
|
maxArrayLength: 2,
|
|
60
76
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
const configTreeChildren = {};
|
|
78
|
+
const configTree = { children: configTreeChildren };
|
|
79
|
+
for (const name of names) {
|
|
80
|
+
if (this.noDefaults && !configuration.sources.has(name))
|
|
81
|
+
continue;
|
|
82
|
+
const setting = configuration.settings.get(name);
|
|
83
|
+
const source = configuration.sources.get(name) ?? `<default>`;
|
|
84
|
+
const value = configuration.getSpecial(name, { hideSecrets: true, getNativePaths: true });
|
|
85
|
+
const fields = {
|
|
86
|
+
Description: {
|
|
87
|
+
label: `Description`,
|
|
88
|
+
value: core_1.formatUtils.tuple(core_1.formatUtils.Type.MARKDOWN, { text: setting.description, format: this.cli.format(), paragraphs: false }),
|
|
89
|
+
},
|
|
90
|
+
Source: {
|
|
91
|
+
label: `Source`,
|
|
92
|
+
value: core_1.formatUtils.tuple(source[0] === `<` ? core_1.formatUtils.Type.CODE : core_1.formatUtils.Type.PATH, source),
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
configTreeChildren[name] = {
|
|
96
|
+
value: core_1.formatUtils.tuple(core_1.formatUtils.Type.CODE, name),
|
|
97
|
+
children: fields,
|
|
98
|
+
};
|
|
99
|
+
const setValueTo = (node, value) => {
|
|
100
|
+
for (const [key, subValue] of value) {
|
|
101
|
+
if (subValue instanceof Map) {
|
|
102
|
+
const subFields = {};
|
|
103
|
+
node[key] = { children: subFields };
|
|
104
|
+
setValueTo(subFields, subValue);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
node[key] = {
|
|
108
|
+
label: key,
|
|
109
|
+
value: core_1.formatUtils.tuple(core_1.formatUtils.Type.NO_HINT, (0, util_1.inspect)(subValue, inspectConfig)),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
if (value instanceof Map) {
|
|
115
|
+
setValueTo(fields, value);
|
|
76
116
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
117
|
+
else {
|
|
118
|
+
fields.Value = {
|
|
119
|
+
label: `Value`,
|
|
120
|
+
value: core_1.formatUtils.tuple(core_1.formatUtils.Type.NO_HINT, (0, util_1.inspect)(value, inspectConfig)),
|
|
121
|
+
};
|
|
81
122
|
}
|
|
82
123
|
}
|
|
124
|
+
if (names.length !== 1)
|
|
125
|
+
trailingValue = undefined;
|
|
126
|
+
core_1.treeUtils.emitTree(configTree, {
|
|
127
|
+
configuration,
|
|
128
|
+
json: this.json,
|
|
129
|
+
stdout: this.context.stdout,
|
|
130
|
+
separators: 2,
|
|
131
|
+
});
|
|
83
132
|
}
|
|
84
133
|
});
|
|
134
|
+
if (!this.json && typeof trailingValue !== `undefined`) {
|
|
135
|
+
const name = names[0];
|
|
136
|
+
const value = (0, util_1.inspect)(configuration.getSpecial(name, { hideSecrets: true, getNativePaths: true }), {
|
|
137
|
+
colors: configuration.get(`enableColors`),
|
|
138
|
+
});
|
|
139
|
+
this.context.stdout.write(`\n`);
|
|
140
|
+
this.context.stdout.write(`${value}\n`);
|
|
141
|
+
}
|
|
85
142
|
return report.exitCode();
|
|
86
143
|
}
|
|
87
144
|
}
|
|
88
|
-
exports.default = ConfigCommand;
|
|
89
145
|
ConfigCommand.paths = [
|
|
90
146
|
[`config`],
|
|
91
147
|
];
|
|
@@ -99,3 +155,4 @@ ConfigCommand.usage = clipanion_1.Command.Usage({
|
|
|
99
155
|
`$0 config`,
|
|
100
156
|
]],
|
|
101
157
|
});
|
|
158
|
+
exports.default = ConfigCommand;
|
package/lib/commands/dedupe.d.ts
CHANGED
package/lib/commands/dedupe.js
CHANGED
|
@@ -61,18 +61,16 @@ class DedupeCommand extends cli_1.BaseCommand {
|
|
|
61
61
|
return dedupedPackageCount ? 1 : 0;
|
|
62
62
|
}
|
|
63
63
|
else {
|
|
64
|
-
|
|
65
|
-
configuration,
|
|
66
|
-
stdout: this.context.stdout,
|
|
64
|
+
return await project.installWithNewReport({
|
|
67
65
|
json: this.json,
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
stdout: this.context.stdout,
|
|
67
|
+
}, {
|
|
68
|
+
cache,
|
|
69
|
+
mode: this.mode,
|
|
70
70
|
});
|
|
71
|
-
return installReport.exitCode();
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
|
-
exports.default = DedupeCommand;
|
|
76
74
|
DedupeCommand.paths = [
|
|
77
75
|
[`dedupe`],
|
|
78
76
|
];
|
|
@@ -91,7 +89,7 @@ DedupeCommand.usage = clipanion_1.Command.Usage({
|
|
|
91
89
|
|
|
92
90
|
If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
|
|
93
91
|
|
|
94
|
-
- \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the
|
|
92
|
+
- \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.
|
|
95
93
|
|
|
96
94
|
- \`update-lockfile\` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.
|
|
97
95
|
|
|
@@ -124,3 +122,4 @@ DedupeCommand.usage = clipanion_1.Command.Usage({
|
|
|
124
122
|
`$0 dedupe --check`,
|
|
125
123
|
]],
|
|
126
124
|
});
|
|
125
|
+
exports.default = DedupeCommand;
|
|
@@ -33,7 +33,7 @@ class ClipanionCommand extends cli_1.BaseCommand {
|
|
|
33
33
|
this.context.stdout.write(`${JSON.stringify(clipanionDefinitions, null, 2)}\n`);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
exports.default = ClipanionCommand;
|
|
37
36
|
ClipanionCommand.paths = [
|
|
38
37
|
[`--clipanion=definitions`],
|
|
39
38
|
];
|
|
39
|
+
exports.default = ClipanionCommand;
|
|
@@ -8,8 +8,8 @@ class VersionCommand extends cli_1.BaseCommand {
|
|
|
8
8
|
this.context.stdout.write(`${core_1.YarnVersion || `<unknown>`}\n`);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
exports.default = VersionCommand;
|
|
12
11
|
VersionCommand.paths = [
|
|
13
12
|
[`-v`],
|
|
14
13
|
[`--version`],
|
|
15
14
|
];
|
|
15
|
+
exports.default = VersionCommand;
|
package/lib/commands/exec.js
CHANGED
|
@@ -24,7 +24,6 @@ class ExecCommand extends cli_1.BaseCommand {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
exports.default = ExecCommand;
|
|
28
27
|
ExecCommand.paths = [
|
|
29
28
|
[`exec`],
|
|
30
29
|
];
|
|
@@ -43,3 +42,4 @@ ExecCommand.usage = clipanion_1.Command.Usage({
|
|
|
43
42
|
`$0 exec "tsc & babel src --out-dir lib"`,
|
|
44
43
|
]],
|
|
45
44
|
});
|
|
45
|
+
exports.default = ExecCommand;
|
|
@@ -5,9 +5,9 @@ import { Writable } from 'stream';
|
|
|
5
5
|
export default class ExplainPeerRequirementsCommand extends BaseCommand {
|
|
6
6
|
static paths: string[][];
|
|
7
7
|
static usage: import("clipanion").Usage;
|
|
8
|
-
hash: string
|
|
9
|
-
execute(): Promise<
|
|
8
|
+
hash: string;
|
|
9
|
+
execute(): Promise<0 | 1>;
|
|
10
10
|
}
|
|
11
11
|
export declare function explainPeerRequirements(peerRequirementsHash: string, project: Project, opts: {
|
|
12
12
|
stdout: Writable;
|
|
13
|
-
}): Promise<
|
|
13
|
+
}): Promise<0 | 1>;
|