@ansstory/hias 1.0.0 → 1.0.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.
package/lib/config.js CHANGED
@@ -1,8 +1,12 @@
1
1
  const foramworkUrl = {
2
- 'vue-ts': 'https://gitee.com/AnsStory/as_cms_vue_ts_tmp.git',
3
- 'uni-vite': 'https://gitee.com/AnsStory/uni_vite.git',
4
- 'nuxt-web': 'https://gitee.com/AnsStory/nuxt_web_tmp.git',
5
- 'vue-screen': 'https://gitee.com/AnsStory/vite_screen.git',
2
+ 'vue2': 'https://gitee.com/AnsStory/hias-vue2-template.git',
3
+ 'vue3': 'https://gitee.com/AnsStory/hias-vue3-template.git',
4
+ 'vue-ts': 'https://gitee.com/AnsStory/hias-vue-ts-template.git',
5
+ 'uni-vite': 'https://gitee.com/AnsStory/hias-uni-vite.git',
6
+ 'nuxt-web': 'https://gitee.com/AnsStory/hias-nuxt-web-tmp.git',
7
+ 'vue-screen': 'https://gitee.com/AnsStory/hias-vite-screen.git',
8
+ 'react': 'https://gitee.com/AnsStory/hias-react-template.git',
9
+ 'react-ts': 'https://gitee.com/AnsStory/hias-react-ts-template.git',
6
10
  }
7
11
  const framwork = Object.keys(foramworkUrl)
8
12
 
@@ -1,4 +1,5 @@
1
- var inquirer = require('inquirer')
1
+ const inquirer = require('inquirer')
2
+ const chalk = require('chalk')
2
3
  const { program } = require('commander')
3
4
  var config = require('../config')
4
5
  var downloadFun = require('./download')
@@ -22,14 +23,17 @@ const beginAction = async (project, args) => {
22
23
  }
23
24
 
24
25
  async function addComponentAction(cpnName, temPath, fileType) {
26
+ const dest = program.opts().dest || 'src/components'
27
+ const [folderName = 'index'] = dest.match(/[^\\/]+$/)
28
+ const name = cpnName === 'index' ? folderName : cpnName
29
+
25
30
  const result = await compileEjs(temPath, {
26
- name: cpnName,
27
- lowername: cpnName.toLowerCase(),
31
+ name: name,
32
+ lowername: name.toLowerCase(),
28
33
  })
29
34
 
30
- const dest = program.opts().dest || 'src/components'
31
35
  await writeFile(`${dest}/${cpnName}.${fileType}`, result)
32
- console.log('Component creation was successful:', cpnName + '.vue')
36
+ console.log(chalk.green.bold('Component creation was successful:'), chalk.blue.bold(`${cpnName}.${fileType}`), chalk.underline(dest))
33
37
  }
34
38
 
35
39
  async function addVueComponentAction(cpnName) {
@@ -54,5 +58,5 @@ module.exports = {
54
58
  addReactComponentAction,
55
59
  addReactTsComponentAction,
56
60
  addReduxStoreAction,
57
- addReduxTsStoreAction
61
+ addReduxTsStoreAction,
58
62
  }
@@ -8,26 +8,26 @@ const {
8
8
  } = require('./action')
9
9
 
10
10
  const beginCommander = function (program) {
11
- program.command('create <project> [other...]').alias('crt').description('create project. For example: asn create airbnb').action(beginAction)
11
+ program.command('create <project> [other...]').alias('crt').description('create project. For example: hias create airbnb').action(beginAction)
12
12
  program
13
13
  .command('adv <vuecpnname> [...others]')
14
- .description('add vue component into a folder, For example: asn addv Demo -d src/components')
14
+ .description('add vue component into a folder, For example: hias addv Demo -d src/components')
15
15
  .action(addVueComponentAction)
16
16
  program
17
17
  .command('adr <reactcpnname> [...others]')
18
- .description('add react jsx component into a folder, For example: asn addr Demo -d src/components')
18
+ .description('add react jsx component into a folder, For example: hias addr Demo -d src/components')
19
19
  .action(addReactComponentAction)
20
20
  program
21
21
  .command('adrt <reactcpnname> [...others]')
22
- .description('add react tsx component into a folder, For example: asn addrt Demo -d src/components')
22
+ .description('add react tsx component into a folder, For example: hias addrt Demo -d src/components')
23
23
  .action(addReactTsComponentAction)
24
24
  program
25
25
  .command('adrd <reactcpnname> [...others]')
26
- .description('add redux jsx store into a folder, For example: asn addrt useDemoStore -d src/store/modules')
26
+ .description('add redux jsx store into a folder, For example: hias addrt useDemoStore -d src/store/modules')
27
27
  .action(addReduxStoreAction)
28
28
  program
29
29
  .command('adrdt <reactcpnname> [...others]')
30
- .description('add redux tsx store into a folder, For example: asn addrt useDemoStore -d src/store/modules')
30
+ .description('add redux tsx store into a folder, For example: hias addrt useDemoStore -d src/store/modules')
31
31
  .action(addReduxTsStoreAction)
32
32
  }
33
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ansstory/hias",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "private": false,
5
5
  "description": "创建项目模板",
6
6
  "author": "AnsStory story <story0809@163.com>",