@htyf-mp/cli 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.js +17 -9
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -70,7 +70,7 @@ async function main() {
70
70
  default: 'my-htyf-mp',
71
71
  validate: d => {
72
72
  if(!kebabRegez.test(d)) {
73
- return '请以my-app-name格式输入您的应用程序目录名称'
73
+ return '请以my-app-name格式输入您的应用程序英文目录名称'
74
74
  }
75
75
  return true
76
76
  }
@@ -139,15 +139,21 @@ async function main() {
139
139
  log(`\n初始化项目. \n`)
140
140
 
141
141
  spinner.start()
142
+ const root_path = path.join(process.cwd(), `${appName}`);
143
+ if (/[\u4e00-\u9fa5]/gi.test(root_path)) {
144
+ console.error('禁止目录中包含中文字符')
145
+ spinner.stop()
146
+ return;
147
+ }
142
148
  await execa('git', ['clone', repoType, appName])
143
149
  let appRootPath = '';
144
- const taro_path = path.join('./', `${appName}`, `${taroTempPath}`)
145
- const expo_path = path.join('./', `${appName}`, `${expoTempPath}`)
146
- const game_path = path.join('./', `${appName}`, `${gameTempPath}`)
147
- const cli_path = path.join('./', `${appName}`, `cli`)
148
- const git_path = path.join('./', `${appName}`, `.git`)
149
- const docs_path = path.join('./', `${appName}`, `docs`)
150
- const README_path = path.join('./', `${appName}`, `README.md`)
150
+ const taro_path = path.join(root_path, `${taroTempPath}`)
151
+ const expo_path = path.join(root_path, `${expoTempPath}`)
152
+ const game_path = path.join(root_path, `${gameTempPath}`)
153
+ const cli_path = path.join(root_path, `cli`)
154
+ const git_path = path.join(root_path, `.git`)
155
+ const docs_path = path.join(root_path, `docs`)
156
+ const README_path = path.join(root_path, `README.md`)
151
157
  try {
152
158
  if (tempType === 'taro') {
153
159
  appRootPath = taro_path
@@ -219,7 +225,9 @@ async function main() {
219
225
  }
220
226
  delete pkg_info['scripts']['web']
221
227
  delete pkg_info['scripts']['web:dev']
222
- fse.writeJSONSync(pkg_path, JSON.stringify(pkg_info, undefined, 2))
228
+ fse.writeJSONSync(pkg_path, pkg_info, {
229
+ spaces: 2
230
+ })
223
231
  }
224
232
  if (tempType === 'expo') {
225
233
  fse.copySync(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htyf-mp/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "红糖云服app小程序模板-cli",
5
5
  "type": "module",
6
6
  "bin": "cli.js",