@yarnpkg/plugin-essentials 4.0.0-rc.22 → 4.0.0-rc.23
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/set/version.js +13 -7
- package/lib/commands/why.js +4 -12
- package/lib/commands/workspace.js +1 -4
- package/lib/suggestUtils.js +5 -5
- package/package.json +11 -11
|
@@ -21,9 +21,17 @@ class SetVersionCommand extends cli_1.BaseCommand {
|
|
|
21
21
|
this.version = clipanion_1.Option.String();
|
|
22
22
|
}
|
|
23
23
|
async execute() {
|
|
24
|
+
var _a;
|
|
24
25
|
const configuration = await core_1.Configuration.find(this.context.cwd, this.context.plugins);
|
|
25
|
-
if (configuration.get(`yarnPath`)
|
|
26
|
-
|
|
26
|
+
if (this.onlyIfNeeded && configuration.get(`yarnPath`)) {
|
|
27
|
+
const yarnPathSource = configuration.sources.get(`yarnPath`);
|
|
28
|
+
if (!yarnPathSource)
|
|
29
|
+
throw new Error(`Assertion failed: Expected 'yarnPath' to have a source`);
|
|
30
|
+
const projectCwd = (_a = configuration.projectCwd) !== null && _a !== void 0 ? _a : configuration.startingCwd;
|
|
31
|
+
if (fslib_1.ppath.contains(projectCwd, yarnPathSource)) {
|
|
32
|
+
return 0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
27
35
|
const getBundlePath = () => {
|
|
28
36
|
if (typeof core_1.YarnVersion === `undefined`)
|
|
29
37
|
throw new clipanion_1.UsageError(`The --install flag can only be used without explicit version specifier from the Yarn CLI`);
|
|
@@ -193,11 +201,9 @@ async function setVersion(configuration, bundleVersion, fetchBuffer, { report, u
|
|
|
193
201
|
await fslib_1.xfs.removePromise(fslib_1.ppath.dirname(absolutePath));
|
|
194
202
|
await fslib_1.xfs.mkdirPromise(fslib_1.ppath.dirname(absolutePath), { recursive: true });
|
|
195
203
|
await fslib_1.xfs.writeFilePromise(absolutePath, bundleBuffer, { mode: 0o755 });
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
});
|
|
200
|
-
}
|
|
204
|
+
await core_1.Configuration.updateConfiguration(projectCwd, {
|
|
205
|
+
yarnPath: fslib_1.ppath.relative(projectCwd, absolutePath),
|
|
206
|
+
});
|
|
201
207
|
}
|
|
202
208
|
else {
|
|
203
209
|
await fslib_1.xfs.removePromise(fslib_1.ppath.dirname(absolutePath));
|
package/lib/commands/why.js
CHANGED
|
@@ -121,12 +121,8 @@ function whyRecursive(project, identHash, { configuration, peers }) {
|
|
|
121
121
|
dependents.add(pkg.locatorHash);
|
|
122
122
|
return depends;
|
|
123
123
|
};
|
|
124
|
-
for (const workspace of sortedWorkspaces)
|
|
125
|
-
|
|
126
|
-
if (!pkg)
|
|
127
|
-
throw new Error(`Assertion failed: The package should have been registered`);
|
|
128
|
-
markAllDependents(pkg);
|
|
129
|
-
}
|
|
124
|
+
for (const workspace of sortedWorkspaces)
|
|
125
|
+
markAllDependents(workspace.anchoredPackage);
|
|
130
126
|
const printed = new Set();
|
|
131
127
|
const rootChildren = {};
|
|
132
128
|
const root = { children: rootChildren };
|
|
@@ -164,11 +160,7 @@ function whyRecursive(project, identHash, { configuration, peers }) {
|
|
|
164
160
|
printAllDependents(nextPkg, nodeChildren, dependency);
|
|
165
161
|
}
|
|
166
162
|
};
|
|
167
|
-
for (const workspace of sortedWorkspaces)
|
|
168
|
-
|
|
169
|
-
if (!pkg)
|
|
170
|
-
throw new Error(`Assertion failed: The package should have been registered`);
|
|
171
|
-
printAllDependents(pkg, rootChildren, null);
|
|
172
|
-
}
|
|
163
|
+
for (const workspace of sortedWorkspaces)
|
|
164
|
+
printAllDependents(workspace.anchoredPackage, rootChildren, null);
|
|
173
165
|
return root;
|
|
174
166
|
}
|
|
@@ -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();
|
package/lib/suggestUtils.js
CHANGED
|
@@ -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.
|
|
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.
|
|
120
|
+
getDescriptorEntry(developmentDescriptor).locators.push(workspace.anchoredLocator);
|
|
121
121
|
}
|
|
122
122
|
else if (regularDescriptor !== undefined) {
|
|
123
|
-
getDescriptorEntry(regularDescriptor).locators.push(workspace.
|
|
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.
|
|
128
|
+
getDescriptorEntry(regularDescriptor).locators.push(workspace.anchoredLocator);
|
|
129
129
|
}
|
|
130
130
|
else if (developmentDescriptor !== undefined) {
|
|
131
|
-
getDescriptorEntry(developmentDescriptor).locators.push(workspace.
|
|
131
|
+
getDescriptorEntry(developmentDescriptor).locators.push(workspace.anchoredLocator);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarnpkg/plugin-essentials",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.23",
|
|
4
|
+
"stableVersion": "3.2.3",
|
|
4
5
|
"license": "BSD-2-Clause",
|
|
5
6
|
"main": "./lib/index.js",
|
|
6
7
|
"exports": {
|
|
@@ -8,8 +9,8 @@
|
|
|
8
9
|
"./package.json": "./package.json"
|
|
9
10
|
},
|
|
10
11
|
"dependencies": {
|
|
11
|
-
"@yarnpkg/fslib": "^3.0.0-rc.
|
|
12
|
-
"@yarnpkg/parsers": "^3.0.0-rc.
|
|
12
|
+
"@yarnpkg/fslib": "^3.0.0-rc.23",
|
|
13
|
+
"@yarnpkg/parsers": "^3.0.0-rc.23",
|
|
13
14
|
"ci-info": "^3.2.0",
|
|
14
15
|
"clipanion": "^3.2.0-rc.10",
|
|
15
16
|
"enquirer": "^2.3.6",
|
|
@@ -20,17 +21,17 @@
|
|
|
20
21
|
"typanion": "^3.3.0"
|
|
21
22
|
},
|
|
22
23
|
"peerDependencies": {
|
|
23
|
-
"@yarnpkg/cli": "^4.0.0-rc.
|
|
24
|
-
"@yarnpkg/core": "^4.0.0-rc.
|
|
25
|
-
"@yarnpkg/plugin-git": "^3.0.0-rc.
|
|
24
|
+
"@yarnpkg/cli": "^4.0.0-rc.23",
|
|
25
|
+
"@yarnpkg/core": "^4.0.0-rc.23",
|
|
26
|
+
"@yarnpkg/plugin-git": "^3.0.0-rc.23"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
29
|
"@types/lodash": "^4.14.136",
|
|
29
30
|
"@types/micromatch": "^4.0.1",
|
|
30
31
|
"@types/semver": "^7.1.0",
|
|
31
|
-
"@yarnpkg/cli": "^4.0.0-rc.
|
|
32
|
-
"@yarnpkg/core": "^4.0.0-rc.
|
|
33
|
-
"@yarnpkg/plugin-git": "^3.0.0-rc.
|
|
32
|
+
"@yarnpkg/cli": "^4.0.0-rc.23",
|
|
33
|
+
"@yarnpkg/core": "^4.0.0-rc.23",
|
|
34
|
+
"@yarnpkg/plugin-git": "^3.0.0-rc.23"
|
|
34
35
|
},
|
|
35
36
|
"repository": {
|
|
36
37
|
"type": "git",
|
|
@@ -53,6 +54,5 @@
|
|
|
53
54
|
],
|
|
54
55
|
"engines": {
|
|
55
56
|
"node": ">=14.15.0"
|
|
56
|
-
}
|
|
57
|
-
"stableVersion": "3.2.0"
|
|
57
|
+
}
|
|
58
58
|
}
|