@yarnpkg/plugin-essentials 3.2.3 → 3.4.0

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.
Files changed (42) hide show
  1. package/lib/commands/add.js +10 -9
  2. package/lib/commands/bin.js +1 -1
  3. package/lib/commands/cache/clean.js +1 -1
  4. package/lib/commands/config/get.js +1 -1
  5. package/lib/commands/config/set.js +1 -1
  6. package/lib/commands/config/unset.js +1 -1
  7. package/lib/commands/config.js +1 -1
  8. package/lib/commands/dedupe.js +2 -2
  9. package/lib/commands/entries/clipanion.js +1 -1
  10. package/lib/commands/entries/help.js +1 -1
  11. package/lib/commands/entries/version.js +1 -1
  12. package/lib/commands/exec.js +1 -1
  13. package/lib/commands/explain/peerRequirements.js +1 -1
  14. package/lib/commands/explain.js +1 -1
  15. package/lib/commands/info.js +1 -1
  16. package/lib/commands/install.js +2 -2
  17. package/lib/commands/link.js +1 -1
  18. package/lib/commands/node.js +1 -1
  19. package/lib/commands/plugin/import/sources.js +1 -1
  20. package/lib/commands/plugin/import.js +1 -1
  21. package/lib/commands/plugin/list.js +1 -1
  22. package/lib/commands/plugin/remove.js +1 -1
  23. package/lib/commands/plugin/runtime.js +1 -1
  24. package/lib/commands/rebuild.js +1 -1
  25. package/lib/commands/remove.js +2 -2
  26. package/lib/commands/run.d.ts +1 -0
  27. package/lib/commands/run.js +6 -1
  28. package/lib/commands/runIndex.js +1 -1
  29. package/lib/commands/set/resolution.js +1 -1
  30. package/lib/commands/set/version/sources.js +1 -1
  31. package/lib/commands/set/version.js +2 -2
  32. package/lib/commands/unlink.js +1 -1
  33. package/lib/commands/up.js +3 -3
  34. package/lib/commands/why.js +1 -1
  35. package/lib/commands/workspace.js +2 -5
  36. package/lib/commands/workspaces/list.d.ts +1 -0
  37. package/lib/commands/workspaces/list.js +8 -1
  38. package/lib/dedupeUtils.js +2 -2
  39. package/lib/index.d.ts +1 -0
  40. package/lib/index.js +5 -0
  41. package/lib/suggestUtils.js +9 -9
  42. package/package.json +9 -11
@@ -61,17 +61,18 @@ class AddCommand extends cli_1.BaseCommand {
61
61
  restoreResolutions: false,
62
62
  });
63
63
  const interactive = (_a = this.interactive) !== null && _a !== void 0 ? _a : configuration.get(`preferInteractive`);
64
+ const reuse = interactive || configuration.get(`preferReuse`);
64
65
  const modifier = suggestUtils.getModifier(this, project);
65
66
  const strategies = [
66
- ...interactive ? [
67
- suggestUtils.Strategy.REUSE,
68
- ] : [],
67
+ reuse ?
68
+ suggestUtils.Strategy.REUSE
69
+ : undefined,
69
70
  suggestUtils.Strategy.PROJECT,
70
- ...this.cached ? [
71
- suggestUtils.Strategy.CACHE,
72
- ] : [],
71
+ this.cached ?
72
+ suggestUtils.Strategy.CACHE
73
+ : undefined,
73
74
  suggestUtils.Strategy.LATEST,
74
- ];
75
+ ].filter((strategy) => typeof strategy !== `undefined`);
75
76
  const maxResults = interactive
76
77
  ? Infinity
77
78
  : 1;
@@ -207,7 +208,6 @@ class AddCommand extends cli_1.BaseCommand {
207
208
  return installReport.exitCode();
208
209
  }
209
210
  }
210
- exports.default = AddCommand;
211
211
  AddCommand.paths = [
212
212
  [`add`],
213
213
  ];
