@yarnpkg/plugin-essentials 4.0.0-rc.1 → 4.0.0-rc.2

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.
@@ -65,17 +65,18 @@ class AddCommand extends cli_1.BaseCommand {
65
65
  });
66
66
  const fixed = this.fixed;
67
67
  const interactive = (_a = this.interactive) !== null && _a !== void 0 ? _a : configuration.get(`preferInteractive`);
68
+ const reuse = interactive || configuration.get(`preferReuse`);
68
69
  const modifier = suggestUtils.getModifier(this, project);
69
70
  const strategies = [
70
- ...interactive ? [
71
- suggestUtils.Strategy.REUSE,
72
- ] : [],
71
+ reuse ?
72
+ suggestUtils.Strategy.REUSE
73
+ : undefined,
73
74
  suggestUtils.Strategy.PROJECT,
74
- ...this.cached ? [
75
- suggestUtils.Strategy.CACHE,
76
- ] : [],
75
+ this.cached ?
76
+ suggestUtils.Strategy.CACHE
77
+ : undefined,
77
78
  suggestUtils.Strategy.LATEST,
78
- ];
79
+ ].filter((strategy) => typeof strategy !== `undefined`);
79
80
  const maxResults = interactive
80
81
  ? Infinity
81
82
  : 1;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { BaseCommand } from '@yarnpkg/cli';
3
4
  import { Project, Report } from '@yarnpkg/core';
4
5
  import { Usage } from 'clipanion';
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { BaseCommand } from '@yarnpkg/cli';
3
4
  import { Configuration, Report } from '@yarnpkg/core';
4
5
  import { Usage } from 'clipanion';
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,
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@yarnpkg/plugin-essentials",
3
- "version": "4.0.0-rc.1",
3
+ "version": "4.0.0-rc.2",
4
4
  "license": "BSD-2-Clause",
5
5
  "main": "./lib/index.js",
6
6
  "dependencies": {
7
- "@yarnpkg/fslib": "^3.0.0-rc.1",
8
- "@yarnpkg/parsers": "^3.0.0-rc.1",
7
+ "@yarnpkg/fslib": "^3.0.0-rc.2",
8
+ "@yarnpkg/parsers": "^3.0.0-rc.2",
9
9
  "ci-info": "^3.2.0",
10
10
  "clipanion": "^3.2.0-rc.10",
11
11
  "enquirer": "^2.3.6",
@@ -16,17 +16,17 @@
16
16
  "typanion": "^3.3.0"
17
17
  },
18
18
  "peerDependencies": {
19
- "@yarnpkg/cli": "^4.0.0-rc.1",
20
- "@yarnpkg/core": "^4.0.0-rc.1",
21
- "@yarnpkg/plugin-git": "^3.0.0-rc.1"
19
+ "@yarnpkg/cli": "^4.0.0-rc.2",
20
+ "@yarnpkg/core": "^4.0.0-rc.2",
21
+ "@yarnpkg/plugin-git": "^3.0.0-rc.2"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/lodash": "^4.14.136",
25
25
  "@types/micromatch": "^4.0.1",
26
26
  "@types/semver": "^7.1.0",
27
- "@yarnpkg/cli": "^4.0.0-rc.1",
28
- "@yarnpkg/core": "^4.0.0-rc.1",
29
- "@yarnpkg/plugin-git": "^3.0.0-rc.1"
27
+ "@yarnpkg/cli": "^4.0.0-rc.2",
28
+ "@yarnpkg/core": "^4.0.0-rc.2",
29
+ "@yarnpkg/plugin-git": "^3.0.0-rc.2"
30
30
  },
31
31
  "repository": {
32
32
  "type": "git",