@gx-design-vue/create-gx-cli 0.0.9 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gx-design-vue/create-gx-cli",
3
- "version": "0.0.9",
3
+ "version": "0.1.1",
4
4
  "license": "MIT",
5
5
  "description": "a cli to bootstrap gx project",
6
6
  "main": "src/index.js",
package/src/cli.js CHANGED
@@ -43,7 +43,6 @@ function parseArgumentsIntoOptions() {
43
43
  }
44
44
 
45
45
  async function promptForMissingOptions(options) {
46
- console.log(typeof options.template === 'string' && !TEMPLATES.includes(options.template))
47
46
  const answers = await prompts([
48
47
  {
49
48
  type: options.projectName ? null : 'text',
@@ -80,7 +79,6 @@ async function promptForMissingOptions(options) {
80
79
  export async function cli() {
81
80
  let options = parseArgumentsIntoOptions()
82
81
  options = await promptForMissingOptions(options)
83
- console.log(options)
84
82
  if (options.template && options.projectName) {
85
83
  await createProject(options)
86
84
  }
package/src/main.js CHANGED
@@ -41,9 +41,15 @@ function editPackageJson(root, projectName) {
41
41
  fs.readFileSync(path.join(root, `package.json`), 'utf-8')
42
42
  )
43
43
 
44
- console.log(projectName)
45
-
46
44
  pkg.name = projectName
45
+
46
+ const dirIsExists = fs.existsSync(path.join(root, '.npmrc'))
47
+
48
+ if (!dirIsExists) {
49
+ writeFile(path.join(root, '.npmrc'), 'shamefully-hoist=true')
50
+ }
51
+
52
+
47
53
  writeFile(path.join(root, 'package.json'), JSON.stringify(pkg, null, 2))
48
54
  }
49
55
  }
@@ -112,7 +118,7 @@ export async function createProject(options) {
112
118
  task: () => copyTemplateFiles(templateDir, root)
113
119
  },
114
120
  options.template !== 'mobile-vant-html' ? {
115
- title: '项目文件修改',
121
+ title: '初始化项目',
116
122
  task: () => editPackageJson(root, options.projectName || getProjectName())
117
123
  } : {}
118
124
  ],