@@ -234,7 +234,7 @@ AddCommand.usage = clipanion_1.Command.Usage({
234
234
 
235
235
  If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
236
236
 
237
- - \`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.
237
+ - \`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.
238
238
 
239
239
  - \`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.
240
240
 
@@ -260,6 +260,7 @@ AddCommand.usage = clipanion_1.Command.Usage({
260
260
  `$0 add lodash-es@lodash/lodash#es`,
261
261
  ]],
262
262
  });
263
+ exports.default = AddCommand;
263
264
  function suggestTargetList(workspace, ident, { dev, peer, preferDev, optional }) {
264
265
  const hasRegular = workspace.manifest[suggestUtils.Target.REGULAR].has(ident.identHash);
265
266
  const hasDev = workspace.manifest[suggestUtils.Target.DEVELOPMENT].has(ident.identHash);
@@ -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;
@@ -57,7 +57,6 @@ class ConfigGetCommand extends cli_1.BaseCommand {
57
57
  return report.exitCode();
58
58
  }
59
59
  }
60
- exports.default = ConfigGetCommand;
61
60
  ConfigGetCommand.paths = [
62
61
  [`config`, `get`],
63
62
  ];
@@ -85,3 +84,4 @@ ConfigGetCommand.usage = clipanion_1.Command.Usage({
85
84
  `yarn config get packageExtensions --json`,
86
85
  ]],
87
86
  });
87
+ 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;
@@ -85,7 +85,6 @@ class ConfigCommand extends cli_1.BaseCommand {
85
85
  return report.exitCode();
86
86
  }
87
87
  }
88
- exports.default = ConfigCommand;
89
88
  ConfigCommand.paths = [
90
89
  [`config`],
91
90
  ];
@@ -99,3 +98,4 @@ ConfigCommand.usage = clipanion_1.Command.Usage({
99
98
  `$0 config`,
100
99
  ]],
101
100
  });
101
+ exports.default = ConfigCommand;
@@ -72,7 +72,6 @@ class DedupeCommand extends cli_1.BaseCommand {
72
72
  }
73
73
  }
74
74
  }
75
- exports.default = DedupeCommand;
76
75
  DedupeCommand.paths = [
77
76
  [`dedupe`],
78
77
  ];
@@ -91,7 +90,7 @@ DedupeCommand.usage = clipanion_1.Command.Usage({
91
90
 
92
91
  If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
93
92
 
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.
93
+ - \`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
94
 
96
95
  - \`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
96
 
@@ -124,3 +123,4 @@ DedupeCommand.usage = clipanion_1.Command.Usage({
124
123
  `$0 dedupe --check`,
125
124
  ]],
126
125
  });
126
+ 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;
@@ -7,9 +7,9 @@ class HelpCommand extends cli_1.BaseCommand {
7
7
  this.context.stdout.write(this.cli.usage(null));
8
8
  }
9
9
  }
10
- exports.default = HelpCommand;
11
10
  HelpCommand.paths = [
12
11
  [`help`],
13
12
  [`--help`],
14
13
  [`-h`],
15
14
  ];
15
+ exports.default = HelpCommand;
@@ -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;
@@ -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;
@@ -62,7 +62,6 @@ class ExplainPeerRequirementsCommand extends cli_1.BaseCommand {
62
62
  return report.exitCode();
63
63
  }
64
64
  }
65
- exports.default = ExplainPeerRequirementsCommand;
66
65
  ExplainPeerRequirementsCommand.paths = [
67
66
  [`explain`, `peer-requirements`],
68
67
  ];
@@ -85,6 +84,7 @@ ExplainPeerRequirementsCommand.usage = clipanion_1.Command.Usage({
85
84
  `$0 explain peer-requirements`,
86
85
  ]],
87
86
  });
87
+ exports.default = ExplainPeerRequirementsCommand;
88
88
  async function explainPeerRequirements(peerRequirementsHash, project, opts) {
89
89
  const { configuration } = project;
90
90
  const requirement = project.peerRequirements.get(peerRequirementsHash);
@@ -78,7 +78,6 @@ class ExplainCommand extends cli_1.BaseCommand {
78
78
  }
79
79
  }
80
80
  }
81
- exports.default = ExplainCommand;
82
81
  ExplainCommand.paths = [
83
82
  [`explain`],
84
83
  ];
@@ -97,3 +96,4 @@ ExplainCommand.usage = clipanion_1.Command.Usage({
97
96
  `$0 explain`,
98
97
  ]],
99
98
  });
99
+ exports.default = ExplainCommand;
@@ -308,7 +308,6 @@ class InfoCommand extends cli_1.BaseCommand {
308
308
  });
309
309
  }
310
310
  }
311
- exports.default = InfoCommand;
312
311
  InfoCommand.paths = [
313
312
  [`info`],
314
313
  ];
@@ -328,3 +327,4 @@ InfoCommand.usage = clipanion_1.Command.Usage({
328
327
  `$0 info lodash`,
329
328
  ]],
330
329
  });
330
+ exports.default = InfoCommand;
@@ -246,7 +246,6 @@ class YarnCommand extends cli_1.BaseCommand {
246
246
  return report.exitCode();
247
247
  }
248
248
  }
249
- exports.default = YarnCommand;
250
249
  YarnCommand.paths = [
251
250
  [`install`],
252
251
  clipanion_1.Command.Default,
@@ -276,7 +275,7 @@ YarnCommand.usage = clipanion_1.Command.Usage({
276
275
 
277
276
  If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
278
277
 
279
- - \`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.
278
+ - \`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.
280
279
 
281
280
  - \`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.
282
281
  `,
@@ -291,6 +290,7 @@ YarnCommand.usage = clipanion_1.Command.Usage({
291
290
  `$0 install --immutable --immutable-cache --check-cache`,
292
291
  ]],
293
292
  });
