Skip to content
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

Better handling of undetected project types #1647

Closed
wants to merge 10 commits into from

Conversation

Hypnosphi
Copy link
Member

Fixes #475

Currently, we are not really helpful when we can't detect project type. This PR adds a note about slow start guildes and offers options for bootstrapping a project

screen shot 2017-08-12 at 19 56 33

@Hypnosphi
Copy link
Member Author

Any help with wording is welcome =)

@Hypnosphi Hypnosphi added the cli label Aug 12, 2017
@usulpro
Copy link
Member

usulpro commented Aug 12, 2017

Do we need to check that project folder is empty and provide this options only in that case?

@Hypnosphi
Copy link
Member Author

Not really, as all the boilerplates create a new folder

@codecov
Copy link

codecov bot commented Aug 18, 2017

Codecov Report

Merging #1647 into release/3.3 will decrease coverage by 1.39%.
The diff coverage is 0%.

Impacted file tree graph

@@              Coverage Diff               @@
##           release/3.3    #1647     +/-   ##
==============================================
- Coverage        22.46%   21.06%   -1.4%     
==============================================
  Files              321      252     -69     
  Lines             6276     5748    -528     
  Branches           787      685    -102     
==============================================
- Hits              1410     1211    -199     
+ Misses            4275     4015    -260     
+ Partials           591      522     -69
Impacted Files Coverage Δ
lib/cli/lib/helpers.js 0% <0%> (ø) ⬆️
lib/cli/bin/generate.js 0% <0%> (ø) ⬆️
...ts/stories/required_with_context/Button.stories.js 0% <0%> (-100%) ⬇️
...dons/storyshots/stories/directly_required/index.js 0% <0%> (-100%) ⬇️
...s/stories/required_with_context/Welcome.stories.js 0% <0%> (-100%) ⬇️
addons/storyshots/src/index.js 0% <0%> (-80.86%) ⬇️
app/vue/src/server/babel_config.js 0% <0%> (-77.42%) ⬇️
addons/storyshots/src/require_context.js 0% <0%> (-45.59%) ⬇️
addons/storyshots/src/storybook-channel-mock.js 0% <0%> (-22.23%) ⬇️
addons/storyshots/src/test-bodies.js 0% <0%> (-22.23%) ⬇️
... and 191 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5e78851...b293f63. Read the comment docs.

@Hypnosphi Hypnosphi requested a review from a team August 20, 2017 10:53
Copy link
Member

@danielduan danielduan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should really tell the users if we're going to install something. I think it might be helpful to go one more step and ask a [y/N] to see if the user wants to install the package if it's not currently installed too.


default:
paddedLog(`We couldn't detect your project type. (code: ${projectType})`);
paddedLog('Check that you are at your project directory.');
Copy link
Member

@danielduan danielduan Aug 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure you are running the 'getstorybook' command in your project's root directory. maybe?

paddedLog(`We couldn't detect your project type. (code: ${projectType})`);
paddedLog('Check that you are at your project directory.');
paddedLog(
'You can bootstrap a project using some of the options below, or follow one of the slow start guides: https://storybook.js.org/basics/slow-start-guide/'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also start a project using ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create a project maybe?

{
type: 'list',
name: 'type',
message: 'Which kind of project would you like to bootstrap?',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which kind of project boilerplate would you like to install and start?

I think install is pretty key here since we are going installing something into the user's system without their acknowledgement here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless it's yarn create, in which case the installation will be temporary

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we globally installing anything on the user's behalf at all? AFAIK we shouldn't be.

@Hypnosphi
Copy link
Member Author

Why are we globally installing anything on the user's behalf at all? AFAIK we shouldn't be.

So what would you offer instead? Just print command-line instructions for those boilerplates?

@shilman
Copy link
Member

shilman commented Aug 21, 2017

@Hypnosphi we definitely shouldn't be installing things globally on the user's behalf. I think we can either print out instructions or better yet direct them to a docs page where we offer some instructions.

@danielduan
Copy link
Member

danielduan commented Aug 21, 2017

I can see how running create-react-app for the user if they have it installed is a potentially valid use case, but ideally I don't think we should be installing anything for the user either. Either they have it installed and we run it for them, or we give them instructions to install and have them rerun getstorybook.

@Hypnosphi
Copy link
Member Author

Hypnosphi commented Aug 21, 2017

If the tool offers me an option to run some routine steps for me, and is explicit when it comes to global stuff (see latest commit), why is this something wrong?

In my view it's far better UX when comparing to "copy and paste URL from terminal to browser, and then a bunch of commands back from browser to terminal"

In fact we can even offer to uninstall those as soon as we're done, similar to what yarn create and npx do

@usulpro
Copy link
Member

usulpro commented Aug 21, 2017

what do you think about npx --no-install as a workaround?

@Hypnosphi
Copy link
Member Author

Hypnosphi commented Aug 21, 2017

npx --no-install as a workaround

I like the idea. If either npx or the package isn't available, we can fall back to plain command line instructions

@usulpro
Copy link
Member

usulpro commented Aug 21, 2017

we can have npx as a dependency of getstorybook right? so user don't need to have it

ps sorry, don't need --no-install flag in our case
https://github.com/zkat/npx

@shilman
Copy link
Member

shilman commented Aug 21, 2017

Why do we want to get into the business of creating projects for users? It's perfectly valid for getstorybook to have a set of projects that it's compatible with, and to redirect people to instructions when their project isn't compatible.

@Hypnosphi
Copy link
Member Author

@shilman because of this

@ndelangen
Copy link
Member

  • We should not generate project scaffolds ourselves only append what is storybook related.
  • If we do this, we should use a generator without installing it permanently or globally.

But should we do this?
I have to say I am conflicted on this. From a user-perspective this could be very nice.
For a maintainer's perspective this could be a nightmare: keeping in sync with a lot of generators could be a world of pain.

On the other hand, we claim to be compatible with these generators (we currently are). So maybe we SHOULD do something like this to keep us alert and compatible.

@Hypnosphi
Copy link
Member Author

Replaced with #1825

@ndelangen's concern about compatibility with latest generators versions seem to be solved with #1767

@Hypnosphi Hypnosphi closed this Sep 9, 2017
@ndelangen ndelangen deleted the undetected-options branch September 9, 2017 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants