-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat(cli): Lazy install storybook #8454
Conversation
Packages no longer require a version and will default to the same version as the redwood CLI if no version is specified.
@Josh-Walker-GM haven't reviewed yet, but quick reaction to:
|
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.
Most of the code changes look good; most suggestions I have would be stylistic, so approved, and we can discuss realtime. I don't have good ideas for testing. We need a version of @redwoodjs/testing
that doesn't have the storybook dependencies, and it feels like we just need to publish a version of it that doesn't have them.
import fg from 'fast-glob' | ||
|
||
// Get source files | ||
const sourceFiles = fg.sync(['./src/**/*.ts']) |
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.
nice makes sense
…8572) This PR makes the data migrate CLI command (`yarn rw data-migrate`) a plugin like #8454 did for storybook. But this PR goes a little further, also adding a bin that runs the data migrate's `up` command. I don't think it makes sense for all of Redwood's CLI commands to do this, but it does for some, and data migrate is one since it's an important part of Docker deploys. - This PR extracts the Babel config out of `@redwoodjs/internal` into its own package, `@redwoodjs/babel-config`. If I didn't do this, `@redwoodjs/cli-data-migrate` would depend on `@redwoodjs/internal` because it needs the `registerApiSideBabelHook` function, which would make it's package size unacceptable - Even without internal, the new package has an unfortunate dependency on `@redwoodjs/structure` that I'm not going to try to refactor in this PR - Just noting that `@redwoodjs/structure` doesn't depend on any other Redwood packages besides `@redwoodjs/project-config`, so I'm sure we could make it smaller if we took the time to focus on it - The Babel config in `@redwoodjs/internal` had a dependency on the `typescript` package that I had to refactor as well - The Babel config needs a lot of TLC, but strictly speaking it'd be breaking so I'm holding off on that for now again. I'll open another PR after this one that has those changes
…8572) This PR makes the data migrate CLI command (`yarn rw data-migrate`) a plugin like #8454 did for storybook. But this PR goes a little further, also adding a bin that runs the data migrate's `up` command. I don't think it makes sense for all of Redwood's CLI commands to do this, but it does for some, and data migrate is one since it's an important part of Docker deploys. - This PR extracts the Babel config out of `@redwoodjs/internal` into its own package, `@redwoodjs/babel-config`. If I didn't do this, `@redwoodjs/cli-data-migrate` would depend on `@redwoodjs/internal` because it needs the `registerApiSideBabelHook` function, which would make it's package size unacceptable - Even without internal, the new package has an unfortunate dependency on `@redwoodjs/structure` that I'm not going to try to refactor in this PR - Just noting that `@redwoodjs/structure` doesn't depend on any other Redwood packages besides `@redwoodjs/project-config`, so I'm sure we could make it smaller if we took the time to focus on it - The Babel config in `@redwoodjs/internal` had a dependency on the `typescript` package that I had to refactor as well - The Babel config needs a lot of TLC, but strictly speaking it'd be breaking so I'm holding off on that for now again. I'll open another PR after this one that has those changes
Motivation
We enabled experimental support for CLI commands via npm packages. This should allow us to extract out some of redwood's heavier CLI commands to be lazy installed when they are first used. This will allow a leaner initial install size. Storybook is reasonably large and not used by every user so this is a good first test case.
Changes
@redwoodjs/cli-storybook
@redwoodjs/testing
@redwoodjs/cli-storybook
to the default TOML forexperimental.cli.plugins
- this will mean the command is known to the CLI even though the package is not installedexperimental.cli.autoInstall = true
so that packages are automatically installed when they are needed.command-cache.json
file inside the CRWA templates which will allow the CLI to lazy load this new@redwoodjs/cli-storybook
package without needing to load (and install it) on the first arbitrary CLI invocation.Changes to CLI plugins
This PR also made some small changes to the CLI plugin support. Specifically:
@redwoodjs/*
packages.Issues