@gx-design-vue/create-gx-cli 0.1.7 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -0
- package/package.json +3 -2
- package/src/git.js +2 -0
- package/src/main.js +19 -12
package/README.md
CHANGED
@@ -11,6 +11,12 @@ npx @gx-design-vue/create-gx-cli
|
|
11
11
|
# or
|
12
12
|
npm install -g @gx-design-vue/create-gx-cli
|
13
13
|
|
14
|
+
# update
|
15
|
+
npm install -g @gx-design-vue/create-gx-cli
|
16
|
+
|
17
|
+
# uninstall
|
18
|
+
npm uninstall -g @gx-design-vue/create-gx-cli
|
19
|
+
|
14
20
|
# create project
|
15
21
|
create-gx-cli
|
16
22
|
# cli version
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gx-design-vue/create-gx-cli",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.9",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "a cli to bootstrap gx project",
|
6
6
|
"main": "src/index.js",
|
@@ -24,7 +24,8 @@
|
|
24
24
|
"minimist": "^1.2.7",
|
25
25
|
"nanospinner": "^1.1.0",
|
26
26
|
"ncp": "^2.0.0",
|
27
|
-
"prompts": "^2.4.1"
|
27
|
+
"prompts": "^2.4.1",
|
28
|
+
"rimraf": "^3.0.2"
|
28
29
|
},
|
29
30
|
"files": [
|
30
31
|
"bin/",
|
package/src/git.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { spawn } from 'child_process'
|
2
|
+
import rimraf from 'rimraf'
|
2
3
|
|
3
4
|
function git(opts) {
|
4
5
|
return opts.git || 'git'
|
@@ -55,6 +56,7 @@ export function clone(repo, targetPath, opts, onSuccess, onError) {
|
|
55
56
|
if (opts.checkout) {
|
56
57
|
_checkout()
|
57
58
|
} else {
|
59
|
+
rimraf(`${targetPath}/.git`, () => {})
|
58
60
|
onSuccess()
|
59
61
|
}
|
60
62
|
} else {
|
package/src/main.js
CHANGED
@@ -150,17 +150,19 @@ export async function createProject(options) {
|
|
150
150
|
download(downloadGit.url, root, options.projectName)
|
151
151
|
}
|
152
152
|
} else {
|
153
|
-
const
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
153
|
+
const listr = [
|
154
|
+
{
|
155
|
+
title: '项目创建',
|
156
|
+
task: () => copyTemplateFiles(templateDir, root)
|
157
|
+
},
|
158
|
+
]
|
159
|
+
if (options.template !== 'mobile-vant-html') {
|
160
|
+
listr.push({
|
161
|
+
title: '初始化项目',
|
162
|
+
task: () => editPackageJson(root, options.projectName || getProjectName(options.projectName))
|
163
|
+
})
|
164
|
+
}
|
165
|
+
const tasks = new Listr(listr,
|
164
166
|
{
|
165
167
|
exitOnError: false
|
166
168
|
}
|
@@ -168,7 +170,12 @@ export async function createProject(options) {
|
|
168
170
|
|
169
171
|
await tasks.run()
|
170
172
|
|
171
|
-
|
173
|
+
if (options.template !== 'mobile-vant-html') {
|
174
|
+
doneLog(cwd, root)
|
175
|
+
} else {
|
176
|
+
console.log(chalk.blueBright(`init success`))
|
177
|
+
|
178
|
+
}
|
172
179
|
}
|
173
180
|
return true
|
174
181
|
}
|