293
+ exports.default = YarnCommand;
294
294
  const MERGE_CONFLICT_ANCESTOR = `|||||||`;
295
295
  const MERGE_CONFLICT_END = `>>>>>>>`;
296
296
  const MERGE_CONFLICT_SEP = `=======`;
@@ -71,7 +71,6 @@ class LinkCommand extends cli_1.BaseCommand {
71
71
  return report.exitCode();
72
72
  }
73
73
  }
74
- exports.default = LinkCommand;
75
74
  LinkCommand.paths = [
76
75
  [`link`],
77
76
  ];
@@ -88,3 +87,4 @@ LinkCommand.usage = clipanion_1.Command.Usage({
88
87
  `$0 link ~/jest --all`,
89
88
  ]],
90
89
  });
90
+ exports.default = LinkCommand;
@@ -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;
@@ -56,7 +56,6 @@ class PluginDlSourcesCommand extends cli_1.BaseCommand {
56
56
  return report.exitCode();
57
57
  }
58
58
  }
59
- exports.default = PluginDlSourcesCommand;
60
59
  PluginDlSourcesCommand.paths = [
61
60
  [`plugin`, `import`, `from`, `sources`],
62
61
  ];
@@ -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 = PluginDlSourcesCommand;
79
79
  async function buildAndSavePlugin(pluginSpec, { context, noMinify }, { project, report, target }) {
80
80
  const pluginName = pluginSpec.replace(/@yarnpkg\//, ``);
81
81
  const { configuration } = project;
@@ -69,7 +69,6 @@ class PluginDlCommand extends cli_1.BaseCommand {
69
69
  return report.exitCode();
70
70
  }
71
71
  }
72
- exports.default = PluginDlCommand;
73
72
  PluginDlCommand.paths = [
74
73
  [`plugin`, `import`],
75
74
  ];
@@ -101,6 +100,7 @@ PluginDlCommand.usage = clipanion_1.Command.Usage({
101
100
  `$0 plugin import ./path/to/plugin.js`,
102
101
  ]],
103
102
  });
103
+ exports.default = PluginDlCommand;
104
104
  async function savePlugin(pluginSpec, pluginBuffer, { project, report }) {
105
105
  const { configuration } = project;
106
106
  const vmExports = {};
@@ -39,7 +39,6 @@ class PluginDlCommand extends cli_1.BaseCommand {
39
39
  return report.exitCode();
40
40
  }
41
41
  }
42
- exports.default = PluginDlCommand;
43
42
  PluginDlCommand.paths = [
44
43
  [`plugin`, `list`],
45
44
  ];
