Skip to content

Add an interactive CLI to npm start #65

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

Closed
wants to merge 1 commit into from
Closed

Add an interactive CLI to npm start #65

wants to merge 1 commit into from

Conversation

keyz
Copy link
Contributor

@keyz keyz commented Jul 22, 2016

Implements #55.

Known issues:

  • opn only opens applications (like Atom.app) but not binary executables in $PATH. To be specific, an user can't use edit vim unless there exists a Vim.app. To support that we'll need to use something like exec that picks up stuff from $PATH.

Demo:
bla

Available commands: help, open (o), edit (e), verbose (v), exit

  Commands:

    help [command...]  Provides help for a given command.
    exit               Exits application.
    open               Opens your app in browser.
    edit [editor...]   Opens your app in editor. Defaults to `$EDITOR`; pass an extra string to specify your editor of choice
                       (e.g., `edit sublime text` or `e visual studio code`).
    verbose            Verbose mode (show all webpack logs).

cc @vjeux @gaearon

@ghost ghost added the CLA Signed label Jul 22, 2016
@gaearon
Copy link
Contributor

gaearon commented Jul 22, 2016

Ooh, very neat! I’m not sure about the exact set of commands but I like the flow.
Would be great to continue brainstorming how else we could use this.

@SpencerCDixon
Copy link

What happens if there's a webpak compilation error? Will that get displayed still or does Vorpal hide that from users? As cool as this is there is a lot of value in seeing the explicit webpack bundles being built in the development process. Thoughts?

@keyz
Copy link
Contributor Author

keyz commented Jul 22, 2016

@SpencerCDixon it will still get displayed. This CLI doesn't "hide" anything. Moreover, you can turn on the verbose mode to show all raw webpack logs (although we're still deciding on if we want this feature).

@gaearon
Copy link
Contributor

gaearon commented Jul 22, 2016

I wouldn’t want to allow verbose logs unless people actually start reporting weird crashes in loaders.
I’m more interested in this feature for some sort of rapid interaction. (REPL? 😄 )

@keyz
Copy link
Contributor Author

keyz commented Jul 22, 2016

oh like babel-node but actually executes in browser? woooooo

@ghost ghost added the CLA Signed label Jul 22, 2016
@SpencerCDixon
Copy link

Wow that's a sweet idea @gaearon, almost like a rails console. And sounds good @keyanzhang just wanted to confirm :)

@ghost ghost added the CLA Signed label Jul 22, 2016
@dthree
Copy link

dthree commented Jul 24, 2016

Sounds awesome. If interested in using Vorpal for building the interactivity in the CLI, feel free to ask me any questions.

@gaearon
Copy link
Contributor

gaearon commented Jul 25, 2016

A few more ideas:

  • Toggle running tests on and off
  • When linting errors are displayed, offer autofixing them (for the rules that have that options)


vorpal.history('create-react-app-cli');

vorpal
Copy link

Choose a reason for hiding this comment

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

We can use vorpal.parse(process.argv) to jump straight into a command if extra args are passed into npm start.

Reference on vorpal.parse.

@gaearon gaearon mentioned this pull request Aug 1, 2016
@gaearon
Copy link
Contributor

gaearon commented Aug 2, 2016

I’m going to close this for now since it’s getting stale.
But! I’d like to reconsider this in the close future, for these two use cases:

  • Doing the -u of Jest tests inline in the test watch mode.
  • Doing the -f of ESLint inline in the regular mode.

Since Jest support is merged now, if this PR is resubmitted, I’d like to see it with at least one of these two features.

@gaearon gaearon closed this Aug 2, 2016
@ghost ghost added the CLA Signed label Aug 2, 2016
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants