From a6bdd73f63dc93040c2ff748d69e254f03ef907a Mon Sep 17 00:00:00 2001 From: zyy Date: Mon, 11 Nov 2019 15:47:55 +0800 Subject: [PATCH] feat: add option merge to command create --- packages/@vue/cli/bin/vue.js | 1 + packages/@vue/cli/lib/create.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/@vue/cli/bin/vue.js b/packages/@vue/cli/bin/vue.js index a65c2f8c1d..2f656c5844 100755 --- a/packages/@vue/cli/bin/vue.js +++ b/packages/@vue/cli/bin/vue.js @@ -64,6 +64,7 @@ program .option('-g, --git [message]', 'Force git initialization with initial commit message') .option('-n, --no-git', 'Skip git initialization') .option('-f, --force', 'Overwrite target directory if it exists') + .option('--merge', 'Merge target directory if it exists') .option('-c, --clone', 'Use git clone when fetching remote preset') .option('-x, --proxy', 'Use specified proxy when creating project') .option('-b, --bare', 'Scaffold project without beginner instructions') diff --git a/packages/@vue/cli/lib/create.js b/packages/@vue/cli/lib/create.js index c757b6c20c..ca31553d86 100644 --- a/packages/@vue/cli/lib/create.js +++ b/packages/@vue/cli/lib/create.js @@ -30,7 +30,7 @@ async function create (projectName, options) { exit(1) } - if (fs.existsSync(targetDir)) { + if (fs.existsSync(targetDir) && !options.merge) { if (options.force) { await fs.remove(targetDir) } else {