YN0001: Error: Missing workspace identity.
Describe the bug
When running yarn monodeploy --dry-run in the root of the repository where packages/* are set as workspaces, monodeploy seems to try to publish the root "package" as well (as I could infer by inspecting /node_modules/@monodeploy/versions/lib/getExplicitVersionStrategies.js) and it fails with the error YN0001: Error: Missing workspace identity..
- [ ] I am interested in contributing a fix.
To reproduce
My current config looks like this:
module.exports = {
preset: 'monodeploy/preset-recommended',
autoCommit: true,
git: {
push: true,
},
conventionalChangelogConfig: '@tophat/conventional-changelog-config',
changelogFilename: '<packageDir>/CHANGELOG.md',
persistVersions: true,
};
The command I execute is: yarn monodeploy --dry-run.
And my .yarnrc.yaml contains the following:
nodeLinker: node-modules
npmScopes:
scope:
npmRegistryServer: "http://my-custom-registry:4873"
npmAlwaysAuth: true
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
unsafeHttpWhitelist:
- my-custom-registry
yarnPath: .yarn/releases/yarn-3.2.3.cjs
Finally, some relevant package.json contents:
{
"private": true,
"workspaces": [
"packages/*"
],
"packageManager": "[email protected]",
}
Expected behavior
I'd expect to monodeploy to only publish what's defined under workspaces.
Environment (please complete the following information):
- OS: Ubuntu 22.04
- Monodeploy Version: 3.3.0
- Yarn Version: 3.2.3
- Yarn module linker: node-modules
- Node Version: 14.19.3
- Git Version: 2.34.1
Additional context
Adding a name property to root package.json file seems to solve the issue. We migrated from early lerna version and we didn't have any name in there, previously.
Feel free to close the issue if this is considered a non-bug. Thanks!
It's not trying to publish the root but still trying to load it and expecting a name. Even though adding a name is a simple fix, I think we should be able support optional names for at least the top level workspace. I'll leave this issue open for now.