@@ -54,3 +53,4 @@ PluginDlCommand.usage = clipanion_1.Command.Usage({
54
53
  `$0 plugin list`,
55
54
  ]],
56
55
  });
56
+ exports.default = PluginDlCommand;
@@ -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;
@@ -30,7 +30,6 @@ class PluginListCommand extends cli_1.BaseCommand {
30
30
  return report.exitCode();
31
31
  }
32
32
  }
33
- exports.default = PluginListCommand;
34
33
  PluginListCommand.paths = [
35
34
  [`plugin`, `runtime`],
36
35
  ];
@@ -45,3 +44,4 @@ PluginListCommand.usage = clipanion_1.Command.Usage({
45
44
  `$0 plugin runtime`,
46
45
  ]],
47
46
  });
47
+ exports.default = PluginListCommand;
@@ -46,7 +46,6 @@ class RunCommand extends cli_1.BaseCommand {
46
46
  return installReport.exitCode();
47
47
  }
48
48
  }
49
- exports.default = RunCommand;
50
49
  RunCommand.paths = [
51
50
  [`rebuild`],
52
51
  ];
@@ -67,3 +66,4 @@ RunCommand.usage = clipanion_1.Command.Usage({
67
66
  `$0 rebuild fsevents`,
68
67
  ]],
69
68
  });
69
+ exports.default = RunCommand;
@@ -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 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.
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;
@@ -7,6 +7,7 @@ export default class RunCommand extends BaseCommand {
7
7
  inspectBrk: string | boolean;
8
8
  topLevel: boolean;
9
9
  binariesOnly: boolean;
10
+ require: string | undefined;
10
11
  silent: boolean | undefined;
11
12
  scriptName: string;
12
13
  args: string[];
@@ -22,6 +22,9 @@ class RunCommand extends cli_1.BaseCommand {
22
22
  this.binariesOnly = clipanion_1.Option.Boolean(`-B,--binaries-only`, false, {
23
23
  description: `Ignore any user defined scripts and only check for binaries`,
24
24
  });
25
+ this.require = clipanion_1.Option.String(`--require`, {
26
+ description: `Forwarded to the underlying Node process when executing a binary`,
27
+ });
25
28
  // The v1 used to print the Yarn version header when using "yarn run", which
26
29
  // was messing with the output of things like `--version` & co. We don't do
27
30
  // this anymore, but many workflows use `yarn run --silent` to make sure that
@@ -64,6 +67,8 @@ class RunCommand extends cli_1.BaseCommand {
64
67
  nodeArgs.push(`--inspect-brk`);
65
68
  }
66
69
  }
70
+ if (this.require)
71
+ nodeArgs.push(`--require=${this.require}`);
67
72
  return await core_2.scriptUtils.executePackageAccessibleBinary(effectiveLocator, this.scriptName, this.args, {
68
73
  cwd: this.context.cwd,
69
74
  project,
@@ -112,7 +117,6 @@ class RunCommand extends cli_1.BaseCommand {
112
117
  }
113
118
  }
114
119
  }
115
- exports.default = RunCommand;
116
120
  RunCommand.paths = [
117
121
  [`run`],
118
122
  ];
@@ -140,3 +144,4 @@ RunCommand.usage = clipanion_1.Command.Usage({
140
144
  `$0 run --inspect-brk webpack`,
141
145
  ]],
142
146
  });
147
+ exports.default = RunCommand;
@@ -32,7 +32,7 @@ class RunCommand extends cli_1.BaseCommand {
32
32
  return report.exitCode();
33
33
  }
34
34
  }
35
- exports.default = RunCommand;
36
35
  RunCommand.paths = [
37
36
  [`run`],
38
37
  ];
38
+ exports.default = RunCommand;
@@ -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;
@@ -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] === `|`;
@@ -75,7 +75,6 @@ class SetVersionCommand extends cli_1.BaseCommand {
75
75
  return report.exitCode();
76
76
  }
77
77
  }
78
- exports.default = SetVersionCommand;
79
78
  SetVersionCommand.paths = [
80
79
  [`set`, `version`],
81
80
  ];
