@yarnpkg/cli 3.2.0-rc.9 → 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.
- package/lib/main.js +19 -15
- package/lib/pluginCommands.d.ts +1 -1
- package/lib/pluginCommands.js +1 -25
- package/lib/tools/getDynamicLibs.js +9 -12
- package/lib/tools/getPluginConfiguration.js +1 -1
- package/lib/tools/getPluginConfiguration.val.js +1 -3
- package/package.json +45 -35
- package/lib/tools/backportClipanionCompatibility.d.ts +0 -1
- package/lib/tools/backportClipanionCompatibility.js +0 -26
package/lib/main.js
CHANGED
|
@@ -52,12 +52,15 @@ async function main({ binaryVersion, pluginConfiguration }) {
|
|
|
52
52
|
}
|
|
53
53
|
async function exec(cli) {
|
|
54
54
|
// Non-exhaustive known requirements:
|
|
55
|
-
// - 14.
|
|
56
|
-
// - 14.10.0 broken streams - https://github.com/nodejs/node/pull/34035 (fix: https://github.com/nodejs/node/commit/0f94c6b4e4)
|
|
55
|
+
// - 14.15 is the first LTS release
|
|
57
56
|
var _a, _b, _c, _d, _e;
|
|
58
57
|
const version = process.versions.node;
|
|
59
|
-
const range = `>=
|
|
60
|
-
|
|
58
|
+
const range = `>=14.15.0`;
|
|
59
|
+
// YARN_IGNORE_NODE is special because this code needs to execute as early as possible.
|
|
60
|
+
// It's not a regular core setting because Configuration.find may use functions not available
|
|
61
|
+
// on older Node versions.
|
|
62
|
+
const ignoreNode = core_1.miscUtils.parseOptionalBoolean(process.env.YARN_IGNORE_NODE);
|
|
63
|
+
if (!ignoreNode && !core_1.semverUtils.satisfiesWithPrereleases(version, range))
|
|
61
64
|
throw new clipanion_1.UsageError(`This tool requires a Node version compatible with ${range} (got ${version}). Upgrade Node, or set \`YARN_IGNORE_NODE=1\` in your environment.`);
|
|
62
65
|
// Since we only care about a few very specific settings (yarn-path and ignore-path) we tolerate extra configuration key.
|
|
63
66
|
// If we didn't, we wouldn't even be able to run `yarn config` (which is recommended in the invalid config error message)
|
|
@@ -72,11 +75,11 @@ async function main({ binaryVersion, pluginConfiguration }) {
|
|
|
72
75
|
const tryRead = (p) => fslib_1.xfs.readFilePromise(p).catch(() => {
|
|
73
76
|
return Buffer.of();
|
|
74
77
|
});
|
|
75
|
-
const isSameBinary = async () => yarnPath === selfPath ||
|
|
78
|
+
const isSameBinary = async () => yarnPath && (yarnPath === selfPath ||
|
|
76
79
|
Buffer.compare(...await Promise.all([
|
|
77
80
|
tryRead(yarnPath),
|
|
78
81
|
tryRead(selfPath),
|
|
79
|
-
])) === 0;
|
|
82
|
+
])) === 0);
|
|
80
83
|
// Avoid unnecessary spawn when run directly
|
|
81
84
|
if (!ignorePath && !ignoreCwd && await isSameBinary()) {
|
|
82
85
|
process.env.YARN_IGNORE_PATH = `1`;
|
|
@@ -112,7 +115,15 @@ async function main({ binaryVersion, pluginConfiguration }) {
|
|
|
112
115
|
cli.register(command);
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
|
-
const
|
|
118
|
+
const context = {
|
|
119
|
+
cwd: fslib_1.npath.toPortablePath(process.cwd()),
|
|
120
|
+
plugins: pluginConfiguration,
|
|
121
|
+
quiet: false,
|
|
122
|
+
stdin: process.stdin,
|
|
123
|
+
stdout: process.stdout,
|
|
124
|
+
stderr: process.stderr,
|
|
125
|
+
};
|
|
126
|
+
const command = cli.process(process.argv.slice(2), context);
|
|
116
127
|
if (!command.help)
|
|
117
128
|
(_e = core_1.Configuration.telemetry) === null || _e === void 0 ? void 0 : _e.reportCommandName(command.path.join(` `));
|
|
118
129
|
// @ts-expect-error: The cwd is a global option defined by BaseCommand
|
|
@@ -126,14 +137,7 @@ async function main({ binaryVersion, pluginConfiguration }) {
|
|
|
126
137
|
return;
|
|
127
138
|
}
|
|
128
139
|
}
|
|
129
|
-
await cli.runExit(command,
|
|
130
|
-
cwd: fslib_1.npath.toPortablePath(process.cwd()),
|
|
131
|
-
plugins: pluginConfiguration,
|
|
132
|
-
quiet: false,
|
|
133
|
-
stdin: process.stdin,
|
|
134
|
-
stdout: process.stdout,
|
|
135
|
-
stderr: process.stderr,
|
|
136
|
-
});
|
|
140
|
+
await cli.runExit(command, context);
|
|
137
141
|
}
|
|
138
142
|
}
|
|
139
143
|
return run()
|
package/lib/pluginCommands.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const pluginCommands: Map<string, string[]
|
|
1
|
+
export declare const pluginCommands: Map<string, string[]>;
|
package/lib/pluginCommands.js
CHANGED
|
@@ -3,28 +3,4 @@
|
|
|
3
3
|
// yarn build:plugin-commands
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.pluginCommands = void 0;
|
|
6
|
-
exports.pluginCommands = new Map([
|
|
7
|
-
[`constraints`, [
|
|
8
|
-
[`constraints`, `query`],
|
|
9
|
-
[`constraints`, `source`],
|
|
10
|
-
[`constraints`],
|
|
11
|
-
]],
|
|
12
|
-
[`exec`, []],
|
|
13
|
-
[`interactive-tools`, [
|
|
14
|
-
[`search`],
|
|
15
|
-
[`upgrade-interactive`],
|
|
16
|
-
]],
|
|
17
|
-
[`stage`, [
|
|
18
|
-
[`stage`],
|
|
19
|
-
]],
|
|
20
|
-
[`typescript`, []],
|
|
21
|
-
[`version`, [
|
|
22
|
-
[`version`, `apply`],
|
|
23
|
-
[`version`, `check`],
|
|
24
|
-
[`version`],
|
|
25
|
-
]],
|
|
26
|
-
[`workspace-tools`, [
|
|
27
|
-
[`workspaces`, `focus`],
|
|
28
|
-
[`workspaces`, `foreach`],
|
|
29
|
-
]],
|
|
30
|
-
]);
|
|
6
|
+
exports.pluginCommands = new Map([]);
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDynamicLibs = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const cli =
|
|
6
|
-
const core =
|
|
7
|
-
const fslib =
|
|
8
|
-
const libzip =
|
|
9
|
-
const parsers =
|
|
10
|
-
const shell =
|
|
11
|
-
const clipanion =
|
|
12
|
-
const semver =
|
|
13
|
-
const typanion =
|
|
14
|
-
const yup = (0, tslib_1.__importStar)(require("yup"));
|
|
5
|
+
const cli = tslib_1.__importStar(require("@yarnpkg/cli"));
|
|
6
|
+
const core = tslib_1.__importStar(require("@yarnpkg/core"));
|
|
7
|
+
const fslib = tslib_1.__importStar(require("@yarnpkg/fslib"));
|
|
8
|
+
const libzip = tslib_1.__importStar(require("@yarnpkg/libzip"));
|
|
9
|
+
const parsers = tslib_1.__importStar(require("@yarnpkg/parsers"));
|
|
10
|
+
const shell = tslib_1.__importStar(require("@yarnpkg/shell"));
|
|
11
|
+
const clipanion = tslib_1.__importStar(require("clipanion"));
|
|
12
|
+
const semver = tslib_1.__importStar(require("semver"));
|
|
13
|
+
const typanion = tslib_1.__importStar(require("typanion"));
|
|
15
14
|
const getDynamicLibs = () => new Map([
|
|
16
15
|
[`@yarnpkg/cli`, cli],
|
|
17
16
|
[`@yarnpkg/core`, core],
|
|
@@ -23,7 +22,5 @@ const getDynamicLibs = () => new Map([
|
|
|
23
22
|
[`clipanion`, clipanion],
|
|
24
23
|
[`semver`, semver],
|
|
25
24
|
[`typanion`, typanion],
|
|
26
|
-
// TODO: remove in next major
|
|
27
|
-
[`yup`, yup],
|
|
28
25
|
]);
|
|
29
26
|
exports.getDynamicLibs = getDynamicLibs;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getPluginConfiguration = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
// @ts-expect-error
|
|
6
|
-
const package_json_1 =
|
|
6
|
+
const package_json_1 = tslib_1.__importDefault(require("@yarnpkg/cli/package.json"));
|
|
7
7
|
const getDynamicLibs_1 = require("./getDynamicLibs");
|
|
8
8
|
function getPluginConfiguration() {
|
|
9
9
|
const plugins = new Set();
|
|
@@ -7,7 +7,7 @@ module.exports = ({modules, plugins}) => {
|
|
|
7
7
|
}).join(``);
|
|
8
8
|
|
|
9
9
|
const moduleSegment = ` modules: new Map([\n${modules.map((request, index) => {
|
|
10
|
-
return ` [${JSON.stringify(require(`${request}/package.json`).name)},
|
|
10
|
+
return ` [${JSON.stringify(require(`${request}/package.json`).name)}, _${index}],\n`;
|
|
11
11
|
}).join(``)} ]),\n`;
|
|
12
12
|
|
|
13
13
|
const pluginSegment = ` plugins: new Set([\n${plugins.map(request => {
|
|
@@ -16,8 +16,6 @@ module.exports = ({modules, plugins}) => {
|
|
|
16
16
|
|
|
17
17
|
return {
|
|
18
18
|
code: [
|
|
19
|
-
`import {backportClipanionCompatibility} from './backportClipanionCompatibility';\n`,
|
|
20
|
-
`\n`,
|
|
21
19
|
importSegment,
|
|
22
20
|
`export const getPluginConfiguration = () => ({\n`,
|
|
23
21
|
moduleSegment,
|
package/package.json
CHANGED
|
@@ -1,49 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarnpkg/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-rc.2",
|
|
4
4
|
"license": "BSD-2-Clause",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@yarnpkg/core": "^
|
|
8
|
-
"@yarnpkg/fslib": "^
|
|
9
|
-
"@yarnpkg/libzip": "^
|
|
10
|
-
"@yarnpkg/parsers": "^
|
|
11
|
-
"@yarnpkg/plugin-compat": "^
|
|
12
|
-
"@yarnpkg/plugin-
|
|
13
|
-
"@yarnpkg/plugin-
|
|
14
|
-
"@yarnpkg/plugin-
|
|
15
|
-
"@yarnpkg/plugin-
|
|
16
|
-
"@yarnpkg/plugin-
|
|
17
|
-
"@yarnpkg/plugin-
|
|
18
|
-
"@yarnpkg/plugin-
|
|
19
|
-
"@yarnpkg/plugin-
|
|
20
|
-
"@yarnpkg/plugin-
|
|
21
|
-
"@yarnpkg/plugin-
|
|
22
|
-
"@yarnpkg/plugin-
|
|
23
|
-
"@yarnpkg/plugin-
|
|
24
|
-
"@yarnpkg/plugin-
|
|
25
|
-
"@yarnpkg/plugin-
|
|
26
|
-
"@yarnpkg/plugin-
|
|
27
|
-
"@yarnpkg/
|
|
28
|
-
"
|
|
7
|
+
"@yarnpkg/core": "^4.0.0-rc.2",
|
|
8
|
+
"@yarnpkg/fslib": "^3.0.0-rc.2",
|
|
9
|
+
"@yarnpkg/libzip": "^3.0.0-rc.2",
|
|
10
|
+
"@yarnpkg/parsers": "^3.0.0-rc.2",
|
|
11
|
+
"@yarnpkg/plugin-compat": "^4.0.0-rc.2",
|
|
12
|
+
"@yarnpkg/plugin-constraints": "^4.0.0-rc.2",
|
|
13
|
+
"@yarnpkg/plugin-dlx": "^4.0.0-rc.2",
|
|
14
|
+
"@yarnpkg/plugin-essentials": "^4.0.0-rc.2",
|
|
15
|
+
"@yarnpkg/plugin-exec": "^3.0.0-rc.2",
|
|
16
|
+
"@yarnpkg/plugin-file": "^3.0.0-rc.2",
|
|
17
|
+
"@yarnpkg/plugin-git": "^3.0.0-rc.2",
|
|
18
|
+
"@yarnpkg/plugin-github": "^3.0.0-rc.2",
|
|
19
|
+
"@yarnpkg/plugin-http": "^3.0.0-rc.2",
|
|
20
|
+
"@yarnpkg/plugin-init": "^4.0.0-rc.2",
|
|
21
|
+
"@yarnpkg/plugin-interactive-tools": "^4.0.0-rc.2",
|
|
22
|
+
"@yarnpkg/plugin-link": "^3.0.0-rc.2",
|
|
23
|
+
"@yarnpkg/plugin-nm": "^4.0.0-rc.2",
|
|
24
|
+
"@yarnpkg/plugin-npm": "^3.0.0-rc.2",
|
|
25
|
+
"@yarnpkg/plugin-npm-cli": "^4.0.0-rc.2",
|
|
26
|
+
"@yarnpkg/plugin-pack": "^4.0.0-rc.2",
|
|
27
|
+
"@yarnpkg/plugin-patch": "^4.0.0-rc.2",
|
|
28
|
+
"@yarnpkg/plugin-pnp": "^4.0.0-rc.2",
|
|
29
|
+
"@yarnpkg/plugin-pnpm": "^2.0.0-rc.2",
|
|
30
|
+
"@yarnpkg/plugin-stage": "^4.0.0-rc.2",
|
|
31
|
+
"@yarnpkg/plugin-typescript": "^4.0.0-rc.2",
|
|
32
|
+
"@yarnpkg/plugin-version": "^4.0.0-rc.2",
|
|
33
|
+
"@yarnpkg/plugin-workspace-tools": "^4.0.0-rc.2",
|
|
34
|
+
"@yarnpkg/shell": "^4.0.0-rc.2",
|
|
29
35
|
"ci-info": "^3.2.0",
|
|
30
|
-
"clipanion": "^3.2.0-rc.
|
|
36
|
+
"clipanion": "^3.2.0-rc.10",
|
|
31
37
|
"semver": "^7.1.2",
|
|
32
38
|
"tslib": "^1.13.0",
|
|
33
|
-
"typanion": "^3.3.0"
|
|
34
|
-
"yup": "^0.32.9"
|
|
39
|
+
"typanion": "^3.3.0"
|
|
35
40
|
},
|
|
36
41
|
"devDependencies": {
|
|
37
42
|
"@types/semver": "^7.1.0",
|
|
38
|
-
"@
|
|
39
|
-
"@yarnpkg/builder": "^3.1.0",
|
|
43
|
+
"@yarnpkg/builder": "^4.0.0-rc.2",
|
|
40
44
|
"@yarnpkg/monorepo": "^0.0.0",
|
|
41
|
-
"@yarnpkg/pnpify": "^
|
|
42
|
-
"micromatch": "^4.0.2"
|
|
43
|
-
"typescript": "^4.5.2"
|
|
45
|
+
"@yarnpkg/pnpify": "^4.0.0-rc.2",
|
|
46
|
+
"micromatch": "^4.0.2"
|
|
44
47
|
},
|
|
45
48
|
"peerDependencies": {
|
|
46
|
-
"@yarnpkg/core": "^
|
|
49
|
+
"@yarnpkg/core": "^4.0.0-rc.2"
|
|
47
50
|
},
|
|
48
51
|
"scripts": {
|
|
49
52
|
"postpack": "rm -rf lib",
|
|
@@ -68,12 +71,15 @@
|
|
|
68
71
|
"standard": [
|
|
69
72
|
"@yarnpkg/plugin-essentials",
|
|
70
73
|
"@yarnpkg/plugin-compat",
|
|
74
|
+
"@yarnpkg/plugin-constraints",
|
|
71
75
|
"@yarnpkg/plugin-dlx",
|
|
76
|
+
"@yarnpkg/plugin-exec",
|
|
72
77
|
"@yarnpkg/plugin-file",
|
|
73
78
|
"@yarnpkg/plugin-git",
|
|
74
79
|
"@yarnpkg/plugin-github",
|
|
75
80
|
"@yarnpkg/plugin-http",
|
|
76
81
|
"@yarnpkg/plugin-init",
|
|
82
|
+
"@yarnpkg/plugin-interactive-tools",
|
|
77
83
|
"@yarnpkg/plugin-link",
|
|
78
84
|
"@yarnpkg/plugin-nm",
|
|
79
85
|
"@yarnpkg/plugin-npm",
|
|
@@ -81,7 +87,11 @@
|
|
|
81
87
|
"@yarnpkg/plugin-pack",
|
|
82
88
|
"@yarnpkg/plugin-patch",
|
|
83
89
|
"@yarnpkg/plugin-pnp",
|
|
84
|
-
"@yarnpkg/plugin-pnpm"
|
|
90
|
+
"@yarnpkg/plugin-pnpm",
|
|
91
|
+
"@yarnpkg/plugin-stage",
|
|
92
|
+
"@yarnpkg/plugin-typescript",
|
|
93
|
+
"@yarnpkg/plugin-version",
|
|
94
|
+
"@yarnpkg/plugin-workspace-tools"
|
|
85
95
|
]
|
|
86
96
|
}
|
|
87
97
|
},
|
|
@@ -91,8 +101,8 @@
|
|
|
91
101
|
"directory": "packages/yarnpkg-cli"
|
|
92
102
|
},
|
|
93
103
|
"engines": {
|
|
94
|
-
"node": ">=
|
|
104
|
+
"node": ">=14.15.0"
|
|
95
105
|
},
|
|
96
|
-
"stableVersion": "3.
|
|
106
|
+
"stableVersion": "3.2.0",
|
|
97
107
|
"types": "./lib/index.d.ts"
|
|
98
108
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function backportClipanionCompatibility(clipanion: any): any;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.backportClipanionCompatibility = void 0;
|
|
4
|
-
function backportClipanionCompatibility(clipanion) {
|
|
5
|
-
clipanion.Command.Path = (...p) => (instance) => {
|
|
6
|
-
instance.paths = instance.paths || [];
|
|
7
|
-
instance.paths.push(p);
|
|
8
|
-
};
|
|
9
|
-
for (const fn of [`Array`, `Boolean`, `String`, `Proxy`, `Rest`, `Counter`]) {
|
|
10
|
-
clipanion.Command[fn] = (...args) => (instance, propertyName) => {
|
|
11
|
-
const value = clipanion.Option[fn](...args);
|
|
12
|
-
Object.defineProperty(instance, `__${propertyName}`, {
|
|
13
|
-
configurable: false,
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get() {
|
|
16
|
-
return value;
|
|
17
|
-
},
|
|
18
|
-
set(value) {
|
|
19
|
-
this[propertyName] = value;
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
return clipanion;
|
|
25
|
-
}
|
|
26
|
-
exports.backportClipanionCompatibility = backportClipanionCompatibility;
|