Skip to content

Commit bf7352d

Browse files
authored
fix(version) stop --dry-run from changing anything (#6015)
**What's the problem this PR addresses?** <!-- Describe the rationale of your PR. --> <!-- Link all issues that it closes. (Closes/Resolves #xxxx.) --> `yarn version apply --all --dry-run` makes changes, #5717 **How did you fix it?** <!-- A detailed description of your implementation. --> Added an if-check **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 db6210f commit bf7352d

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

ā€Ž.yarn/versions/226801d8.ymlā€Ž

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
releases:
2+
"@yarnpkg/cli": patch
3+
"@yarnpkg/plugin-version": patch
4+
5+
declined:
6+
- "@yarnpkg/plugin-compat"
7+
- "@yarnpkg/plugin-constraints"
8+
- "@yarnpkg/plugin-dlx"
9+
- "@yarnpkg/plugin-essentials"
10+
- "@yarnpkg/plugin-init"
11+
- "@yarnpkg/plugin-interactive-tools"
12+
- "@yarnpkg/plugin-nm"
13+
- "@yarnpkg/plugin-npm-cli"
14+
- "@yarnpkg/plugin-pack"
15+
- "@yarnpkg/plugin-patch"
16+
- "@yarnpkg/plugin-pnp"
17+
- "@yarnpkg/plugin-pnpm"
18+
- "@yarnpkg/plugin-stage"
19+
- "@yarnpkg/plugin-typescript"
20+
- "@yarnpkg/plugin-workspace-tools"
21+
- "@yarnpkg/builder"
22+
- "@yarnpkg/core"
23+
- "@yarnpkg/doctor"

ā€Žpackages/acceptance-tests/pkg-tests-specs/sources/commands/version/apply.test.tsā€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ describe(`Commands`, () => {
1515
version: `0.0.0`,
1616
});
1717

18+
await run(`version`, `apply`, `--dry-run`);
19+
20+
await expect(xfs.readJsonPromise(ppath.join(path, Filename.manifest))).resolves.toMatchObject({
21+
version: `0.0.0`,
22+
});
23+
1824
await run(`version`, `apply`);
1925

2026
await expect(xfs.readJsonPromise(ppath.join(path, Filename.manifest))).resolves.toMatchObject({

ā€Žpackages/plugin-version/sources/commands/version/apply.tsā€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default class VersionApplyCommand extends BaseCommand {
119119
}
120120
});
121121

122-
if (applyReport.hasErrors())
122+
if (this.dryRun || applyReport.hasErrors())
123123
return applyReport.exitCode();
124124

125125
return await project.installWithNewReport({

0 commit comments

Comments
Ā (0)
⚔