@@ -84,7 +83,7 @@ SetVersionCommand.usage = clipanion_1.Command.Usage({
84
83
  details: `
85
84
  This command will download a specific release of Yarn directly from the Yarn GitHub repository, will store it inside your project, and will change the \`yarnPath\` settings from your project \`.yarnrc.yml\` file to point to the new file.
86
85
 
87
- A very good use case for this command is to enforce the version of Yarn used by the any single member of your team inside a same project - by doing this you ensure that you have control on Yarn upgrades and downgrades (including on your deployment servers), and get rid of most of the headaches related to someone using a slightly different version and getting a different behavior than you.
86
+ A very good use case for this command is to enforce the version of Yarn used by any single member of your team inside the same project - by doing this you ensure that you have control over Yarn upgrades and downgrades (including on your deployment servers), and get rid of most of the headaches related to someone using a slightly different version and getting different behavior.
88
87
 
89
88
  The version specifier can be:
90
89
 
@@ -130,6 +129,7 @@ SetVersionCommand.usage = clipanion_1.Command.Usage({
130
129
  `$0 set version self`,
131
130
  ]],
132
131
  });
132
+ exports.default = SetVersionCommand;
133
133
  async function resolveRange(configuration, request) {
134
134
  const data = await core_2.httpUtils.get(`https://repo.yarnpkg.com/tags`, { configuration, jsonResponse: true });
135
135
  const candidates = data.tags.filter(version => core_2.semverUtils.satisfiesWithPrereleases(version, request));
@@ -72,7 +72,6 @@ class UnlinkCommand extends cli_1.BaseCommand {
72
72
  return report.exitCode();
73
73
  }
74
74
  }
75
- exports.default = UnlinkCommand;
76
75
  UnlinkCommand.paths = [
77
76
  [`unlink`],
78
77
  ];
@@ -95,3 +94,4 @@ UnlinkCommand.usage = clipanion_1.Command.Usage({
95
94
  `$0 unlink '@babel/*' 'pkg-{a,b}'`,
96
95
  ]],
97
96
  });
