-
-
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
Build: Fix CRA repro generator and e2e test in PnP mode #17375
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 4abf608. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
Locally I'm getting this:
Which is different form the CI. |
facebook/create-react-app#9442 facebook/create-react-app#9501 yarn set version classic looks like --use-npm does nothing for CRA, it should be using npm? Why would the above help? |
869a9d1
to
d3305f8
Compare
@shilman review away |
oof:
|
When I ran it locally, |
I added artifacts to CI to preserve the end state of the e2e dir, and it seems like it too has the dependiencies in place: |
And this in storybook/core:
@shilman does core really need webpack5 as a dependency?!? |
Probably technically yes but I couldn't tell you why from memory (and am afk right now). Maybe @merceyz remembers. |
# Conflicts: # lib/core/package.json # yarn.lock
@@ -87,7 +87,7 @@ export async function baseGenerator( | |||
const addonPackages = [...addons, '@storybook/addon-actions']; | |||
|
|||
const yarn2Dependencies = | |||
packageManager.type === 'yarn2' ? ['@storybook/addon-docs', '@mdx-js/react'] : []; | |||
packageManager.type === 'yarn2' ? ['@storybook/addon-docs', '@mdx-js/react@1.x.x'] : []; |
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.
@shilman version lock it to v1
reminder to remove the saving of artifacts (or ZIP them first) |
@gaetanmaisse this line might be a problem:
though it seems this code isn't used at all! and this one: storybook/lib/core-common/src/utils/es6Transpiler.ts Lines 6 to 38 in eb2fb1c
What does something like this to a --pnp enabled repo?:
|
From the tests I did locally, adding both these deps is fixing Storybook in a CRA app with Yarn PnP.
@ndelangen with the last commit I pushed it unblocks webpack build, I'm not sure to understand why tho'...
As a workaround to see what's the status without this issue, I copied the project locally and added the following in the
(I also linked all the Storybook packages to have all the fixed done in this PR: I would be glad to discuss this with you to define our next move! |
@gaetanmaisse that sounds like CRA itself has a problem with pnp then? |
@gaetanmaisse I've fixed that issue in facebook/create-react-app#11751 but it hasn't been merged yet. The fix is included in the canary releases of Yarn though if you want to use that.
It's an undeclared dependency which is a problem in general, not just with PnP. |
@shilman @gaetanmaisse merge and wait for CRA to fix upstream? |
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.
Generally looks great! Some questions for discussion below
lib/core/package.json
Outdated
@@ -45,6 +45,7 @@ | |||
}, | |||
"peerDependencies": { | |||
"@storybook/builder-webpack5": "6.5.0-alpha.39", | |||
"@storybook/manager-webpack5": "6.5.0-alpha.39", |
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.
Can we do this for all optional peer dependencies? If so, I think that could be an improvement
@@ -86,6 +86,18 @@ | |||
"@babel/core": { | |||
"optional": true | |||
}, | |||
"@storybook/builder-webpack4": { |
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.
Why do we need to add these?
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.
Because there is @storybook/core
as dep and it has @storybook/builder-webpack4
as optional peer dep itself, so we need to add it to satisfy transitivity. Maël did a post about it some time ago: https://dev.to/arcanis/implicit-transitive-peer-dependencies-ed0
"peerDependenciesMeta": { | ||
"@storybook/angular": { | ||
"optional": true | ||
}, | ||
"@storybook/builder-webpack4": { |
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.
Why do we need to add these?
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.
Same as #17375 (comment)
@ndelangen I will review the comments and do the needed changes later today ;) |
As of CRA 5 `--use-npm` option has been removed. To force usage of NPM the only hacky way I found is to override `npm_config_user_agent` env var. See related PR: facebook/create-react-app#11322 And changelog: https://github.com/facebook/create-react-app/releases/tag/v5.0.0
We will need to discuss the `import/no-extraneous-dependencies` rule config
> TL;DR: Vue 3 is now the new default version as of Monday, February 7, 2022! > https://blog.vuejs.org/posts/vue-3-as-the-new-default.html
Soooo, after the issues with CRA I had to deal with Vue and
I updated the repro to use fixed versions of Vue related packages but there is maybe more to do on Everything 🟢 on CircleCI side! 🎆 Good to merge @shilman @ndelangen ? |
One of the CI tasks keeps failing.
Part of the issue was related to CRA:
As of CRA 5
--use-npm
option has been removed.To force usage of NPM the only hacky way I found is to override
npm_config_user_agent
env var.See related PR: Use env var to detect yarn or npm as the package manager facebook/create-react-app#11322
And changelog: https://github.com/facebook/create-react-app/releases/tag/v5.0.0
CRA 5 was missing some dependencies, causing Yarn to throw in PnP mode. See fix: resolve dependency issues facebook/create-react-app#11751
And some other things to Vue 3:
notes: