Skip to content

Commit d5431bd

Browse files
authored
Renames yarn.config.js -> yarn.config.cjs (#5733)
**What's the problem this PR addresses?** The `yarn.config.cjs` file doesn't work with projects using `type: "module"`. Fixes #5720 **How did you fix it?** Renames the file into `yarn.config.cjs`. Since it never got released in a stable release, it should be acceptable to do so without backward compatibility. **Checklist** <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [x] I have set the packages that need to be released for my changes to be effective. <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [x] I will check that all automated PR checks pass before the PR gets reviewed.
1 parent 752bb99 commit d5431bd

File tree

9 files changed

+98
-64
lines changed

9 files changed

+98
-64
lines changed

.yarn/versions/3a69f2b3.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
releases:
2+
"@yarnpkg/cli": major
3+
"@yarnpkg/core": major
4+
5+
declined:
6+
- "@yarnpkg/plugin-compat"
7+
- "@yarnpkg/plugin-constraints"
8+
- "@yarnpkg/plugin-dlx"
9+
- "@yarnpkg/plugin-essentials"
10+
- "@yarnpkg/plugin-exec"
11+
- "@yarnpkg/plugin-file"
12+
- "@yarnpkg/plugin-git"
13+
- "@yarnpkg/plugin-github"
14+
- "@yarnpkg/plugin-http"
15+
- "@yarnpkg/plugin-init"
16+
- "@yarnpkg/plugin-interactive-tools"
17+
- "@yarnpkg/plugin-link"
18+
- "@yarnpkg/plugin-nm"
19+
- "@yarnpkg/plugin-npm"
20+
- "@yarnpkg/plugin-npm-cli"
21+
- "@yarnpkg/plugin-pack"
22+
- "@yarnpkg/plugin-patch"
23+
- "@yarnpkg/plugin-pnp"
24+
- "@yarnpkg/plugin-pnpm"
25+
- "@yarnpkg/plugin-stage"
26+
- "@yarnpkg/plugin-typescript"
27+
- "@yarnpkg/plugin-version"
28+
- "@yarnpkg/plugin-workspace-tools"
29+
- "@yarnpkg/builder"
30+
- "@yarnpkg/doctor"
31+
- "@yarnpkg/extensions"
32+
- "@yarnpkg/nm"
33+
- "@yarnpkg/pnpify"
34+
- "@yarnpkg/sdks"

constraints.pro

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
%
33
% Check this other file in this same repository to see the new way to write constraints, using JS/TS:
44
%
5-
% yarn.config.js
5+
% yarn.config.cjs

packages/acceptance-tests/pkg-tests-specs/sources/commands/__snapshots__/constraints.test.ts.snap

+54-54
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ exports[`Commands constraints test (empty project / gen_enforced_dependency (amb
2222
"stderr": "",
2323
"stdout": "└─ root-workspace-0b6124@workspace:.
2424
└─ Conflict detected in constraint targeting dependencies["no-deps"]; conflicting values are:
25-
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
26-
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
25+
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
26+
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
2727
",
2828
}
2929
`;
@@ -126,8 +126,8 @@ exports[`Commands constraints test (empty project / gen_enforced_field (ambiguou
126126
"stderr": "",
127127
"stdout": "└─ root-workspace-0b6124@workspace:.
128128
└─ Conflict detected in constraint targeting dependencies["a-new-dep"]; conflicting values are:
129-
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
130-
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
129+
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
130+
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
131131
",
132132
}
133133
`;
@@ -278,18 +278,18 @@ exports[`Commands constraints test (multiple workspaces / gen_enforced_dependenc
278278
"stderr": "",
279279
"stdout": "├─ root-workspace-0b6124@workspace:.
280280
│ └─ Conflict detected in constraint targeting dependencies["no-deps"]; conflicting values are:
281-
│ ├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
282-
│ └─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
281+
│ ├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
282+
│ └─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
283283
284284
├─ workspace-a@workspace:packages/workspace-a
285285
│ └─ Conflict detected in constraint targeting dependencies["no-deps"]; conflicting values are:
286-
│ ├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
287-
│ └─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
286+
│ ├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
287+
│ └─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
288288
289289
└─ workspace-b@workspace:packages/workspace-b
290290
└─ Conflict detected in constraint targeting dependencies["no-deps"]; conflicting values are:
291-
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
292-
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
291+
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
292+
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
293293
",
294294
}
295295
`;
@@ -354,19 +354,19 @@ exports[`Commands constraints test (multiple workspaces / gen_enforced_dependenc
354354
"stderr": "",
355355
"stdout": "├─ workspace-a@workspace:packages/workspace-a
356356
│ ├─ Conflict detected in constraint targeting dependencies["no-deps"]; conflicting values are:
357-
│ │ ├─ undefined at exports.constraints (/path/to/yarn.config.js:3:72)
358-
│ │ └─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:4:82)
357+
│ │ ├─ undefined at exports.constraints (/path/to/yarn.config.cjs:3:72)
358+
│ │ └─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:82)
359359
│ └─ Conflict detected in constraint targeting devDependencies["no-deps"]; conflicting values are:
360-
│ ├─ undefined at exports.constraints (/path/to/yarn.config.js:3:72)
361-
│ └─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:4:82)
360+
│ ├─ undefined at exports.constraints (/path/to/yarn.config.cjs:3:72)
361+
│ └─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:82)
362362
363363
└─ workspace-b@workspace:packages/workspace-b
364364
├─ Conflict detected in constraint targeting dependencies["no-deps"]; conflicting values are:
365-
│ ├─ undefined at exports.constraints (/path/to/yarn.config.js:3:72)
366-
│ └─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:4:82)
365+
│ ├─ undefined at exports.constraints (/path/to/yarn.config.cjs:3:72)
366+
│ └─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:82)
367367
└─ Conflict detected in constraint targeting devDependencies["no-deps"]; conflicting values are:
368-
├─ undefined at exports.constraints (/path/to/yarn.config.js:3:72)
369-
└─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:4:82)
368+
├─ undefined at exports.constraints (/path/to/yarn.config.cjs:3:72)
369+
└─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:82)
370370
",
371371
}
372372
`;
@@ -472,18 +472,18 @@ exports[`Commands constraints test (multiple workspaces / gen_enforced_field (am
472472
"stderr": "",
473473
"stdout": "├─ root-workspace-0b6124@workspace:.
474474
│ └─ Conflict detected in constraint targeting dependencies["a-new-dep"]; conflicting values are:
475-
│ ├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
476-
│ └─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
475+
│ ├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
476+
│ └─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
477477
478478
├─ workspace-a@workspace:packages/workspace-a
479479
│ └─ Conflict detected in constraint targeting dependencies["a-new-dep"]; conflicting values are:
480-
│ ├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
481-
│ └─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
480+
│ ├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
481+
│ └─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
482482
483483
└─ workspace-b@workspace:packages/workspace-b
484484
└─ Conflict detected in constraint targeting dependencies["a-new-dep"]; conflicting values are:
485-
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
486-
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
485+
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
486+
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
487487
",
488488
}
489489
`;
@@ -696,8 +696,8 @@ exports[`Commands constraints test (one regular dependency / gen_enforced_depend
696696
"stderr": "",
697697
"stdout": "└─ root-workspace-0b6124@workspace:.
698698
└─ Conflict detected in constraint targeting dependencies["no-deps"]; conflicting values are:
699-
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
700-
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
699+
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
700+
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
701701
",
702702
}
703703
`;
@@ -744,8 +744,8 @@ exports[`Commands constraints test (one regular dependency / gen_enforced_depend
744744
"stderr": "",
745745
"stdout": "└─ root-workspace-0b6124@workspace:.
746746
└─ Conflict detected in constraint targeting dependencies["no-deps"]; conflicting values are:
747-
├─ undefined at exports.constraints (/path/to/yarn.config.js:3:72)
748-
└─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:4:82)
747+
├─ undefined at exports.constraints (/path/to/yarn.config.cjs:3:72)
748+
└─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:82)
749749
",
750750
}
751751
`;
@@ -812,8 +812,8 @@ exports[`Commands constraints test (one regular dependency / gen_enforced_field
812812
"stderr": "",
813813
"stdout": "└─ root-workspace-0b6124@workspace:.
814814
└─ Conflict detected in constraint targeting dependencies["a-new-dep"]; conflicting values are:
815-
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
816-
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
815+
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
816+
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
817817
",
818818
}
819819
`;
@@ -972,8 +972,8 @@ exports[`Commands constraints test (two development dependencies / gen_enforced_
972972
"stderr": "",
973973
"stdout": "└─ root-workspace-0b6124@workspace:.
974974
└─ Conflict detected in constraint targeting dependencies["no-deps"]; conflicting values are:
975-
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
976-
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
975+
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
976+
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
977977
",
978978
}
979979
`;
@@ -1016,8 +1016,8 @@ exports[`Commands constraints test (two development dependencies / gen_enforced_
10161016
"stderr": "",
10171017
"stdout": "└─ root-workspace-0b6124@workspace:.
10181018
└─ Conflict detected in constraint targeting devDependencies["no-deps"]; conflicting values are:
1019-
├─ undefined at exports.constraints (/path/to/yarn.config.js:3:72)
1020-
└─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:4:82)
1019+
├─ undefined at exports.constraints (/path/to/yarn.config.cjs:3:72)
1020+
└─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:82)
10211021
",
10221022
}
10231023
`;
@@ -1084,8 +1084,8 @@ exports[`Commands constraints test (two development dependencies / gen_enforced_
10841084
"stderr": "",
10851085
"stdout": "└─ root-workspace-0b6124@workspace:.
10861086
└─ Conflict detected in constraint targeting dependencies["a-new-dep"]; conflicting values are:
1087-
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
1088-
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
1087+
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
1088+
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
10891089
",
10901090
}
10911091
`;
@@ -1236,8 +1236,8 @@ exports[`Commands constraints test (two regular dependencies / gen_enforced_depe
12361236
"stderr": "",
12371237
"stdout": "└─ root-workspace-0b6124@workspace:.
12381238
└─ Conflict detected in constraint targeting dependencies["no-deps"]; conflicting values are:
1239-
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
1240-
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
1239+
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
1240+
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
12411241
",
12421242
}
12431243
`;
@@ -1284,8 +1284,8 @@ exports[`Commands constraints test (two regular dependencies / gen_enforced_depe
12841284
"stderr": "",
12851285
"stdout": "└─ root-workspace-0b6124@workspace:.
12861286
└─ Conflict detected in constraint targeting dependencies["no-deps"]; conflicting values are:
1287-
├─ undefined at exports.constraints (/path/to/yarn.config.js:3:72)
1288-
└─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:4:82)
1287+
├─ undefined at exports.constraints (/path/to/yarn.config.cjs:3:72)
1288+
└─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:82)
12891289
",
12901290
}
12911291
`;
@@ -1352,8 +1352,8 @@ exports[`Commands constraints test (two regular dependencies / gen_enforced_fiel
13521352
"stderr": "",
13531353
"stdout": "└─ root-workspace-0b6124@workspace:.
13541354
└─ Conflict detected in constraint targeting dependencies["a-new-dep"]; conflicting values are:
1355-
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
1356-
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
1355+
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
1356+
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
13571357
",
13581358
}
13591359
`;
@@ -1512,8 +1512,8 @@ exports[`Commands constraints test (two regular dependencies, two development de
15121512
"stderr": "",
15131513
"stdout": "└─ root-workspace-0b6124@workspace:.
15141514
└─ Conflict detected in constraint targeting dependencies["no-deps"]; conflicting values are:
1515-
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
1516-
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
1515+
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
1516+
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
15171517
",
15181518
}
15191519
`;
@@ -1561,11 +1561,11 @@ exports[`Commands constraints test (two regular dependencies, two development de
15611561
"stderr": "",
15621562
"stdout": "└─ root-workspace-0b6124@workspace:.
15631563
├─ Conflict detected in constraint targeting dependencies["no-deps"]; conflicting values are:
1564-
│ ├─ undefined at exports.constraints (/path/to/yarn.config.js:3:72)
1565-
│ └─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:4:82)
1564+
│ ├─ undefined at exports.constraints (/path/to/yarn.config.cjs:3:72)
1565+
│ └─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:82)
15661566
└─ Conflict detected in constraint targeting devDependencies["no-deps"]; conflicting values are:
1567-
├─ undefined at exports.constraints (/path/to/yarn.config.js:3:72)
1568-
└─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:4:82)
1567+
├─ undefined at exports.constraints (/path/to/yarn.config.cjs:3:72)
1568+
└─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:82)
15691569
",
15701570
}
15711571
`;
@@ -1632,8 +1632,8 @@ exports[`Commands constraints test (two regular dependencies, two development de
16321632
"stderr": "",
16331633
"stdout": "└─ root-workspace-0b6124@workspace:.
16341634
└─ Conflict detected in constraint targeting dependencies["a-new-dep"]; conflicting values are:
1635-
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
1636-
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
1635+
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
1636+
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
16371637
",
16381638
}
16391639
`;
@@ -1792,8 +1792,8 @@ exports[`Commands constraints test (various field types / gen_enforced_dependenc
17921792
"stderr": "",
17931793
"stdout": "└─ foo@workspace:.
17941794
└─ Conflict detected in constraint targeting dependencies["no-deps"]; conflicting values are:
1795-
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
1796-
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
1795+
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
1796+
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
17971797
",
17981798
}
17991799
`;
@@ -1896,8 +1896,8 @@ exports[`Commands constraints test (various field types / gen_enforced_field (am
18961896
"stderr": "",
18971897
"stdout": "└─ foo@workspace:.
18981898
└─ Conflict detected in constraint targeting dependencies["a-new-dep"]; conflicting values are:
1899-
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.js:3:46)
1900-
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.js:4:46)
1899+
├─ '1.0.0' at exports.constraints (/path/to/yarn.config.cjs:3:46)
1900+
└─ '2.0.0' at exports.constraints (/path/to/yarn.config.cjs:4:46)
19011901
",
19021902
}
19031903
`;

packages/acceptance-tests/pkg-tests-specs/sources/commands/constraints.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const {
99

1010
const scriptNames = {
1111
prolog: `constraints.pro`,
12-
js: `yarn.config.js`,
12+
js: `yarn.config.cjs`,
1313
};
1414

1515
const constraints = {
@@ -98,7 +98,7 @@ describe(`Commands`, () => {
9898
it(`should report custom errors`, makeTemporaryEnv({}, async ({path, run, source}) => {
9999
await run(`install`);
100100

101-
await writeFile(ppath.join(path, `yarn.config.js`), `
101+
await writeFile(ppath.join(path, `yarn.config.cjs`), `
102102
exports.constraints = ({Yarn}) => {
103103
Yarn.workspace().error('This should fail');
104104
};
@@ -128,7 +128,7 @@ describe(`Commands`, () => {
128128
}
129129

130130
// TODO: Use .replaceAll when we drop support for Node.js v14
131-
stdout = stdout.split(npath.join(npath.fromPortablePath(path), `yarn.config.js`)).join(`/path/to/yarn.config.js`);
131+
stdout = stdout.split(npath.join(npath.fromPortablePath(path), `yarn.config.cjs`)).join(`/path/to/yarn.config.cjs`);
132132
stdout = stdout.replace(/(Module|Object)\.(exports\.)/g, `$2`);
133133

134134
expect({code, stdout, stderr}).toMatchSnapshot();

packages/acceptance-tests/pkg-tests-specs/sources/features/constraintsChecks.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe(`Features`, () => {
77
makeTemporaryEnv({}, {
88
enableConstraintsChecks: true,
99
}, async ({path, run}) => {
10-
await xfs.writeFilePromise(ppath.join(path, `yarn.config.js`), [
10+
await xfs.writeFilePromise(ppath.join(path, `yarn.config.cjs`), [
1111
`exports.constraints = ({ Yarn }) => {\n`,
1212
` for (const workspace of Yarn.workspaces()) {\n`,
1313
` workspace.set('foo', 'bar')\n`,

packages/docusaurus/docs/features/constraints.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ It currently doesn't support the following, but might in the future (PRs welcome
2727

2828
## Creating a constraint
2929

30-
Constraints are created by adding a `yarn.config.js` file at the root of your project (repository). This file should export an object with a `constraints` method. This method will be called by the constraints engine, and must define the rules to enforce on the project, using the provided API.
30+
Constraints are created by adding a `yarn.config.cjs` file at the root of your project (repository). This file should export an object with a `constraints` method. This method will be called by the constraints engine, and must define the rules to enforce on the project, using the provided API.
3131

32-
For example, the following `yarn.config.js` will enforce that all `react` dependencies are set to `18.0.0`.
32+
For example, the following `yarn.config.cjs` will enforce that all `react` dependencies are set to `18.0.0`.
3333

3434
```ts
3535
module.exports = {
@@ -80,7 +80,7 @@ Yarn ships types that make it easier to write constraints. To use them, add the
8080
$ yarn add @yarnpkg/types
8181
```
8282

83-
Then, in your `yarn.config.js` file, import the types, in particular the `defineConfig` function which automatically type the configuration methods:
83+
Then, in your `yarn.config.cjs` file, import the types, in particular the `defineConfig` function which automatically type the configuration methods:
8484

8585
```ts
8686
/** @type {import('@yarnpkg/types')} */

packages/docusaurus/static/configuration/yarnrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"constraintsPath": {
9090
"_package": "@yarnpkg/plugin-constraints",
9191
"title": "Path of the constraints file.",
92-
"description": "This only matters for Prolog constraints, which are being deprecated. JavaScript constraints will always be read from the `yarn.config.js` file.",
92+
"description": "This only matters for Prolog constraints, which are being deprecated. JavaScript constraints will always be read from the `yarn.config.cjs` file.",
9393
"type": "string",
9494
"format": "uri-reference",
9595
"default": "./constraints.pro"

packages/yarnpkg-core/sources/Project.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ export class Project {
711711
}
712712

713713
async loadUserConfig() {
714-
const configPath = ppath.join(this.cwd, `yarn.config.js`);
714+
const configPath = ppath.join(this.cwd, `yarn.config.cjs`);
715715
if (!await xfs.existsPromise(configPath))
716716
return null;
717717

File renamed without changes.

0 commit comments

Comments
 (0)