97
+ exports.default = UnlinkCommand;
@@ -185,7 +185,7 @@ class UpCommand extends cli_1.BaseCommand {
185
185
  ({ answer: selected } = await (0, enquirer_1.prompt)({
186
186
  type: `select`,
187
187
  name: `answer`,
188
- message: `Which range to you want to use in ${core_1.structUtils.prettyWorkspace(configuration, workspace)} ❯ ${target}?`,
188
+ message: `Which range do you want to use in ${core_1.structUtils.prettyWorkspace(configuration, workspace)} ❯ ${target}?`,
189
189
  choices: suggestions.map(({ descriptor, name, reason }) => descriptor ? {
190
190
  name,
191
191
  hint: reason,
@@ -235,7 +235,6 @@ class UpCommand extends cli_1.BaseCommand {
235
235
  return installReport.exitCode();
236
236
  }
237
237
  }
238
- exports.default = UpCommand;
239
238
  UpCommand.paths = [
240
239
  [`up`],
241
240
  ];
@@ -252,7 +251,7 @@ UpCommand.usage = clipanion_1.Command.Usage({
252
251
 
253
252
  If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
254
253
 
255
- - \`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.
254
+ - \`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.
256
255
 
257
256
  - \`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.
258
257
 
@@ -285,3 +284,4 @@ UpCommand.usage = clipanion_1.Command.Usage({
285
284
  UpCommand.schema = [
286
285
  t.hasKeyRelationship(`recursive`, t.KeyRelationship.Forbids, [`interactive`, `exact`, `tilde`, `caret`], { ignore: [undefined, false] }),
287
286
  ];
287
+ exports.default = UpCommand;
@@ -38,7 +38,6 @@ class WhyCommand extends cli_1.BaseCommand {
38
38
  });
39
39
  }
40
40
  }
41
- exports.default = WhyCommand;
42
41
  WhyCommand.paths = [
43
42
  [`why`],
44
43
  ];
@@ -54,6 +53,7 @@ WhyCommand.usage = clipanion_1.Command.Usage({
54
53
  `$0 why lodash`,
55
54
  ]],
56
55
  });
56
+ exports.default = WhyCommand;
57
57
  function whySimple(project, identHash, { configuration, peers }) {
58
58
  const sortedPackages = core_3.miscUtils.sortMap(project.storedPackages.values(), pkg => {
59
59
  return core_3.structUtils.stringifyLocator(pkg);
@@ -18,10 +18,7 @@ class WorkspaceCommand extends cli_1.BaseCommand {
18
18
  if (!cwdWorkspace)
19
19
  throw new cli_1.WorkspaceRequiredError(project.cwd, this.context.cwd);
20
20
  const candidates = project.workspaces;
21
- const candidatesByName = new Map(candidates.map((workspace) => {
22
- const ident = core_2.structUtils.convertToIdent(workspace.locator);
23
- return [core_2.structUtils.stringifyIdent(ident), workspace];
24
- }));
21
+ const candidatesByName = new Map(candidates.map(workspace => [core_2.structUtils.stringifyIdent(workspace.locator), workspace]));
25
22
  const workspace = candidatesByName.get(this.workspaceName);
26
23
  if (workspace === undefined) {
27
24
  const otherNames = Array.from(candidatesByName.keys()).sort();
@@ -30,7 +27,6 @@ class WorkspaceCommand extends cli_1.BaseCommand {
30
27
  return this.cli.run([this.commandName, ...this.args], { cwd: workspace.cwd });
31
28
  }
32
29
  }
33
- exports.default = WorkspaceCommand;
34
30
  WorkspaceCommand.paths = [
35
31
  [`workspace`],
36
32
  ];
@@ -48,3 +44,4 @@ WorkspaceCommand.usage = clipanion_1.Command.Usage({
48
44
  `yarn workspace components run build`,
49
45
  ]],
50
46
  });
47
+ exports.default = WorkspaceCommand;
@@ -5,6 +5,7 @@ export default class WorkspacesListCommand extends BaseCommand {
5
5
  static usage: Usage;
6
6
  since: string | boolean | undefined;
7
7
  recursive: boolean;
8
+ noPrivate: boolean | undefined;
8
9
  verbose: boolean;
9
10
  json: boolean;
10
11
  execute(): Promise<1 | 0>;
@@ -15,6 +15,9 @@ class WorkspacesListCommand extends cli_1.BaseCommand {
15
15
  this.recursive = clipanion_1.Option.Boolean(`-R,--recursive`, false, {
16
16
  description: `Find packages via dependencies/devDependencies instead of using the workspaces field`,
17
17
  });
18
+ this.noPrivate = clipanion_1.Option.Boolean(`--no-private`, {
19
+ description: `Exclude workspaces that have the private field set to true`,
20
+ });
18
21
  this.verbose = clipanion_1.Option.Boolean(`-v,--verbose`, false, {
19
22
  description: `Also return the cross-dependencies between workspaces`,
20
23
  });
@@ -40,6 +43,8 @@ class WorkspacesListCommand extends cli_1.BaseCommand {
40
43
  workspaces.add(dependent);
41
44
  for (const workspace of workspaces) {
42
45
  const { manifest } = workspace;
46
+ if (manifest.private && this.noPrivate)
47
+ continue;
43
48
  let extra;
44
49
  if (this.verbose) {
45
50
  const workspaceDependencies = new Set();
@@ -79,7 +84,6 @@ class WorkspacesListCommand extends cli_1.BaseCommand {
79
84
  return report.exitCode();
80
85
  }
81
86
  }
82
- exports.default = WorkspacesListCommand;
83
87
  WorkspacesListCommand.paths = [
84
88
  [`workspaces`, `list`],
85
89
  ];
@@ -93,6 +97,9 @@ WorkspacesListCommand.usage = clipanion_1.Command.Usage({
93
97
 
94
98
  - If \`-R,--recursive\` is set, Yarn will find workspaces to run the command on by recursively evaluating \`dependencies\` and \`devDependencies\` fields, instead of looking at the \`workspaces\` fields.
95
99
 
100
+ - If \`--no-private\` is set, Yarn will not list any workspaces that have the \`private\` field set to \`true\`.
101
+
96
102
  - If both the \`-v,--verbose\` and \`--json\` options are set, Yarn will also return the cross-dependencies between each workspaces (useful when you wish to automatically generate Buck / Bazel rules).
97
103
  `,
98
104
  });
105
+ exports.default = WorkspacesListCommand;
@@ -15,7 +15,7 @@ var Strategy;
15
15
  * - dependencies are never downgraded
16
16
  */
17
17
  Strategy["HIGHEST"] = "highest";
18
- })(Strategy = exports.Strategy || (exports.Strategy = {}));
18
+ })(Strategy || (exports.Strategy = Strategy = {}));
19
19
  exports.acceptedStrategies = new Set(Object.values(Strategy));
20
20
  const DEDUPE_ALGORITHMS = {
21
21
  highest: async (project, patterns, { resolver, fetcher, resolveOptions, fetchOptions }) => {
@@ -93,7 +93,7 @@ async function dedupe(project, { strategy, patterns, cache, report }) {
93
93
  const algorithm = DEDUPE_ALGORITHMS[strategy];
94
94
  const dedupePromises = await algorithm(project, patterns, { resolver, resolveOptions, fetcher, fetchOptions });
95
95
  const progress = core_1.Report.progressViaCounter(dedupePromises.length);
96
- report.reportProgress(progress);
96
+ await report.reportProgress(progress);
97
97
  let dedupedPackageCount = 0;
98
98
  await Promise.all(dedupePromises.map(dedupePromise => dedupePromise
99
99
  .then(dedupe => {
package/lib/index.d.ts CHANGED
@@ -42,6 +42,7 @@ declare module '@yarnpkg/core' {
42
42
  interface ConfigurationValueMap {
43
43
  enableImmutableInstalls: boolean;
44
44
  defaultSemverRangePrefix: `^` | `~` | ``;
45
+ preferReuse: boolean;
45
46
  }
46
47
  }
47
48
  declare const plugin: Plugin;
package/lib/index.js CHANGED
@@ -57,6 +57,11 @@ const plugin = {
57
57
  values: [`^`, `~`, ``],
58
58
  default: suggestUtils.Modifier.CARET,
59
59
  },
60
+ preferReuse: {
61
+ description: `If true, \`yarn add\` will attempt to reuse the most common dependency range in other workspaces.`,
62
+ type: core_1.SettingsType.BOOLEAN,
63
+ default: false,
64
+ },
60
65
  },
61
66
  commands: [
62
67
  clean_1.default,
@@ -12,19 +12,19 @@ var Target;
12
12
  Target["REGULAR"] = "dependencies";
13
13
  Target["DEVELOPMENT"] = "devDependencies";
14
14
  Target["PEER"] = "peerDependencies";
15
- })(Target = exports.Target || (exports.Target = {}));
15
+ })(Target || (exports.Target = Target = {}));
16
16
  var Modifier;
17
17
  (function (Modifier) {
18
18
  Modifier["CARET"] = "^";
19
19
  Modifier["TILDE"] = "~";
20
20
  Modifier["EXACT"] = "";
21
- })(Modifier = exports.Modifier || (exports.Modifier = {}));
21
+ })(Modifier || (exports.Modifier = Modifier = {}));
22
22
  var WorkspaceModifier;
23
23
  (function (WorkspaceModifier) {
24
24
  WorkspaceModifier["CARET"] = "^";
25
25
  WorkspaceModifier["TILDE"] = "~";
26
26
  WorkspaceModifier["EXACT"] = "*";
27
- })(WorkspaceModifier = exports.WorkspaceModifier || (exports.WorkspaceModifier = {}));
27
+ })(WorkspaceModifier || (exports.WorkspaceModifier = WorkspaceModifier = {}));
28
28
  var Strategy;
