Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workspaces are not correctly handled in yarn v4 #210

Closed
ShauniArima opened this issue Oct 28, 2023 · 3 comments · Fixed by #211
Closed

Workspaces are not correctly handled in yarn v4 #210

ShauniArima opened this issue Oct 28, 2023 · 3 comments · Fixed by #211
Labels

Comments

@ShauniArima
Copy link

ShauniArima commented Oct 28, 2023

Using workspaces with yarn v4 does not work as --all, --recursive or --worktree argument is mandatory now.

Link to the changelog of yarn 4 : https://yarnpkg.com/advanced/changelog#major-changes

Example of stacktrace:

Usage Error: Invalid option schema: missing at least one property from "all", "recursive", "since", or "worktree"
$ yarn workspaces foreach [--from #0] [-A,--all] [-R,--recursive] [-W,--worktree] [-v,--verbose] [-p,--parallel] [-i,--interlaced] [-j,--jobs #0] [-t,--topological] [--topological-dev] [--include #0] [--exclude #0] [--no-private] [--since] [-n,--dry-run] <commandName> ...
    at makeError (file:///builds/Shauni/monorepo-example/.yarn/cache/execa-npm-8.0.1-0211bd404c-d2ab5fe1e2.zip/node_modules/execa/lib/error.js:60:11)
    at handlePromise (file:///builds/Shauni/monorepo-example/.yarn/cache/execa-npm-8.0.1-0211bd404c-d2ab5fe1e2.zip/node_modules/execa/index.js:124:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async prepare (file:///builds/Shauni/monorepo-example/.yarn/__virtual__/semantic-release-yarn-virtual-1341558b4b/0/cache/semantic-release-yarn-npm-2.0.2-cefdfa588d-51b71877f1.zip/node_modules/semantic-release-yarn/dist/prepare.js:28:5)
    at async prepare (file:///builds/Shauni/monorepo-example/.yarn/__virtual__/semantic-release-yarn-virtual-1341558b4b/0/cache/semantic-release-yarn-npm-2.0.2-cefdfa588d-51b71877f1.zip/node_modules/semantic-release-yarn/dist/index.js:31:5)
    at async validator (file:///builds/Shauni/monorepo-example/.yarn/cache/semantic-release-npm-22.0.5-ef3ebea609-c8ec10d4a6.zip/node_modules/semantic-release/lib/plugins/normalize.js:36:24)
    at async file:///builds/Shauni/monorepo-example/.yarn/cache/semantic-release-npm-22.0.5-ef3ebea609-c8ec10d4a6.zip/node_modules/semantic-release/lib/plugins/pipeline.js:38:36
    at async Promise.all (index 0)
    at async next (file:///builds/Shauni/monorepo-example/.yarn/cache/p-reduce-npm-3.0.0-a4e7df18a7-387de355e9.zip/node_modules/p-reduce/index.js:15:44) {
  shortMessage: 'Command failed with exit code 1: yarn workspaces foreach --topological --verbose --no-private version 1.1.0 --immediate',
  command: 'yarn workspaces foreach --topological --verbose --no-private version 1.1.0 --immediate',
  escapedCommand: 'yarn workspaces foreach --topological --verbose --no-private version 1.1.0 --immediate',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: '\x1B[31m\x1B[1mUsage Error\x1B[22m\x1B[39m: Invalid option schema: missing at least one property from "all", "recursive", "since", or "worktree"\n' +
    '\n' +
    '\x1B[1m$ \x1B[22myarn workspaces foreach [--from #0] [-A,--all] [-R,--recursive] [-W,--worktree] [-v,--verbose] [-p,--parallel] [-i,--interlaced] [-j,--jobs #0] [-t,--topological] [--topological-dev] [--include #0] [--exclude #0] [--no-private] [--since] [-n,--dry-run] <commandName> ...',
  stderr: '',
  cwd: '/builds/Shauni/monorepo-example',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false,
  pluginName: 'semantic-release-yarn'
}

I will suggest to use --worktree as it was the default value in v3 ^^

Edit: after some tests it seems that --worktree doesn't exist in v3. Should we use --all or another argument to avoid checking yarn's version?

hongaar added a commit that referenced this issue Oct 29, 2023
Add previously default `--worktree` to `yarn workspaces foreach`
commands.

Fixes #210
hongaar pushed a commit that referenced this issue Oct 29, 2023
## [3.0.1](v3.0.0...v3.0.1) (2023-10-29)

### Bug Fixes

* add support for yarn 4 ([#211](#211)) ([94ff591](94ff591)), closes [#210](#210)

[skip ci]
@hongaar
Copy link
Owner

hongaar commented Oct 29, 2023

🎉 This issue has been resolved in version 3.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@hongaar
Copy link
Owner

hongaar commented Oct 29, 2023

Thanks for reporting this ShauniArima, this should now be fixed with the above release ⬆️

Edit: @ShauniArima I see your edit now 😄 I will make another PR to change --worktree to --all as you suggest. 👍

hongaar added a commit that referenced this issue Oct 29, 2023
hongaar pushed a commit that referenced this issue Oct 29, 2023
## [3.0.2](v3.0.1...v3.0.2) (2023-10-29)

### Bug Fixes

* change --worktree to --all ([#212](#212)) ([0bf8f09](0bf8f09)), closes [#210](#210)

[skip ci]
@ShauniArima
Copy link
Author

Thank you! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants