-
Notifications
You must be signed in to change notification settings - Fork 117
Expand file tree
/
Copy pathyarn.config.cjs
More file actions
45 lines (36 loc) · 1.34 KB
/
yarn.config.cjs
File metadata and controls
45 lines (36 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// @ts-check
/** @type {import("@yarnpkg/types")} */
const { defineConfig } = require("@yarnpkg/types");
const { getRootEnginesField } = require("./scripts/src/rootWorkspace.js");
module.exports = defineConfig({
constraints: async ({ Yarn }) => {
const root = Yarn.workspace({ cwd: "." });
if (!root) {
throw new Error("Root workspace not found");
}
const { author, repository: origin } = root.manifest;
for (const workspace of Yarn.workspaces()) {
const { name, private: isPrivate, experimental } = workspace.manifest;
if (isPrivate && !experimental) {
workspace.set("version", "0.0.0");
}
workspace.set("author.name", author.name);
workspace.set("author.email", author.email);
const homepage =
workspace === root
? `${origin.url}#readme`
: `${origin.url}/tree/main/${workspace.cwd}#readme`;
workspace.set("homepage", homepage);
workspace.set("repository.type", origin.type);
workspace.set("repository.url", origin.url);
if (workspace !== root) {
workspace.set("repository.directory", workspace.cwd);
}
if (name.startsWith("@rnx-kit/yarn-plugin-")) {
const engines = getRootEnginesField();
workspace.set("engines.node", engines.node);
workspace.set("engines.yarn", ">=4.0");
}
}
},
});