29
29
  (function (Strategy) {
30
30
  /**
@@ -52,7 +52,7 @@ var Strategy;
52
52
  * versions of the package that are already within our cache.
53
53
  */
54
54
  Strategy["CACHE"] = "cache";
55
- })(Strategy = exports.Strategy || (exports.Strategy = {}));
55
+ })(Strategy || (exports.Strategy = Strategy = {}));
56
56
  function getModifier(flags, project) {
57
57
  if (flags.exact)
58
58
  return Modifier.EXACT;
@@ -109,7 +109,7 @@ async function findProjectDescriptors(ident, { project, target }) {
109
109
  if (target === Target.PEER) {
110
110
  const peerDescriptor = workspace.manifest.peerDependencies.get(ident.identHash);
111
111
  if (peerDescriptor !== undefined) {
112
- getDescriptorEntry(peerDescriptor).locators.push(workspace.locator);
112
+ getDescriptorEntry(peerDescriptor).locators.push(workspace.anchoredLocator);
113
113
  }
114
114
  }
115
115
  else {
@@ -117,18 +117,18 @@ async function findProjectDescriptors(ident, { project, target }) {
117
117
  const developmentDescriptor = workspace.manifest.devDependencies.get(ident.identHash);
118
118
  if (target === Target.DEVELOPMENT) {
119
119
  if (developmentDescriptor !== undefined) {
120
- getDescriptorEntry(developmentDescriptor).locators.push(workspace.locator);
120
+ getDescriptorEntry(developmentDescriptor).locators.push(workspace.anchoredLocator);
121
121
  }
122
122
  else if (regularDescriptor !== undefined) {
123
- getDescriptorEntry(regularDescriptor).locators.push(workspace.locator);
123
+ getDescriptorEntry(regularDescriptor).locators.push(workspace.anchoredLocator);
124
124
  }
125
125
  }
126
126
  else {
127
127
  if (regularDescriptor !== undefined) {
128
- getDescriptorEntry(regularDescriptor).locators.push(workspace.locator);
128
+ getDescriptorEntry(regularDescriptor).locators.push(workspace.anchoredLocator);
129
129
  }
130
130
  else if (developmentDescriptor !== undefined) {
131
- getDescriptorEntry(developmentDescriptor).locators.push(workspace.locator);
131
+ getDescriptorEntry(developmentDescriptor).locators.push(workspace.anchoredLocator);
132
132
  }
133
133
  }
134
134
  }
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@yarnpkg/plugin-essentials",
3
- "version": "3.2.3",
3
+ "version": "3.4.0",
4
4
  "license": "BSD-2-Clause",
5
5
  "main": "./lib/index.js",
6
6
  "dependencies": {
7
- "@yarnpkg/fslib": "^2.8.0",
8
- "@yarnpkg/json-proxy": "^2.1.1",
9
- "@yarnpkg/parsers": "^2.5.1",
7
+ "@yarnpkg/fslib": "^2.10.3",
8
+ "@yarnpkg/parsers": "^2.6.0",
10
9
  "ci-info": "^3.2.0",
11
10
  "clipanion": "3.2.0-rc.4",
12
11
  "enquirer": "^2.3.6",
@@ -17,18 +16,17 @@
17
16
  "typanion": "^3.3.0"
18
17
  },
19
18
  "peerDependencies": {
20
- "@yarnpkg/cli": "^3.2.4",
21
- "@yarnpkg/core": "^3.2.5",
22
- "@yarnpkg/plugin-git": "^2.6.2"
19
+ "@yarnpkg/cli": "^3.7.0",
20
+ "@yarnpkg/core": "^3.6.0",
21
+ "@yarnpkg/plugin-git": "^2.6.7"
23
22
  },
24
23
  "devDependencies": {
25
24
  "@types/lodash": "^4.14.136",
26
25
  "@types/micromatch": "^4.0.1",
27
26
  "@types/semver": "^7.1.0",
28
- "@types/treeify": "^1.0.0",
29
- "@yarnpkg/cli": "^3.2.4",
30
- "@yarnpkg/core": "^3.2.5",
31
- "@yarnpkg/plugin-git": "^2.6.2"
27
+ "@yarnpkg/cli": "^3.7.0",
28
+ "@yarnpkg/core": "^3.6.0",
29
+ "@yarnpkg/plugin-git": "^2.6.7"
32
30
  },
33
31
  "repository": {
34
32
  "type": "git",