-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 framework choice #4184
Cli framework choice #4184
Conversation
lib/cli/lib/initiate.js
Outdated
@@ -176,17 +157,83 @@ export default function(options, pkg) { | |||
"Please make sure you are running the `storybook init` command in your project's root directory." | |||
); | |||
paddedLog( | |||
'You can also install storybook for plain HTML snippets with `storybook init --html` or follow some of the slow start guides: https://storybook.js.org/basics/slow-start-guide/' | |||
'You can also install storybook for plain HTML snippets with `storybook init --type html` or follow some of the slow start guides: https://storybook.js.org/basics/slow-start-guide/' |
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.
I think those lines should be changed to something like "you can specify the project type explixitly via ..."
It looks good to me, but do can you write an unit test ? |
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.
But I would advise to write an unit test
I've found one more thing that should be changed: |
this is cool @Keraito ! |
@libetl Will see what I can do. As stated in the first comment, I'm not quite sure how to write a meaningful (unit) and efficient test for this. But I will see what I can do. @igor-dv Thanks! Missed it somehow. @ndelangen That actually took me ages to read correctly 🤔 More to come! |
I like the 'inquirer'/ framework chooser. |
Codecov Report
@@ Coverage Diff @@
## master #4184 +/- ##
==========================================
+ Coverage 40.04% 40.19% +0.14%
==========================================
Files 503 504 +1
Lines 5903 5916 +13
Branches 795 804 +9
==========================================
+ Hits 2364 2378 +14
+ Misses 3156 3151 -5
- Partials 383 387 +4
Continue to review full report at Codecov.
|
Updated with some unit tests. |
Super awesome @Keraito 💪 |
@Keraito, I think you can fix the conflict and merge (don't forget to address my comment in some PR, though). |
Sounds good @igor-dv , do you have any idea who or how that screenshot was made so I can make a similar one? |
Which screenshot? |
Doesn't git history show something? I think you can print-screen it from whatever tool you want =) |
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.
LGTM! NICE WORK 💯
Resolved the merge conflicts |
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.
Super improvement!!! 🎖
'polymer', | ||
'mithril', | ||
'riot', | ||
]; |
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.
ember
marko
meteor?
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.
Hmmm I just extracted this array to another file. Ember support wasn't present yet when I made this PR, but marko en meteor def should have been. I don't see them in the removed code either tho 😱 will add them I'm a few hours
@Keraito felt guilty about creating more merge conflicts so I resolved them for yuo (hopefully correctly)! |
Good job, I think everything is ready, don't you ? |
@shilman I assume you tested manually? If so go ahead and merge |
This is great |
@shilman it wasn't that big of a deal, but thank you very much! 🙇♂️ |
Looks like this is the only thing left: https://github.com/storybooks/storybook/pull/4184/files#r224264956 |
Issue: Part of #1108
Added a
--type -t
flag to thestorybook init
command so users can manually choose which framework/template of Storybook to install. It takes atype
parameter which (for now) needs to be an entry inlib/cli/lib/project_types.js
. It also opens an inquirer when nothing is detected so that the user can choose one anyways if they like.Example of providing type flag
Example of inquirer when undetected SB
All the options in the inquirer and the accepted
types
are extracted fromlib/cli/lib/project_types.js
. This way, when ppl add new frameworks to SB they don't have to make changes in the CLI either (f.e. the confusion in #4161) and it will be auto included.Some issues/remarks:
project_types.js
aren't really that descriptive. It's most likely that this will only be used on projects that are not compatible with SB, so most projects will be auto-detected anyways. But it might be vague what the difference is f.e. betweenREACT_PROJECT
,REACT
, andREACT_SCRIPTS
.