From ec8e8a8762c12b14bc87fd0439633843577cc482 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 8a23f2536a..1ebd3cad4a 100755 --- a/packages/@vue/cli/bin/vue.js +++ b/packages/@vue/cli/bin/vue.js @@ -63,6 +63,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 ef4a00af69..1cbabdce32 100644 --- a/packages/@vue/cli/lib/create.js +++ b/packages/@vue/cli/lib/create.js @@ -29,7 +29,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 {