unisolution-create-app 1.0.3 → 1.0.4

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/dist/index.js CHANGED
@@ -50951,7 +50951,7 @@ var ora = /*@__PURE__*/getDefaultExportFromCjs(oraExports);
50951
50951
  program.name('runcli').usage('<command> [options]');
50952
50952
 
50953
50953
  // 版本
50954
- program.version(`${Promise.resolve().then(function () { return require('./bin/index.js'); })['version']}`);
50954
+ program.version(`${Promise.resolve().then(function () { return require('./package-BYI6NkyP.js'); })['version']}`);
50955
50955
 
50956
50956
  // 命令
50957
50957
  program
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
3
  var name = "unisolution-create-app";
4
- var version = "1.0.2";
4
+ var version = "1.0.3";
5
5
  var description = "";
6
- var main = "index.js";
7
- var bin = "/bin/index.js";
6
+ var bin = "/dist/bin/index.js";
8
7
  var type = "module";
9
8
  var scripts = {
10
9
  build: "rollup -c"
11
10
  };
12
11
  var files = [
13
- "dist"
12
+ "dist",
13
+ "package.json"
14
14
  ];
15
15
  var author = "";
16
16
  var license = "ISC";
@@ -34,7 +34,6 @@ var _package = {
34
34
  name: name,
35
35
  version: version,
36
36
  description: description,
37
- main: main,
38
37
  bin: bin,
39
38
  type: type,
40
39
  scripts: scripts,
@@ -53,7 +52,6 @@ exports.description = description;
53
52
  exports.devDependencies = devDependencies;
54
53
  exports.files = files;
55
54
  exports.license = license;
56
- exports.main = main;
57
55
  exports.name = name;
58
56
  exports.scripts = scripts;
59
57
  exports.type = type;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "unisolution-create-app",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
- "main": "index.js",
6
- "bin": "/bin/index.js",
5
+ "bin": "/dist/bin/index.js",
7
6
  "type": "module",
8
7
  "scripts": {
9
8
  "build": "rollup -c"
10
9
  },
11
10
  "files": [
12
- "dist"
11
+ "dist",
12
+ "package.json"
13
13
  ],
14
14
  "author": "",
15
15
  "license": "ISC",
package/bin/index.js DELETED
@@ -1,102 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { program } from 'commander';
4
- import figlet from 'figlet';
5
- import inquirer from 'inquirer';
6
- import fs from 'fs-extra';
7
- import path from 'path';
8
- import gitClone from 'git-clone';
9
- import ora from 'ora';
10
-
11
- // 首航提示
12
- program.name('runcli').usage('<command> [options]')
13
-
14
- // 版本
15
- program.version(`${import('../package.json')['version']}`)
16
-
17
- // 命令
18
- program
19
- .command('create <app-name>')
20
- .description('create a new project')
21
- .action(projectName => {
22
- createProject(projectName)
23
- })
24
-
25
- // program.on('--help', function () {
26
- // console.log('')
27
- // });
28
-
29
- program.parse(process.argv);
30
-
31
- function log (obj) {
32
- console.log(JSON.stringify(obj))
33
- }
34
-
35
- const projectList = {
36
- 'react': '',
37
- 'react-ts': 'https://gitee.com/unisolution_cn_lhj/reactdemo.git'
38
- }
39
-
40
- async function createProject (projectName) {
41
- // 创建一个名字为projectName的文件夹,将模板代码放在文件夹下面
42
- // 判断有没有 name 的文件夹
43
- const currentFolder = process.cwd();
44
- const fullPath = path.join(currentFolder, projectName);
45
- const isExist = fs.existsSync(fullPath)
46
-
47
- if (isExist) {
48
- const answers = await inquirer.prompt([
49
- {
50
- type: 'confirm',
51
- name: 'overWrite',
52
- message: `${projectName}已经存在,是否要覆盖?`
53
- }
54
- ])
55
- const { overWrite } = answers;
56
- if (overWrite) {
57
- fs.remove(fullPath)
58
- generateNewProject(fullPath)
59
- } else return;
60
- } else {
61
- generateNewProject(fullPath)
62
- }
63
- }
64
-
65
- async function generateNewProject (projectPath) {
66
- const answers = await inquirer.prompt([
67
- {
68
- type: 'list',
69
- name: 'type',
70
- message: `请选择模板`,
71
- choices: [
72
- {
73
- name: 'react',
74
- value: 'react'
75
- },
76
- {
77
- name: 'react-ts',
78
- value: 'react-ts'
79
- }
80
- ]
81
- }
82
- ])
83
- const { type } = answers;
84
- if (type === 'react-ts') {
85
- const address = projectList[type];
86
- // 拿到仓库的地址?
87
- const loading = ora('正在生成模板...').start();
88
- gitClone(address, projectPath, {
89
- checkout: 'master'
90
- }, function (err) {
91
- if (err) {
92
- loading.fail('生成失败,请检查网络问题重试')
93
- } else {
94
- loading.succeed('创建完毕')
95
- }
96
- })
97
- }
98
- if (type === 'react') {
99
- console.log('不选ts你是怎么想的');
100
- console.log('重新创建去吧');
101
- }
102
- }