@yarnpkg/plugin-essentials 4.0.0-rc.44 → 4.0.0-rc.46
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/install.js +47 -6
- package/lib/dedupeUtils.js +1 -1
- package/lib/suggestUtils.js +4 -4
- package/package.json +11 -11
package/lib/commands/install.js
CHANGED
|
@@ -172,8 +172,16 @@ class YarnCommand extends cli_1.BaseCommand {
|
|
|
172
172
|
stdout: this.context.stdout,
|
|
173
173
|
includeFooter: false,
|
|
174
174
|
}, async (report) => {
|
|
175
|
+
let changed = false;
|
|
176
|
+
if (await autofixLegacyPlugins(configuration, immutable)) {
|
|
177
|
+
report.reportInfo(core_1.MessageName.AUTOMERGE_SUCCESS, `Automatically removed core plugins that are now builtins 👍`);
|
|
178
|
+
changed = true;
|
|
179
|
+
}
|
|
175
180
|
if (await autofixMergeConflicts(configuration, immutable)) {
|
|
176
181
|
report.reportInfo(core_1.MessageName.AUTOMERGE_SUCCESS, `Automatically fixed merge conflicts 👍`);
|
|
182
|
+
changed = true;
|
|
183
|
+
}
|
|
184
|
+
if (changed) {
|
|
177
185
|
report.reportSeparator();
|
|
178
186
|
}
|
|
179
187
|
});
|
|
@@ -368,14 +376,14 @@ async function autofixMergeConflicts(configuration, immutable) {
|
|
|
368
376
|
const merged = Object.assign({}, ...variants);
|
|
369
377
|
// We must keep the lockfile version as small as necessary to force Yarn to
|
|
370
378
|
// refresh the merged-in lockfile metadata that may be missing.
|
|
371
|
-
merged.__metadata.version = Math.min(
|
|
379
|
+
merged.__metadata.version = `${Math.min(...variants.map(variant => {
|
|
372
380
|
var _a;
|
|
373
|
-
return (_a = variant.__metadata.version) !== null && _a !== void 0 ? _a :
|
|
374
|
-
}))
|
|
375
|
-
merged.__metadata.cacheKey = Math.min(
|
|
381
|
+
return parseInt((_a = variant.__metadata.version) !== null && _a !== void 0 ? _a : 0);
|
|
382
|
+
}))}`;
|
|
383
|
+
merged.__metadata.cacheKey = `${Math.min(...variants.map(variant => {
|
|
376
384
|
var _a;
|
|
377
|
-
return (_a = variant.__metadata.cacheKey) !== null && _a !== void 0 ? _a : 0;
|
|
378
|
-
}))
|
|
385
|
+
return parseInt((_a = variant.__metadata.cacheKey) !== null && _a !== void 0 ? _a : 0);
|
|
386
|
+
}))}`;
|
|
379
387
|
// parse as valid YAML except that the objects become strings. We can use
|
|
380
388
|
// that to detect them. Damn, it's really ugly though.
|
|
381
389
|
for (const [key, value] of Object.entries(merged))
|
|
@@ -386,3 +394,36 @@ async function autofixMergeConflicts(configuration, immutable) {
|
|
|
386
394
|
});
|
|
387
395
|
return true;
|
|
388
396
|
}
|
|
397
|
+
async function autofixLegacyPlugins(configuration, immutable) {
|
|
398
|
+
if (!configuration.projectCwd)
|
|
399
|
+
return false;
|
|
400
|
+
const legacyPlugins = [];
|
|
401
|
+
const yarnPluginDir = fslib_1.ppath.join(configuration.projectCwd, `.yarn/plugins/@yarnpkg`);
|
|
402
|
+
const changed = await core_1.Configuration.updateConfiguration(configuration.projectCwd, current => {
|
|
403
|
+
if (!Array.isArray(current.plugins))
|
|
404
|
+
return current;
|
|
405
|
+
const plugins = current.plugins.filter((plugin) => {
|
|
406
|
+
if (!plugin.path)
|
|
407
|
+
return true;
|
|
408
|
+
const resolvedPath = fslib_1.ppath.resolve(configuration.projectCwd, plugin.path);
|
|
409
|
+
const isLegacy = core_1.LEGACY_PLUGINS.has(plugin.spec) && fslib_1.ppath.contains(yarnPluginDir, resolvedPath);
|
|
410
|
+
if (isLegacy)
|
|
411
|
+
legacyPlugins.push(resolvedPath);
|
|
412
|
+
return !isLegacy;
|
|
413
|
+
});
|
|
414
|
+
if (current.plugins.length === plugins.length)
|
|
415
|
+
return current;
|
|
416
|
+
return {
|
|
417
|
+
...current,
|
|
418
|
+
plugins,
|
|
419
|
+
};
|
|
420
|
+
}, {
|
|
421
|
+
immutable,
|
|
422
|
+
});
|
|
423
|
+
if (!changed)
|
|
424
|
+
return false;
|
|
425
|
+
await Promise.all(legacyPlugins.map(async (pluginPath) => {
|
|
426
|
+
await fslib_1.xfs.removePromise(pluginPath);
|
|
427
|
+
}));
|
|
428
|
+
return true;
|
|
429
|
+
}
|
package/lib/dedupeUtils.js
CHANGED
|
@@ -15,7 +15,7 @@ var Strategy;
|
|
|
15
15
|
* - dependencies are never downgraded
|
|
16
16
|
*/
|
|
17
17
|
Strategy["HIGHEST"] = "highest";
|
|
18
|
-
})(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 }) => {
|
package/lib/suggestUtils.js
CHANGED
|
@@ -12,19 +12,19 @@ var Target;
|
|
|
12
12
|
Target["REGULAR"] = "dependencies";
|
|
13
13
|
Target["DEVELOPMENT"] = "devDependencies";
|
|
14
14
|
Target["PEER"] = "peerDependencies";
|
|
15
|
-
})(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
|
|
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
|
|
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
|
|
55
|
+
})(Strategy || (exports.Strategy = Strategy = {}));
|
|
56
56
|
function getModifier(flags, project) {
|
|
57
57
|
if (flags.exact)
|
|
58
58
|
return Modifier.EXACT;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarnpkg/plugin-essentials",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.46",
|
|
4
4
|
"stableVersion": "3.3.0",
|
|
5
5
|
"license": "BSD-2-Clause",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -9,29 +9,29 @@
|
|
|
9
9
|
"./package.json": "./package.json"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@yarnpkg/fslib": "^3.0.0-rc.
|
|
13
|
-
"@yarnpkg/parsers": "^3.0.0-rc.
|
|
12
|
+
"@yarnpkg/fslib": "^3.0.0-rc.46",
|
|
13
|
+
"@yarnpkg/parsers": "^3.0.0-rc.46",
|
|
14
14
|
"ci-info": "^3.2.0",
|
|
15
|
-
"clipanion": "^3.2.
|
|
15
|
+
"clipanion": "^3.2.1",
|
|
16
16
|
"enquirer": "^2.3.6",
|
|
17
17
|
"lodash": "^4.17.15",
|
|
18
18
|
"micromatch": "^4.0.2",
|
|
19
19
|
"semver": "^7.1.2",
|
|
20
20
|
"tslib": "^2.4.0",
|
|
21
|
-
"typanion": "^3.
|
|
21
|
+
"typanion": "^3.12.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@yarnpkg/cli": "^4.0.0-rc.
|
|
25
|
-
"@yarnpkg/core": "^4.0.0-rc.
|
|
26
|
-
"@yarnpkg/plugin-git": "^3.0.0-rc.
|
|
24
|
+
"@yarnpkg/cli": "^4.0.0-rc.46",
|
|
25
|
+
"@yarnpkg/core": "^4.0.0-rc.46",
|
|
26
|
+
"@yarnpkg/plugin-git": "^3.0.0-rc.46"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/lodash": "^4.14.136",
|
|
30
30
|
"@types/micromatch": "^4.0.1",
|
|
31
31
|
"@types/semver": "^7.1.0",
|
|
32
|
-
"@yarnpkg/cli": "^4.0.0-rc.
|
|
33
|
-
"@yarnpkg/core": "^4.0.0-rc.
|
|
34
|
-
"@yarnpkg/plugin-git": "^3.0.0-rc.
|
|
32
|
+
"@yarnpkg/cli": "^4.0.0-rc.46",
|
|
33
|
+
"@yarnpkg/core": "^4.0.0-rc.46",
|
|
34
|
+
"@yarnpkg/plugin-git": "^3.0.0-rc.46"
|
|
35
35
|
},
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|