@yarnpkg/plugin-essentials 4.0.0-rc.4 → 4.0.0-rc.41
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 +28 -17
- 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 +1 -1
- package/lib/commands/config/get.js +1 -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 +1 -1
- package/lib/commands/config.js +1 -1
- package/lib/commands/dedupe.d.ts +1 -1
- package/lib/commands/dedupe.js +2 -2
- 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 +2 -2
- package/lib/commands/explain/peerRequirements.js +1 -1
- package/lib/commands/explain.js +1 -1
- package/lib/commands/info.js +2 -2
- package/lib/commands/install.d.ts +1 -1
- package/lib/commands/install.js +60 -67
- package/lib/commands/link.d.ts +2 -2
- package/lib/commands/link.js +32 -26
- package/lib/commands/node.js +1 -1
- package/lib/commands/plugin/check.d.ts +8 -0
- package/lib/commands/plugin/check.js +62 -0
- package/lib/commands/plugin/import/sources.d.ts +3 -3
- package/lib/commands/plugin/import/sources.js +4 -4
- package/lib/commands/plugin/import.d.ts +5 -4
- package/lib/commands/plugin/import.js +14 -27
- package/lib/commands/plugin/list.d.ts +2 -2
- package/lib/commands/plugin/list.js +4 -4
- package/lib/commands/plugin/remove.d.ts +1 -1
- package/lib/commands/plugin/remove.js +1 -1
- 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 +4 -4
- package/lib/commands/remove.d.ts +1 -1
- package/lib/commands/remove.js +3 -3
- 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 +1 -1
- package/lib/commands/set/version/sources.d.ts +2 -2
- package/lib/commands/set/version/sources.js +1 -1
- package/lib/commands/set/version.d.ts +2 -3
- package/lib/commands/set/version.js +18 -12
- package/lib/commands/unlink.d.ts +1 -1
- package/lib/commands/unlink.js +1 -1
- package/lib/commands/up.d.ts +3 -3
- package/lib/commands/up.js +4 -4
- 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 +1 -2
- package/lib/index.d.ts +76 -1
- package/lib/index.js +40 -1
- package/lib/suggestUtils.d.ts +4 -4
- package/lib/suggestUtils.js +6 -6
- package/package.json +20 -14
package/lib/commands/link.js
CHANGED
|
@@ -9,15 +9,15 @@ class LinkCommand extends cli_1.BaseCommand {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
this.all = clipanion_1.Option.Boolean(`-A,--all`, false, {
|
|
12
|
-
description: `Link all workspaces belonging to the target
|
|
12
|
+
description: `Link all workspaces belonging to the target projects to the current one`,
|
|
13
13
|
});
|
|
14
14
|
this.private = clipanion_1.Option.Boolean(`-p,--private`, false, {
|
|
15
|
-
description: `Also link private workspaces belonging to the target
|
|
15
|
+
description: `Also link private workspaces belonging to the target projects to the current one`,
|
|
16
16
|
});
|
|
17
17
|
this.relative = clipanion_1.Option.Boolean(`-r,--relative`, false, {
|
|
18
18
|
description: `Link workspaces using relative paths instead of absolute paths`,
|
|
19
19
|
});
|
|
20
|
-
this.
|
|
20
|
+
this.destinations = clipanion_1.Option.Rest();
|
|
21
21
|
}
|
|
22
22
|
async execute() {
|
|
23
23
|
const configuration = await core_1.Configuration.find(this.context.cwd, this.context.plugins);
|
|
@@ -28,29 +28,35 @@ class LinkCommand extends cli_1.BaseCommand {
|
|
|
28
28
|
await project.restoreInstallState({
|
|
29
29
|
restoreResolutions: false,
|
|
30
30
|
});
|
|
31
|
-
const absoluteDestination = fslib_1.ppath.resolve(this.context.cwd, fslib_1.npath.toPortablePath(this.destination));
|
|
32
|
-
const configuration2 = await core_1.Configuration.find(absoluteDestination, this.context.plugins, { useRc: false, strict: false });
|
|
33
|
-
const { project: project2, workspace: workspace2 } = await core_1.Project.find(configuration2, absoluteDestination);
|
|
34
|
-
if (project.cwd === project2.cwd)
|
|
35
|
-
throw new clipanion_1.UsageError(`Invalid destination; Can't link the project to itself`);
|
|
36
|
-
if (!workspace2)
|
|
37
|
-
throw new cli_1.WorkspaceRequiredError(project2.cwd, absoluteDestination);
|
|
38
31
|
const topLevelWorkspace = project.topLevelWorkspace;
|
|
39
32
|
const linkedWorkspaces = [];
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (
|
|
45
|
-
throw new clipanion_1.UsageError(`
|
|
33
|
+
for (const destination of this.destinations) {
|
|
34
|
+
const absoluteDestination = fslib_1.ppath.resolve(this.context.cwd, fslib_1.npath.toPortablePath(destination));
|
|
35
|
+
const configuration2 = await core_1.Configuration.find(absoluteDestination, this.context.plugins, { useRc: false, strict: false });
|
|
36
|
+
const { project: project2, workspace: workspace2 } = await core_1.Project.find(configuration2, absoluteDestination);
|
|
37
|
+
if (project.cwd === project2.cwd)
|
|
38
|
+
throw new clipanion_1.UsageError(`Invalid destination '${destination}'; Can't link the project to itself`);
|
|
39
|
+
if (!workspace2)
|
|
40
|
+
throw new cli_1.WorkspaceRequiredError(project2.cwd, absoluteDestination);
|
|
41
|
+
if (this.all) {
|
|
42
|
+
let found = false;
|
|
43
|
+
for (const workspace of project2.workspaces) {
|
|
44
|
+
if (workspace.manifest.name && (!workspace.manifest.private || this.private)) {
|
|
45
|
+
linkedWorkspaces.push(workspace);
|
|
46
|
+
found = true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (!found) {
|
|
50
|
+
throw new clipanion_1.UsageError(`No workspace found to be linked in the target project: ${destination}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
if (!workspace2.manifest.name)
|
|
55
|
+
throw new clipanion_1.UsageError(`The target workspace at '${destination}' doesn't have a name and thus cannot be linked`);
|
|
56
|
+
if (workspace2.manifest.private && !this.private)
|
|
57
|
+
throw new clipanion_1.UsageError(`The target workspace at '${destination}' is marked private - use the --private flag to link it anyway`);
|
|
58
|
+
linkedWorkspaces.push(workspace2);
|
|
46
59
|
}
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
if (!workspace2.manifest.name)
|
|
50
|
-
throw new clipanion_1.UsageError(`The target workspace doesn't have a name and thus cannot be linked`);
|
|
51
|
-
if (workspace2.manifest.private && !this.private)
|
|
52
|
-
throw new clipanion_1.UsageError(`The target workspace is marked private - use the --private flag to link it anyway`);
|
|
53
|
-
linkedWorkspaces.push(workspace2);
|
|
54
60
|
}
|
|
55
61
|
for (const workspace of linkedWorkspaces) {
|
|
56
62
|
const fullName = core_1.structUtils.stringifyIdent(workspace.locator);
|
|
@@ -71,7 +77,6 @@ class LinkCommand extends cli_1.BaseCommand {
|
|
|
71
77
|
return report.exitCode();
|
|
72
78
|
}
|
|
73
79
|
}
|
|
74
|
-
exports.default = LinkCommand;
|
|
75
80
|
LinkCommand.paths = [
|
|
76
81
|
[`link`],
|
|
77
82
|
];
|
|
@@ -81,10 +86,11 @@ LinkCommand.usage = clipanion_1.Command.Usage({
|
|
|
81
86
|
This command will set a new \`resolutions\` field in the project-level manifest and point it to the workspace at the specified location (even if part of another project).
|
|
82
87
|
`,
|
|
83
88
|
examples: [[
|
|
84
|
-
`Register
|
|
85
|
-
`$0 link ~/ts-loader`,
|
|
89
|
+
`Register one or more remote workspaces for use in the current project`,
|
|
90
|
+
`$0 link ~/ts-loader ~/jest`,
|
|
86
91
|
], [
|
|
87
92
|
`Register all workspaces from a remote project for use in the current project`,
|
|
88
93
|
`$0 link ~/jest --all`,
|
|
89
94
|
]],
|
|
90
95
|
});
|
|
96
|
+
exports.default = LinkCommand;
|
package/lib/commands/node.js
CHANGED
|
@@ -12,7 +12,6 @@ class NodeCommand extends cli_1.BaseCommand {
|
|
|
12
12
|
return this.cli.run([`exec`, `node`, ...this.args]);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
exports.default = NodeCommand;
|
|
16
15
|
NodeCommand.paths = [
|
|
17
16
|
[`node`],
|
|
18
17
|
];
|
|
@@ -28,3 +27,4 @@ NodeCommand.usage = clipanion_1.Command.Usage({
|
|
|
28
27
|
`$0 node ./my-script.js`,
|
|
29
28
|
]],
|
|
30
29
|
});
|
|
30
|
+
exports.default = NodeCommand;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_1 = require("@yarnpkg/cli");
|
|
4
|
+
const core_1 = require("@yarnpkg/core");
|
|
5
|
+
const clipanion_1 = require("clipanion");
|
|
6
|
+
// eslint-disable-next-line arca/no-default-export
|
|
7
|
+
class PluginCheckCommand extends cli_1.BaseCommand {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.json = clipanion_1.Option.Boolean(`--json`, false, {
|
|
11
|
+
description: `Format the output as an NDJSON stream`,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
async execute() {
|
|
15
|
+
const configuration = await core_1.Configuration.find(this.context.cwd, this.context.plugins);
|
|
16
|
+
const rcFiles = await core_1.Configuration.findRcFiles(this.context.cwd);
|
|
17
|
+
const report = await core_1.StreamReport.start({
|
|
18
|
+
configuration,
|
|
19
|
+
json: this.json,
|
|
20
|
+
stdout: this.context.stdout,
|
|
21
|
+
}, async (report) => {
|
|
22
|
+
var _a;
|
|
23
|
+
for (const rcFile of rcFiles) {
|
|
24
|
+
if (!((_a = rcFile.data) === null || _a === void 0 ? void 0 : _a.plugins))
|
|
25
|
+
continue;
|
|
26
|
+
for (const plugin of rcFile.data.plugins) {
|
|
27
|
+
if (!plugin.checksum)
|
|
28
|
+
continue;
|
|
29
|
+
if (!plugin.spec.match(/^https?:/))
|
|
30
|
+
continue;
|
|
31
|
+
const newBuffer = await core_1.httpUtils.get(plugin.spec, { configuration });
|
|
32
|
+
const newChecksum = core_1.hashUtils.makeHash(newBuffer);
|
|
33
|
+
if (plugin.checksum === newChecksum)
|
|
34
|
+
continue;
|
|
35
|
+
const prettyPath = core_1.formatUtils.pretty(configuration, plugin.path, core_1.formatUtils.Type.PATH);
|
|
36
|
+
const prettySpec = core_1.formatUtils.pretty(configuration, plugin.spec, core_1.formatUtils.Type.URL);
|
|
37
|
+
const prettyMessage = `${prettyPath} is different from the file provided by ${prettySpec}`;
|
|
38
|
+
report.reportJson({ ...plugin, newChecksum });
|
|
39
|
+
report.reportError(core_1.MessageName.UNNAMED, prettyMessage);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return report.exitCode();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
PluginCheckCommand.paths = [
|
|
47
|
+
[`plugin`, `check`],
|
|
48
|
+
];
|
|
49
|
+
PluginCheckCommand.usage = clipanion_1.Command.Usage({
|
|
50
|
+
category: `Plugin-related commands`,
|
|
51
|
+
description: `find all third-party plugins that differ from their own spec`,
|
|
52
|
+
details: `
|
|
53
|
+
Check only the plugins from https.
|
|
54
|
+
|
|
55
|
+
If this command detects any plugin differences in the CI environment, it will throw an error.
|
|
56
|
+
`,
|
|
57
|
+
examples: [[
|
|
58
|
+
`find all third-party plugins that differ from their own spec`,
|
|
59
|
+
`$0 plugin check`,
|
|
60
|
+
]],
|
|
61
|
+
});
|
|
62
|
+
exports.default = PluginCheckCommand;
|
|
@@ -3,7 +3,7 @@ import { Report, CommandContext } from '@yarnpkg/core';
|
|
|
3
3
|
import { Project } from '@yarnpkg/core';
|
|
4
4
|
import { PortablePath } from '@yarnpkg/fslib';
|
|
5
5
|
import { Usage } from 'clipanion';
|
|
6
|
-
export default class
|
|
6
|
+
export default class PluginImportSourcesCommand extends BaseCommand {
|
|
7
7
|
static paths: string[][];
|
|
8
8
|
static usage: Usage;
|
|
9
9
|
installPath: string | undefined;
|
|
@@ -12,9 +12,9 @@ export default class PluginDlSourcesCommand extends BaseCommand {
|
|
|
12
12
|
noMinify: boolean;
|
|
13
13
|
force: boolean;
|
|
14
14
|
name: string;
|
|
15
|
-
execute(): Promise<
|
|
15
|
+
execute(): Promise<0 | 1>;
|
|
16
16
|
}
|
|
17
|
-
export
|
|
17
|
+
export type BuildAndSavePluginsSpec = {
|
|
18
18
|
context: CommandContext;
|
|
19
19
|
noMinify: boolean;
|
|
20
20
|
};
|
|
@@ -14,7 +14,7 @@ const buildWorkflow = ({ pluginName, noMinify }, target) => [
|
|
|
14
14
|
[`yarn`, `build:${pluginName}`, ...noMinify ? [`--no-minify`] : [], `|`],
|
|
15
15
|
];
|
|
16
16
|
// eslint-disable-next-line arca/no-default-export
|
|
17
|
-
class
|
|
17
|
+
class PluginImportSourcesCommand extends cli_1.BaseCommand {
|
|
18
18
|
constructor() {
|
|
19
19
|
super(...arguments);
|
|
20
20
|
this.installPath = clipanion_1.Option.String(`--path`, {
|
|
@@ -56,11 +56,10 @@ class PluginDlSourcesCommand extends cli_1.BaseCommand {
|
|
|
56
56
|
return report.exitCode();
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
PluginDlSourcesCommand.paths = [
|
|
59
|
+
PluginImportSourcesCommand.paths = [
|
|
61
60
|
[`plugin`, `import`, `from`, `sources`],
|
|
62
61
|
];
|
|
63
|
-
|
|
62
|
+
PluginImportSourcesCommand.usage = clipanion_1.Command.Usage({
|
|
64
63
|
category: `Plugin-related commands`,
|
|
65
64
|
description: `build a plugin from sources`,
|
|
66
65
|
details: `
|
|
@@ -76,6 +75,7 @@ PluginDlSourcesCommand.usage = clipanion_1.Command.Usage({
|
|
|
76
75
|
`$0 plugin import from sources exec`,
|
|
77
76
|
]],
|
|
78
77
|
});
|
|
78
|
+
exports.default = PluginImportSourcesCommand;
|
|
79
79
|
async function buildAndSavePlugin(pluginSpec, { context, noMinify }, { project, report, target }) {
|
|
80
80
|
const pluginName = pluginSpec.replace(/@yarnpkg\//, ``);
|
|
81
81
|
const { configuration } = project;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
2
|
import { BaseCommand } from '@yarnpkg/cli';
|
|
4
3
|
import { Project, Report } from '@yarnpkg/core';
|
|
5
4
|
import { Usage } from 'clipanion';
|
|
6
|
-
export default class
|
|
5
|
+
export default class PluginImportCommand extends BaseCommand {
|
|
7
6
|
static paths: string[][];
|
|
8
7
|
static usage: Usage;
|
|
9
8
|
name: string;
|
|
10
|
-
|
|
9
|
+
checksum: boolean;
|
|
10
|
+
execute(): Promise<0 | 1>;
|
|
11
11
|
}
|
|
12
|
-
export declare function savePlugin(pluginSpec: string, pluginBuffer: Buffer, { project, report }: {
|
|
12
|
+
export declare function savePlugin(pluginSpec: string, pluginBuffer: Buffer, { checksum, project, report }: {
|
|
13
|
+
checksum?: boolean;
|
|
13
14
|
project: Project;
|
|
14
15
|
report: Report;
|
|
15
16
|
}): Promise<void>;
|
|
@@ -12,10 +12,13 @@ const url_1 = require("url");
|
|
|
12
12
|
const vm_1 = require("vm");
|
|
13
13
|
const list_1 = require("./list");
|
|
14
14
|
// eslint-disable-next-line arca/no-default-export
|
|
15
|
-
class
|
|
15
|
+
class PluginImportCommand extends cli_1.BaseCommand {
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments);
|
|
18
18
|
this.name = clipanion_1.Option.String();
|
|
19
|
+
this.checksum = clipanion_1.Option.Boolean(`--checksum`, true, {
|
|
20
|
+
description: `Whether to care if this plugin is modified`,
|
|
21
|
+
});
|
|
19
22
|
}
|
|
20
23
|
async execute() {
|
|
21
24
|
const configuration = await core_1.Configuration.find(this.context.cwd, this.context.plugins);
|
|
@@ -70,16 +73,15 @@ class PluginDlCommand extends cli_1.BaseCommand {
|
|
|
70
73
|
report.reportInfo(core_1.MessageName.UNNAMED, `Downloading ${core_2.formatUtils.pretty(configuration, pluginUrl, `green`)}`);
|
|
71
74
|
pluginBuffer = await core_2.httpUtils.get(pluginUrl, { configuration });
|
|
72
75
|
}
|
|
73
|
-
await savePlugin(pluginSpec, pluginBuffer, { project, report });
|
|
76
|
+
await savePlugin(pluginSpec, pluginBuffer, { checksum: this.checksum, project, report });
|
|
74
77
|
});
|
|
75
78
|
return report.exitCode();
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
|
-
|
|
79
|
-
PluginDlCommand.paths = [
|
|
81
|
+
PluginImportCommand.paths = [
|
|
80
82
|
[`plugin`, `import`],
|
|
81
83
|
];
|
|
82
|
-
|
|
84
|
+
PluginImportCommand.usage = clipanion_1.Command.Usage({
|
|
83
85
|
category: `Plugin-related commands`,
|
|
84
86
|
description: `download a plugin`,
|
|
85
87
|
details: `
|
|
@@ -91,6 +93,8 @@ PluginDlCommand.usage = clipanion_1.Command.Usage({
|
|
|
91
93
|
- Third-party plugins can be referenced directly through their public urls.
|
|
92
94
|
- Local plugins can be referenced by their path on the disk.
|
|
93
95
|
|
|
96
|
+
If the \`--no-checksum\` option is set, Yarn will no longer care if the plugin is modified.
|
|
97
|
+
|
|
94
98
|
Plugins cannot be downloaded from the npm registry, and aren't allowed to have dependencies (they need to be bundled into a single file, possibly thanks to the \`@yarnpkg/builder\` package).
|
|
95
99
|
`,
|
|
96
100
|
examples: [[
|
|
@@ -107,7 +111,8 @@ PluginDlCommand.usage = clipanion_1.Command.Usage({
|
|
|
107
111
|
`$0 plugin import ./path/to/plugin.js`,
|
|
108
112
|
]],
|
|
109
113
|
});
|
|
110
|
-
|
|
114
|
+
exports.default = PluginImportCommand;
|
|
115
|
+
async function savePlugin(pluginSpec, pluginBuffer, { checksum = true, project, report }) {
|
|
111
116
|
const { configuration } = project;
|
|
112
117
|
const vmExports = {};
|
|
113
118
|
const vmModule = { exports: vmExports };
|
|
@@ -125,26 +130,8 @@ async function savePlugin(pluginSpec, pluginBuffer, { project, report }) {
|
|
|
125
130
|
path: relativePath,
|
|
126
131
|
spec: pluginSpec,
|
|
127
132
|
};
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
for (const entry of current.plugins || []) {
|
|
132
|
-
const userProvidedPath = typeof entry !== `string`
|
|
133
|
-
? entry.path
|
|
134
|
-
: entry;
|
|
135
|
-
const pluginPath = fslib_1.ppath.resolve(project.cwd, fslib_1.npath.toPortablePath(userProvidedPath));
|
|
136
|
-
const { name } = core_1.miscUtils.dynamicRequire(pluginPath);
|
|
137
|
-
if (name !== pluginName) {
|
|
138
|
-
plugins.push(entry);
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
plugins.push(pluginMeta);
|
|
142
|
-
hasBeenReplaced = true;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
if (!hasBeenReplaced)
|
|
146
|
-
plugins.push(pluginMeta);
|
|
147
|
-
return { ...current, plugins };
|
|
148
|
-
});
|
|
133
|
+
if (checksum)
|
|
134
|
+
pluginMeta.checksum = core_2.hashUtils.makeHash(pluginBuffer);
|
|
135
|
+
await core_1.Configuration.addPlugin(project.cwd, [pluginMeta]);
|
|
149
136
|
}
|
|
150
137
|
exports.savePlugin = savePlugin;
|
|
@@ -4,9 +4,9 @@ import { Usage } from 'clipanion';
|
|
|
4
4
|
export declare function getAvailablePlugins(configuration: Configuration, version: string | null): Promise<{
|
|
5
5
|
[k: string]: any;
|
|
6
6
|
}>;
|
|
7
|
-
export default class
|
|
7
|
+
export default class PluginListCommand extends BaseCommand {
|
|
8
8
|
static paths: string[][];
|
|
9
9
|
static usage: Usage;
|
|
10
10
|
json: boolean;
|
|
11
|
-
execute(): Promise<
|
|
11
|
+
execute(): Promise<0 | 1>;
|
|
12
12
|
}
|
|
@@ -16,7 +16,7 @@ async function getAvailablePlugins(configuration, version) {
|
|
|
16
16
|
}
|
|
17
17
|
exports.getAvailablePlugins = getAvailablePlugins;
|
|
18
18
|
// eslint-disable-next-line arca/no-default-export
|
|
19
|
-
class
|
|
19
|
+
class PluginListCommand extends cli_1.BaseCommand {
|
|
20
20
|
constructor() {
|
|
21
21
|
super(...arguments);
|
|
22
22
|
this.json = clipanion_1.Option.Boolean(`--json`, false, {
|
|
@@ -42,11 +42,10 @@ class PluginDlCommand extends cli_1.BaseCommand {
|
|
|
42
42
|
return report.exitCode();
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
PluginDlCommand.paths = [
|
|
45
|
+
PluginListCommand.paths = [
|
|
47
46
|
[`plugin`, `list`],
|
|
48
47
|
];
|
|
49
|
-
|
|
48
|
+
PluginListCommand.usage = clipanion_1.Command.Usage({
|
|
50
49
|
category: `Plugin-related commands`,
|
|
51
50
|
description: `list the available official plugins`,
|
|
52
51
|
details: `
|
|
@@ -57,3 +56,4 @@ PluginDlCommand.usage = clipanion_1.Command.Usage({
|
|
|
57
56
|
`$0 plugin list`,
|
|
58
57
|
]],
|
|
59
58
|
});
|
|
59
|
+
exports.default = PluginListCommand;
|
|
@@ -45,7 +45,6 @@ class PluginRemoveCommand extends cli_1.BaseCommand {
|
|
|
45
45
|
return report.exitCode();
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
exports.default = PluginRemoveCommand;
|
|
49
48
|
PluginRemoveCommand.paths = [
|
|
50
49
|
[`plugin`, `remove`],
|
|
51
50
|
];
|
|
@@ -65,3 +64,4 @@ PluginRemoveCommand.usage = clipanion_1.Command.Usage({
|
|
|
65
64
|
`$0 plugin remove my-local-plugin`,
|
|
66
65
|
]],
|
|
67
66
|
});
|
|
67
|
+
exports.default = PluginRemoveCommand;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseCommand } from '@yarnpkg/cli';
|
|
2
2
|
import { Usage } from 'clipanion';
|
|
3
|
-
export default class
|
|
3
|
+
export default class PluginRuntimeCommand extends BaseCommand {
|
|
4
4
|
static paths: string[][];
|
|
5
5
|
static usage: Usage;
|
|
6
6
|
json: boolean;
|
|
7
|
-
execute(): Promise<
|
|
7
|
+
execute(): Promise<0 | 1>;
|
|
8
8
|
}
|
|
@@ -4,7 +4,7 @@ const cli_1 = require("@yarnpkg/cli");
|
|
|
4
4
|
const core_1 = require("@yarnpkg/core");
|
|
5
5
|
const clipanion_1 = require("clipanion");
|
|
6
6
|
// eslint-disable-next-line arca/no-default-export
|
|
7
|
-
class
|
|
7
|
+
class PluginRuntimeCommand extends cli_1.BaseCommand {
|
|
8
8
|
constructor() {
|
|
9
9
|
super(...arguments);
|
|
10
10
|
this.json = clipanion_1.Option.Boolean(`--json`, false, {
|
|
@@ -30,11 +30,10 @@ class PluginListCommand extends cli_1.BaseCommand {
|
|
|
30
30
|
return report.exitCode();
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
PluginListCommand.paths = [
|
|
33
|
+
PluginRuntimeCommand.paths = [
|
|
35
34
|
[`plugin`, `runtime`],
|
|
36
35
|
];
|
|
37
|
-
|
|
36
|
+
PluginRuntimeCommand.usage = clipanion_1.Command.Usage({
|
|
38
37
|
category: `Plugin-related commands`,
|
|
39
38
|
description: `list the active plugins`,
|
|
40
39
|
details: `
|
|
@@ -45,3 +44,4 @@ PluginListCommand.usage = clipanion_1.Command.Usage({
|
|
|
45
44
|
`$0 plugin runtime`,
|
|
46
45
|
]],
|
|
47
46
|
});
|
|
47
|
+
exports.default = PluginRuntimeCommand;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseCommand } from '@yarnpkg/cli';
|
|
2
2
|
import { Usage } from 'clipanion';
|
|
3
|
-
export default class
|
|
3
|
+
export default class RebuildCommand extends BaseCommand {
|
|
4
4
|
static paths: string[][];
|
|
5
5
|
static usage: Usage;
|
|
6
6
|
idents: string[];
|
|
7
|
-
execute(): Promise<
|
|
7
|
+
execute(): Promise<0 | 1>;
|
|
8
8
|
}
|
package/lib/commands/rebuild.js
CHANGED
|
@@ -5,7 +5,7 @@ const core_1 = require("@yarnpkg/core");
|
|
|
5
5
|
const core_2 = require("@yarnpkg/core");
|
|
6
6
|
const clipanion_1 = require("clipanion");
|
|
7
7
|
// eslint-disable-next-line arca/no-default-export
|
|
8
|
-
class
|
|
8
|
+
class RebuildCommand extends cli_1.BaseCommand {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
this.idents = clipanion_1.Option.Rest();
|
|
@@ -46,11 +46,10 @@ class RunCommand extends cli_1.BaseCommand {
|
|
|
46
46
|
return installReport.exitCode();
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
RunCommand.paths = [
|
|
49
|
+
RebuildCommand.paths = [
|
|
51
50
|
[`rebuild`],
|
|
52
51
|
];
|
|
53
|
-
|
|
52
|
+
RebuildCommand.usage = clipanion_1.Command.Usage({
|
|
54
53
|
description: `rebuild the project's native packages`,
|
|
55
54
|
details: `
|
|
56
55
|
This command will automatically cause Yarn to forget about previous compilations of the given packages and to run them again.
|
|
@@ -67,3 +66,4 @@ RunCommand.usage = clipanion_1.Command.Usage({
|
|
|
67
66
|
`$0 rebuild fsevents`,
|
|
68
67
|
]],
|
|
69
68
|
});
|
|
69
|
+
exports.default = RebuildCommand;
|
package/lib/commands/remove.d.ts
CHANGED
package/lib/commands/remove.js
CHANGED
|
@@ -89,7 +89,7 @@ class RemoveCommand extends cli_1.BaseCommand {
|
|
|
89
89
|
? `any`
|
|
90
90
|
: `this`;
|
|
91
91
|
if (unreferencedPatterns.length > 0)
|
|
92
|
-
throw new clipanion_1.UsageError(`${patterns} ${core_1.formatUtils.prettyList(configuration, unreferencedPatterns, core_1.
|
|
92
|
+
throw new clipanion_1.UsageError(`${patterns} ${core_1.formatUtils.prettyList(configuration, unreferencedPatterns, core_1.formatUtils.Type.CODE)} ${dont} match any packages referenced by ${which} workspace`);
|
|
93
93
|
if (hasChanged) {
|
|
94
94
|
await configuration.triggerMultipleHooks((hooks) => hooks.afterWorkspaceDependencyRemoval, afterWorkspaceDependencyRemovalList);
|
|
95
95
|
const report = await core_2.StreamReport.start({
|
|
@@ -103,7 +103,6 @@ class RemoveCommand extends cli_1.BaseCommand {
|
|
|
103
103
|
return 0;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
exports.default = RemoveCommand;
|
|
107
106
|
RemoveCommand.paths = [
|
|
108
107
|
[`remove`],
|
|
109
108
|
];
|
|
@@ -114,7 +113,7 @@ RemoveCommand.usage = clipanion_1.Command.Usage({
|
|
|
114
113
|
|
|
115
114
|
If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
|
|
116
115
|
|
|
117
|
-
- \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the
|
|
116
|
+
- \`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.
|
|
118
117
|
|
|
119
118
|
- \`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.
|
|
120
119
|
|
|
@@ -137,3 +136,4 @@ RemoveCommand.usage = clipanion_1.Command.Usage({
|
|
|
137
136
|
`$0 remove 'react-{dom,helmet}'`,
|
|
138
137
|
]],
|
|
139
138
|
});
|
|
139
|
+
exports.default = RemoveCommand;
|
package/lib/commands/run.js
CHANGED
|
@@ -117,7 +117,6 @@ class RunCommand extends cli_1.BaseCommand {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
exports.default = RunCommand;
|
|
121
120
|
RunCommand.paths = [
|
|
122
121
|
[`run`],
|
|
123
122
|
];
|
|
@@ -145,3 +144,4 @@ RunCommand.usage = clipanion_1.Command.Usage({
|
|
|
145
144
|
`$0 run --inspect-brk webpack`,
|
|
146
145
|
]],
|
|
147
146
|
});
|
|
147
|
+
exports.default = RunCommand;
|
package/lib/commands/runIndex.js
CHANGED
|
@@ -5,7 +5,7 @@ const core_1 = require("@yarnpkg/core");
|
|
|
5
5
|
const core_2 = require("@yarnpkg/core");
|
|
6
6
|
const util_1 = require("util");
|
|
7
7
|
// eslint-disable-next-line arca/no-default-export
|
|
8
|
-
class
|
|
8
|
+
class RunIndexCommand extends cli_1.BaseCommand {
|
|
9
9
|
async execute() {
|
|
10
10
|
const configuration = await core_1.Configuration.find(this.context.cwd, this.context.plugins);
|
|
11
11
|
const { project, workspace } = await core_1.Project.find(configuration, this.context.cwd);
|
|
@@ -32,7 +32,7 @@ class RunCommand extends cli_1.BaseCommand {
|
|
|
32
32
|
return report.exitCode();
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
RunCommand.paths = [
|
|
35
|
+
RunIndexCommand.paths = [
|
|
37
36
|
[`run`],
|
|
38
37
|
];
|
|
38
|
+
exports.default = RunIndexCommand;
|
|
@@ -37,7 +37,6 @@ class SetResolutionCommand extends cli_1.BaseCommand {
|
|
|
37
37
|
return report.exitCode();
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
exports.default = SetResolutionCommand;
|
|
41
40
|
SetResolutionCommand.paths = [
|
|
42
41
|
[`set`, `resolution`],
|
|
43
42
|
];
|
|
@@ -55,3 +54,4 @@ SetResolutionCommand.usage = clipanion_1.Command.Usage({
|
|
|
55
54
|
`$0 set resolution lodash@npm:^1.2.3 1.5.0`,
|
|
56
55
|
]],
|
|
57
56
|
});
|
|
57
|
+
exports.default = SetResolutionCommand;
|
|
@@ -12,14 +12,14 @@ export default class SetVersionSourcesCommand extends BaseCommand {
|
|
|
12
12
|
noMinify: boolean;
|
|
13
13
|
force: boolean;
|
|
14
14
|
skipPlugins: boolean;
|
|
15
|
-
execute(): Promise<
|
|
15
|
+
execute(): Promise<0 | 1>;
|
|
16
16
|
}
|
|
17
17
|
export declare function runWorkflow(workflow: Array<Array<string>>, { configuration, context, target }: {
|
|
18
18
|
configuration: Configuration;
|
|
19
19
|
context: CommandContext;
|
|
20
20
|
target: PortablePath;
|
|
21
21
|
}): Promise<void>;
|
|
22
|
-
export
|
|
22
|
+
export type PrepareSpec = {
|
|
23
23
|
branch: string;
|
|
24
24
|
context: CommandContext;
|
|
25
25
|
force: boolean;
|
|
@@ -86,7 +86,6 @@ class SetVersionSourcesCommand extends cli_1.BaseCommand {
|
|
|
86
86
|
return report.exitCode();
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
exports.default = SetVersionSourcesCommand;
|
|
90
89
|
SetVersionSourcesCommand.paths = [
|
|
91
90
|
[`set`, `version`, `from`, `sources`],
|
|
92
91
|
];
|
|
@@ -102,6 +101,7 @@ SetVersionSourcesCommand.usage = clipanion_1.Command.Usage({
|
|
|
102
101
|
`$0 set version from sources`,
|
|
103
102
|
]],
|
|
104
103
|
});
|
|
104
|
+
exports.default = SetVersionSourcesCommand;
|
|
105
105
|
async function runWorkflow(workflow, { configuration, context, target }) {
|
|
106
106
|
for (const [fileName, ...args] of workflow) {
|
|
107
107
|
const usePipe = args[args.length - 1] === `|`;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
2
|
import { BaseCommand } from '@yarnpkg/cli';
|
|
4
3
|
import { Configuration, Report } from '@yarnpkg/core';
|
|
5
4
|
import { Usage } from 'clipanion';
|
|
6
|
-
export
|
|
5
|
+
export type Tags = {
|
|
7
6
|
latest: Record<string, string>;
|
|
8
7
|
tags: Array<string>;
|
|
9
8
|
};
|
|
@@ -13,7 +12,7 @@ export default class SetVersionCommand extends BaseCommand {
|
|
|
13
12
|
useYarnPath: boolean | undefined;
|
|
14
13
|
onlyIfNeeded: boolean;
|
|
15
14
|
version: string;
|
|
16
|
-
execute(): Promise<
|
|
15
|
+
execute(): Promise<0 | 1>;
|
|
17
16
|
}
|
|
18
17
|
export declare function resolveRange(configuration: Configuration, request: string): Promise<string>;
|
|
19
18
|
export declare function resolveTag(configuration: Configuration, request: `stable` | `canary`): Promise<string>;
|