-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
CLI: Fix sb init
in Yarn workspace environment
#10985
Conversation
version: 'latest', | ||
generator: [ | ||
'cd {{name}}-v{{version}}', | ||
'echo "{ \\"name\\": \\"workspace-root\\", \\"private\\": true, \\"workspaces\\": [] }" > package.json', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Init a Yarn workspace with the most simple way (i.e. without any tricks or new dependency)
a388860
to
ef9e891
Compare
Add `--ignore-workspace-root-check` to avoid Yarn error when adding dependencies to the workspace root.
9a9a796
to
d0ef50a
Compare
Removed this option because it can hide some issues with dependency installation process of @storybook/cli. For instance, missing Yarn flags needed to have the CLI working in Yarn workspaces. Also, as `sb init` is now running `yarn/npm install` the resolution step has to be made before init Storybook.
d0ef50a
to
82e418f
Compare
With the previous algorithm, some nodes have no jobs assigned to them due to rounding consideration. For example with 10 nodes and 13 jobs to assign: 13 jobs / 10 nodes -> 1.3 jobs per node -> rounded to 2 -> only the 1st 6 nodes run 2 jobs, the 7th 1 job and the other 0 job. Using a modulo ensures that each node will at least run 1 job.
a39832b
to
2345957
Compare
const nodeIndex = +process.env.CIRCLE_NODE_INDEX || 0; | ||
const numberOfNodes = +process.env.CIRCLE_NODE_TOTAL || 1; | ||
|
||
const list = narrowedConfigs.filter((_, index) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to do that for a while now ^^
This logic is shared in other runners, chromatic and examples if I'm right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Issue: #10915
What I did
--ignore-workspace-root-check
flag when CLI is runningyarn add
command.skip-install
option fromsb init
command used in E2E because it can hide some issues with the dependency installation process of @storybook/cli. For instance, missing Yarn flags needed to have the CLI working in Yarn workspaces.--
Also, improve jobs assignment on CI nodes:
With the current algorithm, some nodes have no jobs assigned to them due to rounding consideration. For instance, with 10 nodes and 13 jobs to assign:
Using a modulo ensures that each node will at least run 1 job and thus reduce the E2E run duration (in theory 🤞).
How to test
example-v2
job