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

ERROR Cannot destructure property 'distTag' of 'context.@release-it-plugins/workspaces' as it is undefined #80

Closed
jakobo opened this issue Jul 23, 2022 · 4 comments · Fixed by #81
Labels
bug Something isn't working

Comments

@jakobo
Copy link

jakobo commented Jul 23, 2022

Version Info

  • "release-it": "^15.1.3"
  • "@release-it-plugins/workspaces": "^3.1.0"
  • node: 14.9.0
  • npm: 6.14.16
  • yarn: 3.2.0

.release-it.json

{
  "plugins": {
    "@release-it-plugins/workspaces": true
  },
  "npm": false,
  "git": {
    "commitMessage": "chore: Releases version v${version}"
  },
  "hooks": {
    "before:init": [
      "syncpack list-mismatches",
      "syncpack format",
      "yarn workspaces foreach -pitv --no-private run release:before:init"
    ]
  }
}

Explanation
I upgraded from what was the old release-it yarn plugin to the one mentioned in the release-it readme. When running release-it --preRelease=next, I get the following error at the push step:

✔ syncpack list-mismatches
✔ syncpack format
✔ yarn workspaces foreach -pitv --no-private run release:before:init

🚀 Let's release taskless (3.0.0-next.0...3.0.0-next.1)


Changelog:
* deps: Updates release-it to latest (dc0efd1)


Changeset:
 M package.json

? Commit (chore: Releases version v3.0.0-next.1)? Yes
? Tag (3.0.0-next.1)? Yes
? Push? Yes
ERROR Cannot destructure property 'distTag' of 'context.@release-it-plugins/workspaces' as it is undefined.

Triage
From what I can gather, it looks like https://github.com/release-it-plugins/workspaces/blob/master/index.js#L133 is the culprit, though it isn't clear if that's because we need to read the distTag again for ourselves, or release-it is no longer passing the distTag to plugins.

@scalvert
Copy link
Collaborator

Thanks for reporting. Looks like there's a gap in our tests. I'll take a look and publish a fix as soon as possible.

@scalvert
Copy link
Collaborator

Debugging this, it appears that release-it is trimming off the plugins' scope when loading.

Screen Shot 2022-07-25 at 9 37 32 AM

We do have tests that cover destructuring the distTag, but they artificially add the package name as a property on the context, so it doesn't reflect how plugins are loaded.

I'm looking into it further to see how best to manage this.

@scalvert
Copy link
Collaborator

I opened release-it/release-it#926 to try to address this.

@scalvert scalvert added the bug Something isn't working label Jul 25, 2022
@scalvert
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants