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

Core: Replace cpy with fs-extra copy/copyFile #18497

Merged
merged 5 commits into from
Jun 28, 2022

Conversation

strmer15
Copy link
Contributor

@strmer15 strmer15 commented Jun 16, 2022

Issue: #15174

What I did

Replaces the cpy library used by @storybook/core-server with the previously-installed fs-extra library. The cpy function was copying two things: the favicon and the contents of prebuiltDir.

For copying the favicon, I used the copyFile function, which needs to have the full paths of both the source and destination file, so I changed the destination to append the basename of the favicon to the output directory.

For copying the prebuiltDir, the copy function in fs-extra will copy the contents of a directory into another directory recursively, which seems like is exactly what cpy was doing before. The only difference that I could see between the old use of cpy and fs-extra was that fast-glob follows symlinks by default whereas fs-extra only seems to do so when dereference is true, so I added that option. (fast-glob is used by globby which is used by cpy)

How to test

  • yarn test completes successfully
  • yarn build-storybook in the examples/cra-ts directory works correctly

Unfortunately, I couldn't figure out how to get the prebuildDir to show up - I added some logging to see if it ever got triggered, but none of the examples seemed to exercise it. I'm not sure how to enable that option to verify that it's working and would appreciate some help!

  • Is this testable with Jest or Chromatic screenshots?
  • Does this need a new example in the kitchen sink apps?
  • Does this need an update to the documentation?

If your answer is yes to any of these, please make sure to include it in your PR.

@nx-cloud
Copy link

nx-cloud bot commented Jun 16, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 7bb68e4. 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 target

Sent with 💌 from NxCloud.

@shilman shilman added maintenance User-facing maintenance tasks security labels Jun 18, 2022
@shilman shilman changed the title remove cpy in favor of fs-extra copy/copyFile Core: Remove cpy in favor of fs-extra copy/copyFile Jun 18, 2022
@shilman shilman changed the title Core: Remove cpy in favor of fs-extra copy/copyFile Core: Replace cpy with fs-extra copy/copyFile Jun 18, 2022
@shilman shilman changed the title Core: Replace cpy with fs-extra copy/copyFile Core: Replace cpy with fs-extra copy/copyFile Jun 18, 2022
@ndelangen
Copy link
Member

I've done something very similar in my 7.0 future branch! 👍 Thank you for this @strmer15 👏

@strmer15
Copy link
Contributor Author

I've done something very similar in my 7.0 future branch! 👍 Thank you for this @strmer15 👏

No problem! Thanks for reviewing @ndelangen !

@ndelangen
Copy link
Member

Congrats on your first merged PR to storybook! 🎉

@ndelangen ndelangen merged commit 70e0972 into storybookjs:next Jun 28, 2022
@strmer15 strmer15 deleted the remove-cpy branch June 28, 2022 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance User-facing maintenance tasks security
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants