kn-cli 1.0.84 → 1.0.85
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/package.json +1 -1
- package/readme.md +20 -18
- package/src/getTools.js +14 -3
- package/templates/template_admin/cli.config.js +4 -0
- package/templates/template_app/cli.config.js +4 -0
- package/templates/template_oa/cli.config.js +4 -0
- package/templates/template_oa_jwt/cli.config.js +1 -1
- package/templates/template_offcial/cli.config.js +4 -0
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
# 快速开始
|
|
5
5
|
0. node使用16.18.0
|
|
6
|
-
1. 安装: npm i kn-cli -g
|
|
7
|
-
2. 创建项目: kn-cli --create
|
|
8
|
-
3. 调试项目:
|
|
6
|
+
1. 安装: `npm i kn-cli -g`
|
|
7
|
+
2. 创建项目: `kn-cli --create`
|
|
8
|
+
3. 调试项目: `sh dev.sh`
|
|
9
9
|
* 当`export dev_mode=watch`时,将不会独立启动http服务,而是直接将编译后资源输出到文件夹内并监听源代码的变化后重新编译
|
|
10
|
-
4. 编译项目:
|
|
10
|
+
4. 编译项目: `sh build.sh`或`sh frontend_build.sh`
|
|
11
11
|
5. 当项目中需要添加第三方npm包时,务必使用--save参数`npm i 包名 --save`
|
|
12
|
-
6.
|
|
13
|
-
|
|
12
|
+
6. 包模块分析:`sh report.sh`
|
|
14
13
|
|
|
15
14
|
> 项目创建后,记得执行sh init.sh 以激活git分支提交日志
|
|
16
15
|
|
|
@@ -24,7 +23,7 @@
|
|
|
24
23
|
# cli 其它常用方法
|
|
25
24
|
1. 查看版本号: `kn-cli -v`
|
|
26
25
|
2. 创建辅助工具:`kn-cli --tool`
|
|
27
|
-
目前辅助工具有:图片压缩、word转html、iconfont
|
|
26
|
+
目前辅助工具有:图片压缩、word转html、iconfont、资源引用检查、docker容器内运行
|
|
28
27
|
|
|
29
28
|
|
|
30
29
|
# cli.config.js - 构建配置文件
|
|
@@ -90,32 +89,32 @@ module.exports = {
|
|
|
90
89
|
|
|
91
90
|
|
|
92
91
|
# 环境变量
|
|
93
|
-
build_env
|
|
92
|
+
**build_env**
|
|
94
93
|
可选值:localdebug|dev|prod
|
|
95
94
|
控制构建模式,localdebug本地调试、dev测试环境、prod生产
|
|
96
95
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
可选值:clear|all
|
|
96
|
+
**build_log_level**
|
|
97
|
+
可选值:clear|all
|
|
100
98
|
控制输出的日志类型,如果不手动接入的话,prod模式下为简洁模式,开发模式下为全量输出
|
|
101
99
|
|
|
102
|
-
|
|
103
|
-
noSkipNpmInstall
|
|
100
|
+
**noSkipNpmInstall**
|
|
104
101
|
可选值:1|0
|
|
102
|
+
默认值:1
|
|
105
103
|
是否跳过npm install以增加启动速度,prod模式下必然为1,其它模式下根据用户选择
|
|
106
104
|
|
|
107
|
-
mock
|
|
105
|
+
**mock**
|
|
108
106
|
可选值:1|0
|
|
107
|
+
默认值:0
|
|
109
108
|
是否打开mock
|
|
110
109
|
|
|
111
|
-
|
|
112
|
-
registryType
|
|
110
|
+
**registryType**
|
|
113
111
|
可选值:taobao|zheda|huawei|空值
|
|
112
|
+
默认值:空值
|
|
114
113
|
npm镜像源
|
|
115
114
|
|
|
116
|
-
|
|
117
|
-
dev_mode
|
|
115
|
+
**dev_mode**
|
|
118
116
|
可选值:watch|空值
|
|
117
|
+
默认值:空值
|
|
119
118
|
调试模式是用的watch文件监听,还是webpack-dev-server监听模式
|
|
120
119
|
|
|
121
120
|
report
|
|
@@ -133,6 +132,9 @@ report
|
|
|
133
132
|
|
|
134
133
|
|
|
135
134
|
# 更新日志
|
|
135
|
+
* 1.0.85
|
|
136
|
+
cli工具内增加docker环境工具,用于将当前项目直接在docker内运行
|
|
137
|
+
|
|
136
138
|
* 1.0.82
|
|
137
139
|
增加环境变量:build_log_level ,用于控制输出的日志类型
|
|
138
140
|
|
package/src/getTools.js
CHANGED
|
@@ -5,6 +5,9 @@ const {Listr} = require('listr2');
|
|
|
5
5
|
const {TaskNodeVersion,copyDir}= require('./utils');
|
|
6
6
|
const inquirer = require('inquirer');
|
|
7
7
|
const ROOT=path.resolve(__dirname,"../");
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const shelljs = require('shelljs');
|
|
10
|
+
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
13
|
* 创建工具
|
|
@@ -24,7 +27,8 @@ module.exports=async ()=> {
|
|
|
24
27
|
'图片压缩',
|
|
25
28
|
'word转html',
|
|
26
29
|
'iconFont图标字体',
|
|
27
|
-
'资源引用检查'
|
|
30
|
+
'资源引用检查',
|
|
31
|
+
'docker'
|
|
28
32
|
],
|
|
29
33
|
default:''
|
|
30
34
|
},
|
|
@@ -35,7 +39,7 @@ module.exports=async ()=> {
|
|
|
35
39
|
case 'iconFont图标字体':{templateName='iconfont'}break;
|
|
36
40
|
case 'word转html':{templateName='word2html'}break;
|
|
37
41
|
case '资源引用检查':{templateName='fileCase'}break;
|
|
38
|
-
|
|
42
|
+
case 'docker':{templateName='docker'}break;
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
|
|
@@ -45,7 +49,14 @@ module.exports=async ()=> {
|
|
|
45
49
|
},
|
|
46
50
|
{
|
|
47
51
|
title: "工具创建中",
|
|
48
|
-
task: () =>
|
|
52
|
+
task: () => {
|
|
53
|
+
let toolsDir= path.resolve(sourceDir,'tools')
|
|
54
|
+
const exists = fs.existsSync(toolsDir);
|
|
55
|
+
if(exists==false){
|
|
56
|
+
shelljs.mkdir(toolsDir);
|
|
57
|
+
}
|
|
58
|
+
copyDir(path.resolve(templatesDir,templateName),path.resolve(toolsDir,templateName))
|
|
59
|
+
}
|
|
49
60
|
},
|
|
50
61
|
]);
|
|
51
62
|
try{
|