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.
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.
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
JReinhold
left a comment
There was a problem hiding this comment.
only reviewed sandbox-templates.ts, this is great!
| * 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.
| 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.
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.
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
NestedDependencyResolutiontype and theoverridesfield inpackage.json. It also introduces a newscaffoldProjectfunction that prompts the user to choose a template from thetemplatesmodule during init, which contains updated and consistent configurations for various frameworks. Additionally, it adds asilentoption to thesandboxcommand, which suppresses the console output, and ascaffolding-readme-template.mdfile, which is used to generate a custom README.md file for the scaffolded projects. Finally, it simplifies theproject_typesmodule and removes some unused files.Walkthrough
🤖 Generated by Copilot at 969ec22
How to test
<storybook-project-folder>/code/lib/cli/bin/index.js initin an empty folder -> Storybook should automatically start<storybook-project-folder>/code/lib/cli/bin/index.js init --skip-installin an empty folder -> Storybook should not start automaticallyChecklist
MIGRATION.MD
Maintainers
ci:normal,ci:mergedorci:dailyGH 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-d83da132valentin/create-sandbox-in-empty-projectd83da1321691732987)To request a new release of this pull request, mention the
@storybookjs/coreteam.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