@yarnpkg/plugin-essentials 4.0.0-rc.47 → 4.0.0-rc.48
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
CHANGED
|
@@ -441,24 +441,25 @@ async function autofixLegacyPlugins(configuration, immutable) {
|
|
|
441
441
|
return false;
|
|
442
442
|
const legacyPlugins = [];
|
|
443
443
|
const yarnPluginDir = fslib_1.ppath.join(configuration.projectCwd, `.yarn/plugins/@yarnpkg`);
|
|
444
|
-
const changed = await core_1.Configuration.updateConfiguration(configuration.projectCwd,
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
444
|
+
const changed = await core_1.Configuration.updateConfiguration(configuration.projectCwd, {
|
|
445
|
+
plugins: plugins => {
|
|
446
|
+
if (!Array.isArray(plugins))
|
|
447
|
+
return plugins;
|
|
448
|
+
const filteredPlugins = plugins.filter((plugin) => {
|
|
449
|
+
if (!plugin.path)
|
|
450
|
+
return true;
|
|
451
|
+
const resolvedPath = fslib_1.ppath.resolve(configuration.projectCwd, plugin.path);
|
|
452
|
+
const isLegacy = core_1.LEGACY_PLUGINS.has(plugin.spec) && fslib_1.ppath.contains(yarnPluginDir, resolvedPath);
|
|
453
|
+
if (isLegacy)
|
|
454
|
+
legacyPlugins.push(resolvedPath);
|
|
455
|
+
return !isLegacy;
|
|
456
|
+
});
|
|
457
|
+
if (filteredPlugins.length === 0)
|
|
458
|
+
return core_1.Configuration.deleteProperty;
|
|
459
|
+
if (filteredPlugins.length === plugins.length)
|
|
460
|
+
return plugins;
|
|
461
|
+
return filteredPlugins;
|
|
462
|
+
},
|
|
462
463
|
}, {
|
|
463
464
|
immutable,
|
|
464
465
|
});
|
|
@@ -28,18 +28,19 @@ class PluginRemoveCommand extends cli_1.BaseCommand {
|
|
|
28
28
|
await fslib_1.xfs.removePromise(absolutePath);
|
|
29
29
|
}
|
|
30
30
|
report.reportInfo(core_1.MessageName.UNNAMED, `Updating the configuration...`);
|
|
31
|
-
await core_1.Configuration.updateConfiguration(project.cwd,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
await core_1.Configuration.updateConfiguration(project.cwd, {
|
|
32
|
+
plugins: plugins => {
|
|
33
|
+
if (!Array.isArray(plugins))
|
|
34
|
+
return plugins;
|
|
35
|
+
const filteredPlugins = plugins.filter((plugin) => {
|
|
36
|
+
return plugin.path !== relativePath;
|
|
37
|
+
});
|
|
38
|
+
if (filteredPlugins.length === 0)
|
|
39
|
+
return core_1.Configuration.deleteProperty;
|
|
40
|
+
if (filteredPlugins.length === plugins.length)
|
|
41
|
+
return plugins;
|
|
42
|
+
return filteredPlugins;
|
|
43
|
+
},
|
|
43
44
|
});
|
|
44
45
|
});
|
|
45
46
|
return report.exitCode();
|
|
@@ -27,10 +27,11 @@ const cloneWorkflow = ({ repository, branch }, target) => [
|
|
|
27
27
|
const updateWorkflow = ({ branch }) => [
|
|
28
28
|
[`git`, `fetch`, `origin`, `--depth=1`, getBranchRef(branch), `--force`],
|
|
29
29
|
[`git`, `reset`, `--hard`, `FETCH_HEAD`],
|
|
30
|
-
[`git`, `clean`, `-dfx`],
|
|
30
|
+
[`git`, `clean`, `-dfx`, `-e`, `packages/yarnpkg-cli/bundles`],
|
|
31
31
|
];
|
|
32
|
-
const buildWorkflow = ({ plugins, noMinify }, target) => [
|
|
32
|
+
const buildWorkflow = ({ plugins, noMinify }, output, target) => [
|
|
33
33
|
[`yarn`, `build:cli`, ...new Array().concat(...plugins.map(plugin => [`--plugin`, fslib_1.ppath.resolve(target, plugin)])), ...noMinify ? [`--no-minify`] : [], `|`],
|
|
34
|
+
[`mv`, `packages/yarnpkg-cli/bundles/yarn.js`, fslib_1.npath.fromPortablePath(output), `|`],
|
|
34
35
|
];
|
|
35
36
|
// eslint-disable-next-line arca/no-default-export
|
|
36
37
|
class SetVersionSourcesCommand extends cli_1.BaseCommand {
|
|
@@ -48,6 +49,9 @@ class SetVersionSourcesCommand extends cli_1.BaseCommand {
|
|
|
48
49
|
this.plugins = clipanion_1.Option.Array(`--plugin`, [], {
|
|
49
50
|
description: `An array of additional plugins that should be included in the bundle`,
|
|
50
51
|
});
|
|
52
|
+
this.dryRun = clipanion_1.Option.Boolean(`-n,--dry-run`, false, {
|
|
53
|
+
description: `If set, the bundle will be built but not added to the project`,
|
|
54
|
+
});
|
|
51
55
|
this.noMinify = clipanion_1.Option.Boolean(`--no-minify`, false, {
|
|
52
56
|
description: `Build a bundle for development (debugging) - non-minified and non-mangled`,
|
|
53
57
|
});
|
|
@@ -72,15 +76,20 @@ class SetVersionSourcesCommand extends cli_1.BaseCommand {
|
|
|
72
76
|
report.reportSeparator();
|
|
73
77
|
report.reportInfo(core_1.MessageName.UNNAMED, `Building a fresh bundle`);
|
|
74
78
|
report.reportSeparator();
|
|
75
|
-
await
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
const commitHash = await core_1.execUtils.execvp(`git`, [`rev-parse`, `--short`, `HEAD`], { cwd: target, strict: true });
|
|
80
|
+
const bundlePath = fslib_1.ppath.join(target, `packages/yarnpkg-cli/bundles/yarn-${commitHash.stdout.trim()}.js`);
|
|
81
|
+
if (!fslib_1.xfs.existsSync(bundlePath)) {
|
|
82
|
+
await runWorkflow(buildWorkflow(this, bundlePath, target), { configuration, context: this.context, target });
|
|
83
|
+
report.reportSeparator();
|
|
84
|
+
}
|
|
78
85
|
const bundleBuffer = await fslib_1.xfs.readFilePromise(bundlePath);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
if (!this.dryRun) {
|
|
87
|
+
const { bundleVersion } = await (0, version_1.setVersion)(configuration, null, async () => bundleBuffer, {
|
|
88
|
+
report,
|
|
89
|
+
});
|
|
90
|
+
if (!this.skipPlugins) {
|
|
91
|
+
await updatePlugins(this, bundleVersion, { project, report, target });
|
|
92
|
+
}
|
|
84
93
|
}
|
|
85
94
|
});
|
|
86
95
|
return report.exitCode();
|
|
@@ -141,7 +150,7 @@ async function prepareRepo(spec, { configuration, report, target }) {
|
|
|
141
150
|
await runWorkflow(updateWorkflow(spec), { configuration, context: spec.context, target });
|
|
142
151
|
ready = true;
|
|
143
152
|
}
|
|
144
|
-
catch
|
|
153
|
+
catch {
|
|
145
154
|
report.reportSeparator();
|
|
146
155
|
report.reportWarning(core_1.MessageName.UNNAMED, `Repository update failed; we'll try to regenerate it`);
|
|
147
156
|
}
|
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.48",
|
|
4
4
|
"stableVersion": "3.3.0",
|
|
5
5
|
"license": "BSD-2-Clause",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -9,8 +9,8 @@
|
|
|
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.48",
|
|
13
|
+
"@yarnpkg/parsers": "^3.0.0-rc.48",
|
|
14
14
|
"ci-info": "^3.2.0",
|
|
15
15
|
"clipanion": "^3.2.1",
|
|
16
16
|
"enquirer": "^2.3.6",
|
|
@@ -21,17 +21,17 @@
|
|
|
21
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.48",
|
|
25
|
+
"@yarnpkg/core": "^4.0.0-rc.48",
|
|
26
|
+
"@yarnpkg/plugin-git": "^3.0.0-rc.48"
|
|
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.48",
|
|
33
|
+
"@yarnpkg/core": "^4.0.0-rc.48",
|
|
34
|
+
"@yarnpkg/plugin-git": "^3.0.0-rc.48"
|
|
35
35
|
},
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|