Skip to content

Commit 7471f94

Browse files
committedJan 25, 2018
fix: clone options before mutating
1 parent d98281c commit 7471f94

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed
 

‎packages/@vue/cli/lib/Creator.js

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const execa = require('execa')
55
const resolve = require('resolve')
66
const inquirer = require('inquirer')
77
const Generator = require('./Generator')
8+
const cloneDeep = require('lodash.clonedeep')
89
const sortObject = require('./util/sortObject')
910
const installDeps = require('./util/installDeps')
1011
const clearConsole = require('./util/clearConsole')
@@ -71,6 +72,8 @@ module.exports = class Creator {
7172
options = await this.promptAndResolveOptions()
7273
}
7374

75+
// clone before mutating
76+
options = cloneDeep(options)
7477
// inject core service
7578
options.plugins['@vue/cli-service'] = Object.assign({
7679
projectName: name

‎packages/@vue/cli/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"inquirer": "^4.0.1",
3838
"isbinaryfile": "^3.0.2",
3939
"klaw-sync": "^3.0.2",
40+
"lodash.clonedeep": "^4.5.0",
4041
"minimist": "^1.2.0",
4142
"mkdirp": "^0.5.1",
4243
"resolve": "^1.5.0",

‎yarn.lock

+4
Original file line numberDiff line numberDiff line change
@@ -6355,6 +6355,10 @@ lodash.clone@3.0.3:
63556355
lodash._bindcallback "^3.0.0"
63566356
lodash._isiterateecall "^3.0.0"
63576357

6358+
lodash.clonedeep@^4.5.0:
6359+
version "4.5.0"
6360+
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
6361+
63586362
lodash.cond@^4.3.0:
63596363
version "4.5.2"
63606364
resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5"

0 commit comments

Comments
 (0)
Please sign in to comment.