@yarnpkg/plugin-essentials 3.0.0-rc.9 → 3.1.0-rc.10
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 +5 -2
- package/lib/commands/add.js +16 -4
- package/lib/commands/bin.d.ts +1 -1
- package/lib/commands/cache/clean.d.ts +1 -1
- package/lib/commands/config/get.d.ts +1 -1
- package/lib/commands/config/get.js +3 -3
- package/lib/commands/config/set.d.ts +1 -1
- package/lib/commands/config/set.js +9 -7
- package/lib/commands/config/unset.d.ts +1 -1
- package/lib/commands/config/unset.js +6 -6
- package/lib/commands/config.d.ts +1 -1
- package/lib/commands/config.js +2 -2
- package/lib/commands/dedupe.d.ts +3 -1
- package/lib/commands/dedupe.js +13 -3
- package/lib/commands/entries/clipanion.d.ts +2 -3
- package/lib/commands/entries/clipanion.js +3 -4
- package/lib/commands/entries/help.d.ts +2 -3
- package/lib/commands/entries/help.js +2 -2
- package/lib/commands/entries/run.d.ts +2 -3
- package/lib/commands/entries/run.js +2 -1
- package/lib/commands/entries/version.d.ts +2 -3
- package/lib/commands/entries/version.js +2 -2
- package/lib/commands/exec.js +7 -10
- package/lib/commands/explain/peerRequirements.d.ts +2 -2
- package/lib/commands/explain/peerRequirements.js +1 -1
- package/lib/commands/info.js +2 -2
- package/lib/commands/install.d.ts +4 -2
- package/lib/commands/install.js +24 -17
- package/lib/commands/link.d.ts +1 -1
- package/lib/commands/plugin/import/sources.d.ts +1 -1
- package/lib/commands/plugin/import/sources.js +5 -5
- package/lib/commands/plugin/import.d.ts +1 -1
- package/lib/commands/plugin/import.js +5 -5
- package/lib/commands/plugin/list.d.ts +1 -1
- package/lib/commands/plugin/list.js +1 -1
- package/lib/commands/plugin/remove.d.ts +1 -1
- package/lib/commands/plugin/runtime.d.ts +1 -1
- package/lib/commands/rebuild.d.ts +1 -1
- package/lib/commands/remove.d.ts +3 -1
- package/lib/commands/remove.js +16 -5
- package/lib/commands/run.js +6 -6
- package/lib/commands/runIndex.d.ts +1 -1
- package/lib/commands/runIndex.js +1 -1
- package/lib/commands/set/resolution.d.ts +1 -1
- package/lib/commands/set/version/sources.d.ts +1 -1
- package/lib/commands/set/version/sources.js +4 -4
- package/lib/commands/set/version.d.ts +7 -2
- package/lib/commands/set/version.js +45 -10
- package/lib/commands/unlink.d.ts +1 -1
- package/lib/commands/unlink.js +2 -2
- package/lib/commands/up.d.ts +5 -3
- package/lib/commands/up.js +17 -7
- package/lib/commands/workspace.d.ts +3 -3
- package/lib/commands/workspace.js +1 -1
- package/lib/commands/workspaces/list.d.ts +1 -1
- package/lib/dedupeUtils.js +1 -1
- package/lib/index.js +37 -37
- package/lib/suggestUtils.d.ts +7 -0
- package/lib/suggestUtils.js +30 -5
- package/package.json +11 -13
package/lib/commands/add.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseCommand } from '@yarnpkg/cli';
|
|
2
|
+
import { InstallMode } from '@yarnpkg/core';
|
|
2
3
|
import { Usage } from 'clipanion';
|
|
3
4
|
export default class AddCommand extends BaseCommand {
|
|
4
5
|
static paths: string[][];
|
|
@@ -11,8 +12,10 @@ export default class AddCommand extends BaseCommand {
|
|
|
11
12
|
peer: boolean;
|
|
12
13
|
optional: boolean;
|
|
13
14
|
preferDev: boolean;
|
|
14
|
-
interactive: boolean;
|
|
15
|
+
interactive: boolean | undefined;
|
|
15
16
|
cached: boolean;
|
|
17
|
+
mode: InstallMode | undefined;
|
|
18
|
+
silent: boolean | undefined;
|
|
16
19
|
packages: string[];
|
|
17
|
-
execute(): Promise<
|
|
20
|
+
execute(): Promise<1 | 0>;
|
|
18
21
|
}
|
package/lib/commands/add.js
CHANGED
|
@@ -7,7 +7,8 @@ const core_2 = require("@yarnpkg/core");
|
|
|
7
7
|
const core_3 = require("@yarnpkg/core");
|
|
8
8
|
const clipanion_1 = require("clipanion");
|
|
9
9
|
const enquirer_1 = require("enquirer");
|
|
10
|
-
const
|
|
10
|
+
const t = (0, tslib_1.__importStar)(require("typanion"));
|
|
11
|
+
const suggestUtils = (0, tslib_1.__importStar)(require("../suggestUtils"));
|
|
11
12
|
// eslint-disable-next-line arca/no-default-export
|
|
12
13
|
class AddCommand extends cli_1.BaseCommand {
|
|
13
14
|
constructor() {
|
|
@@ -36,12 +37,17 @@ class AddCommand extends cli_1.BaseCommand {
|
|
|
36
37
|
this.preferDev = clipanion_1.Option.Boolean(`--prefer-dev`, false, {
|
|
37
38
|
description: `Add / upgrade a package to a dev dependency`,
|
|
38
39
|
});
|
|
39
|
-
this.interactive = clipanion_1.Option.Boolean(`-i,--interactive`,
|
|
40
|
+
this.interactive = clipanion_1.Option.Boolean(`-i,--interactive`, {
|
|
40
41
|
description: `Reuse the specified package from other workspaces in the project`,
|
|
41
42
|
});
|
|
42
43
|
this.cached = clipanion_1.Option.Boolean(`--cached`, false, {
|
|
43
44
|
description: `Reuse the highest version already used somewhere within the project`,
|
|
44
45
|
});
|
|
46
|
+
this.mode = clipanion_1.Option.String(`--mode`, {
|
|
47
|
+
description: `Change what artifacts installs generate`,
|
|
48
|
+
validator: t.isEnum(core_2.InstallMode),
|
|
49
|
+
});
|
|
50
|
+
this.silent = clipanion_1.Option.Boolean(`--silent`, { hidden: true });
|
|
45
51
|
this.packages = clipanion_1.Option.Rest();
|
|
46
52
|
}
|
|
47
53
|
async execute() {
|
|
@@ -121,7 +127,7 @@ class AddCommand extends cli_1.BaseCommand {
|
|
|
121
127
|
}
|
|
122
128
|
else {
|
|
123
129
|
askedQuestions = true;
|
|
124
|
-
({ answer: selected } = await enquirer_1.prompt({
|
|
130
|
+
({ answer: selected } = await (0, enquirer_1.prompt)({
|
|
125
131
|
type: `select`,
|
|
126
132
|
name: `answer`,
|
|
127
133
|
message: `Which range do you want to use?`,
|
|
@@ -188,7 +194,7 @@ class AddCommand extends cli_1.BaseCommand {
|
|
|
188
194
|
stdout: this.context.stdout,
|
|
189
195
|
includeLogs: !this.context.quiet,
|
|
190
196
|
}, async (report) => {
|
|
191
|
-
await project.install({ cache, report });
|
|
197
|
+
await project.install({ cache, report, mode: this.mode });
|
|
192
198
|
});
|
|
193
199
|
return installReport.exitCode();
|
|
194
200
|
}
|
|
@@ -218,6 +224,12 @@ AddCommand.usage = clipanion_1.Command.Usage({
|
|
|
218
224
|
|
|
219
225
|
If the \`-i,--interactive\` option is used (or if the \`preferInteractive\` settings is toggled on) the command will first try to check whether other workspaces in the project use the specified package and, if so, will offer to reuse them.
|
|
220
226
|
|
|
227
|
+
If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
|
|
228
|
+
|
|
229
|
+
- \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the later 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.
|
|
230
|
+
|
|
231
|
+
- \`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.
|
|
232
|
+
|
|
221
233
|
For a compilation of all the supported protocols, please consult the dedicated page from our website: https://yarnpkg.com/features/protocols.
|
|
222
234
|
`,
|
|
223
235
|
examples: [[
|
package/lib/commands/bin.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const cli_1 = require("@yarnpkg/cli");
|
|
5
5
|
const core_1 = require("@yarnpkg/core");
|
|
6
6
|
const clipanion_1 = require("clipanion");
|
|
7
|
-
const get_1 = tslib_1.__importDefault(require("lodash/get"));
|
|
7
|
+
const get_1 = (0, tslib_1.__importDefault)(require("lodash/get"));
|
|
8
8
|
const util_1 = require("util");
|
|
9
9
|
// eslint-disable-next-line arca/no-default-export
|
|
10
10
|
class ConfigGetCommand extends cli_1.BaseCommand {
|
|
@@ -31,7 +31,7 @@ class ConfigGetCommand extends cli_1.BaseCommand {
|
|
|
31
31
|
});
|
|
32
32
|
const asObject = core_1.miscUtils.convertMapsToIndexableObjects(displayedValue);
|
|
33
33
|
const requestedObject = path
|
|
34
|
-
? get_1.default(asObject, path)
|
|
34
|
+
? (0, get_1.default)(asObject, path)
|
|
35
35
|
: asObject;
|
|
36
36
|
const report = await core_1.StreamReport.start({
|
|
37
37
|
configuration,
|
|
@@ -48,7 +48,7 @@ class ConfigGetCommand extends cli_1.BaseCommand {
|
|
|
48
48
|
}
|
|
49
49
|
// @ts-expect-error: The Node typings forgot one field
|
|
50
50
|
util_1.inspect.styles.name = `cyan`;
|
|
51
|
-
this.context.stdout.write(`${util_1.inspect(requestedObject, {
|
|
51
|
+
this.context.stdout.write(`${(0, util_1.inspect)(requestedObject, {
|
|
52
52
|
depth: Infinity,
|
|
53
53
|
colors: configuration.get(`enableColors`),
|
|
54
54
|
compact: false,
|
|
@@ -4,9 +4,9 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const cli_1 = require("@yarnpkg/cli");
|
|
5
5
|
const core_1 = require("@yarnpkg/core");
|
|
6
6
|
const clipanion_1 = require("clipanion");
|
|
7
|
-
const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
|
|
8
|
-
const get_1 = tslib_1.__importDefault(require("lodash/get"));
|
|
9
|
-
const set_1 = tslib_1.__importDefault(require("lodash/set"));
|
|
7
|
+
const cloneDeep_1 = (0, tslib_1.__importDefault)(require("lodash/cloneDeep"));
|
|
8
|
+
const get_1 = (0, tslib_1.__importDefault)(require("lodash/get"));
|
|
9
|
+
const set_1 = (0, tslib_1.__importDefault)(require("lodash/set"));
|
|
10
10
|
const util_1 = require("util");
|
|
11
11
|
// eslint-disable-next-line arca/no-default-export
|
|
12
12
|
class ConfigSetCommand extends cli_1.BaseCommand {
|
|
@@ -33,6 +33,8 @@ class ConfigSetCommand extends cli_1.BaseCommand {
|
|
|
33
33
|
const setting = configuration.settings.get(name);
|
|
34
34
|
if (typeof setting === `undefined`)
|
|
35
35
|
throw new clipanion_1.UsageError(`Couldn't find a configuration settings named "${name}"`);
|
|
36
|
+
if (name === `enableStrictSettings`)
|
|
37
|
+
throw new clipanion_1.UsageError(`This setting only affects the file it's in, and thus cannot be set from the CLI`);
|
|
36
38
|
const value = this.json
|
|
37
39
|
? JSON.parse(this.value)
|
|
38
40
|
: this.value;
|
|
@@ -41,8 +43,8 @@ class ConfigSetCommand extends cli_1.BaseCommand {
|
|
|
41
43
|
: patch => core_1.Configuration.updateConfiguration(assertProjectCwd(), patch);
|
|
42
44
|
await updateConfiguration(current => {
|
|
43
45
|
if (path) {
|
|
44
|
-
const clone = cloneDeep_1.default(current);
|
|
45
|
-
set_1.default(clone, this.name, value);
|
|
46
|
+
const clone = (0, cloneDeep_1.default)(current);
|
|
47
|
+
(0, set_1.default)(clone, this.name, value);
|
|
46
48
|
return clone;
|
|
47
49
|
}
|
|
48
50
|
else {
|
|
@@ -59,7 +61,7 @@ class ConfigSetCommand extends cli_1.BaseCommand {
|
|
|
59
61
|
});
|
|
60
62
|
const asObject = core_1.miscUtils.convertMapsToIndexableObjects(displayedValue);
|
|
61
63
|
const requestedObject = path
|
|
62
|
-
? get_1.default(asObject, path)
|
|
64
|
+
? (0, get_1.default)(asObject, path)
|
|
63
65
|
: asObject;
|
|
64
66
|
const report = await core_1.StreamReport.start({
|
|
65
67
|
configuration,
|
|
@@ -68,7 +70,7 @@ class ConfigSetCommand extends cli_1.BaseCommand {
|
|
|
68
70
|
}, async (report) => {
|
|
69
71
|
// @ts-expect-error: The Node typings forgot one field
|
|
70
72
|
util_1.inspect.styles.name = `cyan`;
|
|
71
|
-
report.reportInfo(core_1.MessageName.UNNAMED, `Successfully set ${this.name} to ${util_1.inspect(requestedObject, {
|
|
73
|
+
report.reportInfo(core_1.MessageName.UNNAMED, `Successfully set ${this.name} to ${(0, util_1.inspect)(requestedObject, {
|
|
72
74
|
depth: Infinity,
|
|
73
75
|
colors: configuration.get(`enableColors`),
|
|
74
76
|
compact: false,
|
|
@@ -4,9 +4,9 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const cli_1 = require("@yarnpkg/cli");
|
|
5
5
|
const core_1 = require("@yarnpkg/core");
|
|
6
6
|
const clipanion_1 = require("clipanion");
|
|
7
|
-
const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
|
|
8
|
-
const has_1 = tslib_1.__importDefault(require("lodash/has"));
|
|
9
|
-
const unset_1 = tslib_1.__importDefault(require("lodash/unset"));
|
|
7
|
+
const cloneDeep_1 = (0, tslib_1.__importDefault)(require("lodash/cloneDeep"));
|
|
8
|
+
const has_1 = (0, tslib_1.__importDefault)(require("lodash/has"));
|
|
9
|
+
const unset_1 = (0, tslib_1.__importDefault)(require("lodash/unset"));
|
|
10
10
|
// eslint-disable-next-line arca/no-default-export
|
|
11
11
|
class ConfigUnsetCommand extends cli_1.BaseCommand {
|
|
12
12
|
constructor() {
|
|
@@ -38,15 +38,15 @@ class ConfigUnsetCommand extends cli_1.BaseCommand {
|
|
|
38
38
|
}, async (report) => {
|
|
39
39
|
let bailedOutEarly = false;
|
|
40
40
|
await updateConfiguration(current => {
|
|
41
|
-
if (!has_1.default(current, this.name)) {
|
|
41
|
+
if (!(0, has_1.default)(current, this.name)) {
|
|
42
42
|
report.reportWarning(core_1.MessageName.UNNAMED, `Configuration doesn't contain setting ${this.name}; there is nothing to unset`);
|
|
43
43
|
bailedOutEarly = true;
|
|
44
44
|
return current;
|
|
45
45
|
}
|
|
46
46
|
const clone = path
|
|
47
|
-
? cloneDeep_1.default(current)
|
|
47
|
+
? (0, cloneDeep_1.default)(current)
|
|
48
48
|
: { ...current };
|
|
49
|
-
unset_1.default(clone, this.name);
|
|
49
|
+
(0, unset_1.default)(clone, this.name);
|
|
50
50
|
return clone;
|
|
51
51
|
});
|
|
52
52
|
// We can't show the success message in the callback as we must first wait for the new configuration to be persisted
|
package/lib/commands/config.d.ts
CHANGED
package/lib/commands/config.js
CHANGED
|
@@ -72,12 +72,12 @@ class ConfigCommand extends cli_1.BaseCommand {
|
|
|
72
72
|
return Math.max(max, description.length);
|
|
73
73
|
}, 0);
|
|
74
74
|
for (const [key, description] of keysAndDescriptions) {
|
|
75
|
-
report.reportInfo(null, `${key.padEnd(maxKeyLength, ` `)} ${description.padEnd(maxDescriptionLength, ` `)} ${util_1.inspect(configuration.getSpecial(key, { hideSecrets: true, getNativePaths: true }), inspectConfig)}`);
|
|
75
|
+
report.reportInfo(null, `${key.padEnd(maxKeyLength, ` `)} ${description.padEnd(maxDescriptionLength, ` `)} ${(0, util_1.inspect)(configuration.getSpecial(key, { hideSecrets: true, getNativePaths: true }), inspectConfig)}`);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
else {
|
|
79
79
|
for (const key of keys) {
|
|
80
|
-
report.reportInfo(null, `${key.padEnd(maxKeyLength, ` `)} ${util_1.inspect(configuration.getSpecial(key, { hideSecrets: true, getNativePaths: true }), inspectConfig)}`);
|
|
80
|
+
report.reportInfo(null, `${key.padEnd(maxKeyLength, ` `)} ${(0, util_1.inspect)(configuration.getSpecial(key, { hideSecrets: true, getNativePaths: true }), inspectConfig)}`);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
package/lib/commands/dedupe.d.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* (which also provides a safe-guard in case virtual descriptors ever make their way into the dedupe algorithm).
|
|
13
13
|
*/
|
|
14
14
|
import { BaseCommand } from '@yarnpkg/cli';
|
|
15
|
+
import { InstallMode } from '@yarnpkg/core';
|
|
15
16
|
import * as dedupeUtils from '../dedupeUtils';
|
|
16
17
|
export default class DedupeCommand extends BaseCommand {
|
|
17
18
|
static paths: string[][];
|
|
@@ -19,6 +20,7 @@ export default class DedupeCommand extends BaseCommand {
|
|
|
19
20
|
strategy: dedupeUtils.Strategy;
|
|
20
21
|
check: boolean;
|
|
21
22
|
json: boolean;
|
|
23
|
+
mode: InstallMode | undefined;
|
|
22
24
|
patterns: string[];
|
|
23
|
-
execute(): Promise<
|
|
25
|
+
execute(): Promise<1 | 0>;
|
|
24
26
|
}
|
package/lib/commands/dedupe.js
CHANGED
|
@@ -17,8 +17,8 @@ const tslib_1 = require("tslib");
|
|
|
17
17
|
const cli_1 = require("@yarnpkg/cli");
|
|
18
18
|
const core_1 = require("@yarnpkg/core");
|
|
19
19
|
const clipanion_1 = require("clipanion");
|
|
20
|
-
const t = tslib_1.__importStar(require("typanion"));
|
|
21
|
-
const dedupeUtils = tslib_1.__importStar(require("../dedupeUtils"));
|
|
20
|
+
const t = (0, tslib_1.__importStar)(require("typanion"));
|
|
21
|
+
const dedupeUtils = (0, tslib_1.__importStar)(require("../dedupeUtils"));
|
|
22
22
|
// eslint-disable-next-line arca/no-default-export
|
|
23
23
|
class DedupeCommand extends cli_1.BaseCommand {
|
|
24
24
|
constructor() {
|
|
@@ -33,6 +33,10 @@ class DedupeCommand extends cli_1.BaseCommand {
|
|
|
33
33
|
this.json = clipanion_1.Option.Boolean(`--json`, false, {
|
|
34
34
|
description: `Format the output as an NDJSON stream`,
|
|
35
35
|
});
|
|
36
|
+
this.mode = clipanion_1.Option.String(`--mode`, {
|
|
37
|
+
description: `Change what artifacts installs generate`,
|
|
38
|
+
validator: t.isEnum(core_1.InstallMode),
|
|
39
|
+
});
|
|
36
40
|
this.patterns = clipanion_1.Option.Rest();
|
|
37
41
|
}
|
|
38
42
|
async execute() {
|
|
@@ -62,7 +66,7 @@ class DedupeCommand extends cli_1.BaseCommand {
|
|
|
62
66
|
stdout: this.context.stdout,
|
|
63
67
|
json: this.json,
|
|
64
68
|
}, async (report) => {
|
|
65
|
-
await project.install({ cache, report });
|
|
69
|
+
await project.install({ cache, report, mode: this.mode });
|
|
66
70
|
});
|
|
67
71
|
return installReport.exitCode();
|
|
68
72
|
}
|
|
@@ -85,6 +89,12 @@ DedupeCommand.usage = clipanion_1.Command.Usage({
|
|
|
85
89
|
|
|
86
90
|
If set, the \`-c,--check\` flag will only report the found duplicates, without persisting the modified dependency tree. If changes are found, the command will exit with a non-zero exit code, making it suitable for CI purposes.
|
|
87
91
|
|
|
92
|
+
If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
|
|
93
|
+
|
|
94
|
+
- \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the later 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
|
+
|
|
96
|
+
- \`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
|
+
|
|
88
98
|
This command accepts glob patterns as arguments (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.
|
|
89
99
|
|
|
90
100
|
### In-depth explanation:
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export default class ClipanionCommand extends Command<CommandContext> {
|
|
1
|
+
import { BaseCommand } from '@yarnpkg/cli';
|
|
2
|
+
export default class ClipanionCommand extends BaseCommand {
|
|
4
3
|
static paths: string[][];
|
|
5
4
|
execute(): Promise<void>;
|
|
6
5
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_1 = require("@yarnpkg/cli");
|
|
3
4
|
const core_1 = require("@yarnpkg/core");
|
|
4
5
|
const clipanion_1 = require("clipanion");
|
|
5
6
|
// eslint-disable-next-line arca/no-default-export
|
|
6
|
-
class ClipanionCommand extends
|
|
7
|
+
class ClipanionCommand extends cli_1.BaseCommand {
|
|
7
8
|
async execute() {
|
|
8
9
|
const { plugins } = await core_1.Configuration.find(this.context.cwd, this.context.plugins);
|
|
9
10
|
const pluginDefinitions = [];
|
|
@@ -29,9 +30,7 @@ class ClipanionCommand extends clipanion_1.Command {
|
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
|
-
this.context.stdout.write(`${JSON.stringify(
|
|
33
|
-
commands: clipanionDefinitions,
|
|
34
|
-
}, null, 2)}\n`);
|
|
33
|
+
this.context.stdout.write(`${JSON.stringify(clipanionDefinitions, null, 2)}\n`);
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
exports.default = ClipanionCommand;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export default class HelpCommand extends Command<CommandContext> {
|
|
1
|
+
import { BaseCommand } from '@yarnpkg/cli';
|
|
2
|
+
export default class HelpCommand extends BaseCommand {
|
|
4
3
|
static paths: string[][];
|
|
5
4
|
execute(): Promise<void>;
|
|
6
5
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const cli_1 = require("@yarnpkg/cli");
|
|
4
4
|
// eslint-disable-next-line arca/no-default-export
|
|
5
|
-
class HelpCommand extends
|
|
5
|
+
class HelpCommand extends cli_1.BaseCommand {
|
|
6
6
|
async execute() {
|
|
7
7
|
this.context.stdout.write(this.cli.usage(null));
|
|
8
8
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export default class EntryCommand extends Command<CommandContext> {
|
|
1
|
+
import { BaseCommand } from '@yarnpkg/cli';
|
|
2
|
+
export default class EntryCommand extends BaseCommand {
|
|
4
3
|
leadingArgument: string;
|
|
5
4
|
args: string[];
|
|
6
5
|
execute(): Promise<number>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_1 = require("@yarnpkg/cli");
|
|
3
4
|
const core_1 = require("@yarnpkg/core");
|
|
4
5
|
const fslib_1 = require("@yarnpkg/fslib");
|
|
5
6
|
const clipanion_1 = require("clipanion");
|
|
6
7
|
// eslint-disable-next-line arca/no-default-export
|
|
7
|
-
class EntryCommand extends
|
|
8
|
+
class EntryCommand extends cli_1.BaseCommand {
|
|
8
9
|
constructor() {
|
|
9
10
|
super(...arguments);
|
|
10
11
|
this.leadingArgument = clipanion_1.Option.String();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export default class VersionCommand extends Command<CommandContext> {
|
|
1
|
+
import { BaseCommand } from '@yarnpkg/cli';
|
|
2
|
+
export default class VersionCommand extends BaseCommand {
|
|
4
3
|
static paths: string[][];
|
|
5
4
|
execute(): Promise<void>;
|
|
6
5
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_1 = require("@yarnpkg/cli");
|
|
3
4
|
const core_1 = require("@yarnpkg/core");
|
|
4
|
-
const clipanion_1 = require("clipanion");
|
|
5
5
|
// eslint-disable-next-line arca/no-default-export
|
|
6
|
-
class VersionCommand extends
|
|
6
|
+
class VersionCommand extends cli_1.BaseCommand {
|
|
7
7
|
async execute() {
|
|
8
8
|
this.context.stdout.write(`${core_1.YarnVersion || `<unknown>`}\n`);
|
|
9
9
|
}
|
package/lib/commands/exec.js
CHANGED
|
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const cli_1 = require("@yarnpkg/cli");
|
|
4
4
|
const core_1 = require("@yarnpkg/core");
|
|
5
5
|
const core_2 = require("@yarnpkg/core");
|
|
6
|
-
const fslib_1 = require("@yarnpkg/fslib");
|
|
7
|
-
const shell_1 = require("@yarnpkg/shell");
|
|
8
6
|
const clipanion_1 = require("clipanion");
|
|
9
7
|
// eslint-disable-next-line arca/no-default-export
|
|
10
8
|
class ExecCommand extends cli_1.BaseCommand {
|
|
@@ -16,14 +14,13 @@ class ExecCommand extends cli_1.BaseCommand {
|
|
|
16
14
|
async execute() {
|
|
17
15
|
const configuration = await core_1.Configuration.find(this.context.cwd, this.context.plugins);
|
|
18
16
|
const { project, locator } = await core_1.Project.find(configuration, this.context.cwd);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
17
|
+
await project.restoreInstallState();
|
|
18
|
+
return await core_2.scriptUtils.executePackageShellcode(locator, this.commandName, this.args, {
|
|
19
|
+
cwd: this.context.cwd,
|
|
20
|
+
stdin: this.context.stdin,
|
|
21
|
+
stdout: this.context.stdout,
|
|
22
|
+
stderr: this.context.stderr,
|
|
23
|
+
project,
|
|
27
24
|
});
|
|
28
25
|
}
|
|
29
26
|
}
|
|
@@ -6,8 +6,8 @@ export default class ExplainPeerRequirementsCommand extends BaseCommand {
|
|
|
6
6
|
static paths: string[][];
|
|
7
7
|
static usage: import("clipanion").Usage;
|
|
8
8
|
hash: string | undefined;
|
|
9
|
-
execute(): Promise<
|
|
9
|
+
execute(): Promise<1 | 0>;
|
|
10
10
|
}
|
|
11
11
|
export declare function explainPeerRequirements(peerRequirementsHash: string, project: Project, opts: {
|
|
12
12
|
stdout: Writable;
|
|
13
|
-
}): Promise<
|
|
13
|
+
}): Promise<1 | 0>;
|
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const cli_1 = require("@yarnpkg/cli");
|
|
6
6
|
const core_1 = require("@yarnpkg/core");
|
|
7
7
|
const clipanion_1 = require("clipanion");
|
|
8
|
-
const t = tslib_1.__importStar(require("typanion"));
|
|
8
|
+
const t = (0, tslib_1.__importStar)(require("typanion"));
|
|
9
9
|
// eslint-disable-next-line arca/no-default-export
|
|
10
10
|
class ExplainPeerRequirementsCommand extends cli_1.BaseCommand {
|
|
11
11
|
constructor() {
|
package/lib/commands/info.js
CHANGED
|
@@ -5,7 +5,7 @@ const cli_1 = require("@yarnpkg/cli");
|
|
|
5
5
|
const core_1 = require("@yarnpkg/core");
|
|
6
6
|
const fslib_1 = require("@yarnpkg/fslib");
|
|
7
7
|
const clipanion_1 = require("clipanion");
|
|
8
|
-
const micromatch_1 = tslib_1.__importDefault(require("micromatch"));
|
|
8
|
+
const micromatch_1 = (0, tslib_1.__importDefault)(require("micromatch"));
|
|
9
9
|
// eslint-disable-next-line arca/no-default-export
|
|
10
10
|
class InfoCommand extends cli_1.BaseCommand {
|
|
11
11
|
constructor() {
|
|
@@ -192,7 +192,7 @@ class InfoCommand extends cli_1.BaseCommand {
|
|
|
192
192
|
try {
|
|
193
193
|
stat = fslib_1.xfs.statSync(cachePath);
|
|
194
194
|
}
|
|
195
|
-
catch
|
|
195
|
+
catch { }
|
|
196
196
|
}
|
|
197
197
|
const size = typeof stat !== `undefined`
|
|
198
198
|
? [stat.size, core_1.formatUtils.Type.SIZE]
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseCommand } from '@yarnpkg/cli';
|
|
2
|
+
import { InstallMode } from '@yarnpkg/core';
|
|
2
3
|
import { Usage } from 'clipanion';
|
|
3
4
|
export default class YarnCommand extends BaseCommand {
|
|
4
5
|
static paths: string[][];
|
|
@@ -8,7 +9,7 @@ export default class YarnCommand extends BaseCommand {
|
|
|
8
9
|
immutableCache: boolean | undefined;
|
|
9
10
|
checkCache: boolean;
|
|
10
11
|
inlineBuilds: boolean | undefined;
|
|
11
|
-
|
|
12
|
+
mode: InstallMode | undefined;
|
|
12
13
|
cacheFolder: string | undefined;
|
|
13
14
|
frozenLockfile: boolean | undefined;
|
|
14
15
|
ignoreEngines: boolean | undefined;
|
|
@@ -17,5 +18,6 @@ export default class YarnCommand extends BaseCommand {
|
|
|
17
18
|
production: boolean | undefined;
|
|
18
19
|
registry: string | undefined;
|
|
19
20
|
silent: boolean | undefined;
|
|
20
|
-
|
|
21
|
+
networkTimeout: string | undefined;
|
|
22
|
+
execute(): Promise<1 | 0>;
|
|
21
23
|
}
|