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
[Bug]: Try to avoid JsPackageManager.retrievePackageJSON usage #26263
Comments
Any workaround for Nx for the time being? I am running into this issue when I execute "run:storybook": {
"executor": "nx:run-commands",
"options": {
"parallel": false,
"commands": [
"nx storybook frontend",
"rm ./apps/frontend/package.json"
]
}
} Which is obviously a very tough to manage solution since we have other commands too and it might also not be possible for publishable libs who need their SuggestionMaybe a flag in
|
Your proposed solution would work, but I would instead try to fix the root cause of the issue (detecting the correct package.json) instead of implementing a workaround. As described above, the solution isn't that straightforward and depends on a couple of things. Hopefully, I can manage to work on this soon. |
Great news @valentinpalkovic, Thanks a lot. I am really looking forward to it and please lemme know when it is done so that I can have it in my proj since I am right now gitignoring it and it is not much of a problem but having less things to keep in mind is always a good thing. I feel you, it is imperative to solve a problem from its root and fix those broken windows. |
Describe the bug
The
JsPackageManager.retrievePackageJSON
method in@storybook/core-common
returns currently a package.json file which is looked up in the current working directory.The
package.json
is used to figure out,All the mentioned use cases might run into issues when Storybook is used, initialized, or upgraded in a mono repo setup. The folder into which Storybook should be initialized or is already initialized might
package.json
, because dependencies are handled at the root (e.g. NX's one-version policy).package.json
, but only scripts are defined because dependencies are still installed at the root.--config-dir
argument is passed to the CLI (not all CLI commands support --config-dir, e.g.npx storybook add
doesn't))When adding or removing dependencies or asking for a particular dependency, we should use always the package manager's CLI commands to get this information, because we simply cannot rely on the package.json, which is defined at the root.
Acceptance criteria
JsPackageManager.retrievePackageJSON
is used in scenarios, which aren't mentioned above.JsPackageManager.retrievePackageJSON
usage by methods, which call the package manager's CLI directly to get all the necessary information.Related issues
To Reproduce
No response
System
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: