-
-
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
Call for help: Migrating to modern build tool : TSUP #18732
Comments
A few other packages have already been converted, mostly by me, so you can also use those as examples! As a possible additional step: |
Great initiative!
I can see in the script at: storybook/scripts/prepare/bundle.ts Line 61 in 40ccd92
dependencies as external . Wouldn't it be easier to just not do that, and then don't move all dependencies to devDependencies ? I know it's default tsup to not bundle dependencies , so maybe your rationale is to follow the default?
EDIT: |
+ Followed the instructions here: storybookjs#18732
+ Ref issue: storybookjs#18732
@ndelangen Hi, I would like to pick up the first 8 packages from this list, viz. from |
Since @Saunved is doing top -> bottom, I would like to also pick some and I'll do it bottom -> top and at least do 8 packages. |
Haven't been able to look at 😞 lib/channel-websocket, if anyone is interested please feel free to pick it up. |
@SeepG I can |
Boo-yah!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-alpha.49 containing PR #19790 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
Yo-ho-ho!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-alpha.51 containing PR #19694 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
Ermahgerd!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-alpha.53 containing PR #19895 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
Great Caesar's ghost!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.15 containing PR #20134 that references this issue. Upgrade today to the
|
w00t!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.20 containing PR #20150 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
Ermahgerd!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.21 containing PR #20156 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
@ndelangen Is this done? I recall that you had a fix for |
Hey friends!
If you're looking for a way to contribute to storybook's codebase, i might have a few small-ish tasks most people should be able to pick up!
We're in the process of migrating away from having custom scripts to prepare out packages for publishing to npm.
We've used
babel
andtsc
to generate amodern
,esm
, andcjs
output (in different directories.We've picked a new tool that's better because:
I've developed a wrapper around this tool called
ts-up
https://tsup.egoist.sh/#code-splittingHow does this script work?
here: https://github.com/storybookjs/storybook/blob/19d75f066385e5afe01edbc78c6beabf938e90fe/scripts/prepare/bundle.tsAnd the way we use it in our packages:
storybook/code/lib/ui/package.json
Line 52 in 19d75f0
The script generates files in a different place (it does not generate into sub-directories):
entrypoint.js
(cjs
)entrypoint.mjs
(esm
)entrypoint.d.ts
(definitions
)So the references in
package.json
need to be updated:storybook/code/lib/ui/package.json
Lines 41 to 43 in 19d75f0
In addition to the above, we should also add a
exports
field inpackage.json
, we need to add 1 for each entrypoint of the package, and also add a field forpackage.json
file:storybook/code/lib/ui/package.json
Lines 22 to 40 in 19d75f0
Then of-course we need to define what the valid entrypoints are of the package, that the script should bundle:
storybook/code/lib/ui/package.json
Lines 96 to 99 in 19d75f0
For most packages, this will likely just be 1 file.
If there's some code that needs to run before the bundling process, like generating a file:
storybook/code/lib/ui/package.json
Line 95 in 19d75f0
Though this is not super common.
And if the package only runs in node or the browser, and you're getting errors about missing globals, you might need to specify the
"platform"
("browser" or "node"):storybook/code/addons/controls/package.json
Line 93 in 19d75f0
After applying the changes, run
yarn install
in the root of the project,Then run
yarn build <name of package>
to see if the bundling works.If it does, then we still need to check if it actually works.
That we can do by running the CI. If we wanted to test locally, run 1 of the examples, using the package.
Then run
yarn check <name of package>
to see if the bundling caused any TypeScript issues.So we could use your help migrating all of out packages to use this new script!
Here's a list of packages we could use your help with:
addons/a11y
addons/actions
addons/backgrounds
addons/controls
addons/docs
addons/essentials
addons/highlight
addons/interactions
addons/jest
addons/links
addons/measure
addons/outline
addons/storysource
addons/toolbars
addons/viewport
frameworks/angular
frameworks/ember
lib/addons
lib/api
lib/builder-webpack5
lib/channel-postmessage
lib/channel-websocket
lib/channels
lib/cli
lib/client-api
lib/client-logger
lib/codemod
lib/core-client
lib/core-events
lib/core-server
lib/core-webpack
lib/csf-tools
lib/docs-tools
lib/instrumenter
lib/node-logger
lib/postinstall
lib/preview-web
lib/router
lib/source-loader
lib/store
lib/telemetry
So if you'd like to help converting any of these♥️ ! Please mention here, which ones, you can take on, and open a PR converting a package.
There are details on how to do it, in the "How does this script work"
<details/>
in this issue.If you need any help, please reach out to storybook maintainers on the contributing channel on the Storybook discord.
The text was updated successfully, but these errors were encountered: