-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
CLI: Create sandbox on init in empty folders #23611
Conversation
How does it determine which "selected template" with an empty directory? |
@ndelangen, The user will be asked which template should be chosen: https://github.com/storybookjs/storybook/pull/23611/files#diff-1be00149590160bd0f7412dcca41c8941da299807d73504bd06064ee6b2c9e0bR266-R282 |
71331c5
to
3be4580
Compare
@valentinpalkovic we explicitly do a few things in the sandbox command, but in the case of users initializing Storybook in empty projects, it won't make much sense:
|
Good findings! I will tackle them |
2d2f8b2
to
0c8cd76
Compare
@@ -0,0 +1,23 @@ | |||
# {{template.name}} |
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.
Hey @kylegach you might be interested in this. This would be the README file for people who initialize Storybook in empty projects
A reminder, I'm not sure if it would be done in this PR or not, but this documentation section would need to be reworked: storybook/docs/get-started/install.md Line 26 in c266251
|
@yannbf @jonniebigodes is working on the documentation. I had already a pairing session with him yesterday :) |
No top level dependency changes detected. Learn more about Socket for GitHub ↗︎ |
4f9788c
to
a474360
Compare
await remove(join(afterDir, '.yarn', 'cache')); | ||
await remove(join(afterDir, '.yarn', 'unplugged')); |
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.
Is this actually already mentioned in the .gitignore file?
Tested with ❌ npx x react-vite→ hangs on install dependencies step forever, no ❌ npx x angular→ hangs on install dependencies step forever, no ✅ yarn x react-vite✅ yarn x lit❌ yarn x vue→ failed at install dependencies with the esbuild error below, but i can actually start storybook straight away with postinstall error
❌ yarn x angular→ same thing as above -- failed at postinstall but i can actually start storybook straight away manually. |
908903a
to
eaaa4a7
Compare
eaaa4a7
to
fee58c9
Compare
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.
only reviewed sandbox-templates.ts
, this is great!
export type Cadence = keyof typeof templatesByCadence; | ||
|
||
export type Template = { | ||
/** | ||
* Readable name for the template, which will be used for feedback and the status page | ||
*/ | ||
name: string; | ||
name: `${string} (${'Webpack5' | 'Vite'} | ${'JavaScript' | 'TypeScript'} | ${ |
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.
name: `${string} (${'Webpack5' | 'Vite'} | ${'JavaScript' | 'TypeScript'} | ${ | |
name: `${string} (${'Webpack' | 'Vite'} | ${'JavaScript' | 'TypeScript'} | ${ |
I don't think we need to explicitly mention Webpack version 5, given v4 is a long time ago and isn't supported.
}, | ||
'nextjs/default-js': { | ||
name: 'Next.js (JavaScript)', | ||
script: 'yarn create next-app {{beforeDir}} --javascript --eslint', | ||
name: 'Next.js v13 (Webpack5 | JavaScript | npm)', |
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.
For all of these frameworks and renderers which just install the latest version, we should change the version string to be "Latest".
Otherwise it will be a pain to remember to update these strings all the time. I also think it's more correct.
}, | ||
'angular-cli/prerelease': { | ||
name: 'Angular CLI (Prerelease)', | ||
name: 'Angular v16 (Webpack5 | TypeScript | npm) (prerelease)', |
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.
Similar to my comment above, I think we should just call it prerelease.
name: 'Angular v16 (Webpack5 | TypeScript | npm) (prerelease)', | |
name: 'Angular Prerelease (Webpack5 | TypeScript | npm)', |
I am closing this for now. At some point, we might start to work on it again. |
Closes N/A
What I did
This pull request refactors the CLI code to improve the sandbox generation and scaffolding features. It supports different package managers and nested dependency resolutions, using a new
NestedDependencyResolution
type and theoverrides
field inpackage.json
. It also introduces a newscaffoldProject
function that prompts the user to choose a template from thetemplates
module during init, which contains updated and consistent configurations for various frameworks. Additionally, it adds asilent
option to thesandbox
command, which suppresses the console output, and ascaffolding-readme-template.md
file, which is used to generate a custom README.md file for the scaffolded projects. Finally, it simplifies theproject_types
module and removes some unused files.Walkthrough
🤖 Generated by Copilot at 969ec22
How to test
<storybook-project-folder>/code/lib/cli/bin/index.js init
in an empty folder -> Storybook should automatically start<storybook-project-folder>/code/lib/cli/bin/index.js init --skip-install
in an empty folder -> Storybook should not start automaticallyChecklist
MIGRATION.MD
Maintainers
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli/src/sandbox-templates.ts
["cleanup", "BREAKING CHANGE", "feature request", "bug", "build", "documentation", "maintenance", "dependencies", "other"]
🦋 Canary release
This pull request has been released as version
0.0.0-pr-23611-sha-d83da132
. Install it by pinning all your Storybook dependencies to that version.More information
0.0.0-pr-23611-sha-d83da132
valentin/create-sandbox-in-empty-project
d83da132
1691732987
)To request a new release of this pull request, mention the
@storybookjs/core
team.core team members can create a new canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=23611