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

Add '--force' flag to 'vue init' command #708

Closed
codetheorist opened this issue Jan 8, 2018 · 4 comments
Closed

Add '--force' flag to 'vue init' command #708

codetheorist opened this issue Jan 8, 2018 · 4 comments

Comments

@codetheorist
Copy link

Problem:

When testing templates, it's a frequent cause of headaches when testing.

Currently in the template test.sh scripts, they use the yes command piped to the vue init, which doesn't work.

Solution

To workaround this, we could add a --force flag that will send a new line character to each inquirer prompt.

We could use the mock-stdin package for sending the input to the prompt.

There is a PR coming shortly, fully tested with the Vue Webpack template using both the --force and the -f flag.

@LinusBorg
Copy link
Member

Imho we should rather provide a way to skip the inquirer prompt completely and load some predefined answers from some .json file or something. Kind of what I implemented in vuejs-templates/webpack#1218

@vuejs vuejs deleted a comment from Shiyinq Jan 9, 2018
@yyx990803
Copy link
Member

yyx990803 commented Jan 9, 2018

The new version in next branch supports that:

$ vue create --help

  Usage: create [options] <app-name>

  create a new project powered by vue-cli-service


  Options:

    -p, --preset <presetName>       Skip prompts and use saved preset
    -d, --default                   Skip prompts and use default preset
    -i, --inlinePreset <json>       Skip prompts and use inline JSON string as preset
    -r, --registry <url>            Use specified NPM registry when installing dependencies
    -m, --packageManager <command>  Use specified NPM client when installing dependencies
    -f, --force                     Overwrite target directory if it exists
    -h, --help                      output usage information

@deniszavadskiy
Copy link

deniszavadskiy commented Jul 9, 2018

@yyx990803 or @LinusBorg But i can't use vue create template-url ? So what i'm going to do if i need to init template from repo and skip prompts?

@LinusBorg
Copy link
Member

LinusBorg commented Jul 9, 2018

The old 2.x functionality can be re-added with a plugin:

https://cli.vuejs.org/guide/creating-a-project.html#using-the-gui

We won't add any new features to it, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants