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 in CI deployment of Storybook for components with hooks #114

Closed
bestatigen opened this issue Nov 9, 2021 · 5 comments · Fixed by #196
Closed

Error in CI deployment of Storybook for components with hooks #114

bestatigen opened this issue Nov 9, 2021 · 5 comments · Fixed by #196
Assignees
Labels
p0 Adress asap.

Comments

@bestatigen
Copy link
Collaborator

bestatigen commented Nov 9, 2021

There seems to be something off with @cura/hooks within Storybook. It might come from the Webpack config of Storybook. I temporarily ignored the stories with components that use hooks.

I could reproduce the error locally after cleaning /node_modules, but it seems to work out locally "sometimes", for example, if I tried to build after adding hooks with yalc and then removed it; that worked.

More details in the CI build.

@bestatigen bestatigen added the p0 Adress asap. label Nov 9, 2021
@sekaiking
Copy link
Contributor

sekaiking commented Nov 10, 2021

There is some problem with versioning, because when I run yarn add @cura/hooks, the package gets updated to 0.0.8 and everything works perfectly fine

package.json before

"@cura/hooks": "0.0.6",

package.json after yarn add @cura/hooks

"@cura/hooks": "^0.0.8",

https://www.npmjs.com/package/@cura/hooks is 0.0.8 and packages/hooks/packages.json is 0.0.6 which is a bit confusing, and i think it's the cause of the error you are getting.

@bestatigen
Copy link
Collaborator Author

bestatigen commented Nov 10, 2021

I'm not sure that's the problem @achrafismyname. In #111 I tried all types of combinations. It seems to only happen with Storybook so will merge the PR and keep this one to fix it.

@bestatigen bestatigen self-assigned this Nov 15, 2021
@bestatigen bestatigen assigned sekaiking and unassigned bestatigen Nov 22, 2021
@sekaiking
Copy link
Contributor

The problem

The problem here, is that yarn workspace is automatically linking the local package from packages\hooks and not getting @cura/hooks from npm repository.

And when we use @cura/hooks inside @cura/components, it tries to get it from packages\hooks\dist which doesn't exist by default.

Workarounds

  • Make sure to build packages\hooks before running yarn storybook
  • Doing yarn install--focus which forces yarn to get packages from npm repositery instead of the local folder. (more details)

I opened this PR below for now with a solution for CI. And added .yarnrc that automates the second workaround for when someone install the package

But I saw in #116 that @devey is working on upgrading yarn, so I think it's better to leave this after that and then we can look into this config to keep packages separated. Or we can avoid this issue in the first place with #101

@bestatigen
Copy link
Collaborator Author

@achrafismyname This should be easier to fix now, no?

@sekaiking
Copy link
Contributor

I think so, I'll give it a try right now

@sekaiking sekaiking linked a pull request Dec 24, 2021 that will close this issue
@sekaiking sekaiking mentioned this issue Dec 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p0 Adress asap.
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants