kn-cli 1.0.19 → 1.0.21
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/build/cli.config.js +2 -0
- package/build/webpack.config.js +10 -5
- package/package.json +1 -1
- package/readme.md +12 -0
package/build/cli.config.js
CHANGED
|
@@ -4,11 +4,13 @@ module.exports = {
|
|
|
4
4
|
less:{
|
|
5
5
|
javascriptEnabled:false,//是否开启less js
|
|
6
6
|
},
|
|
7
|
+
// site_root_path:'/dist/',// 默认:'',站点根目录
|
|
7
8
|
// 自定义多入口
|
|
8
9
|
// entry:{
|
|
9
10
|
// 'home/index': 'src/jsx/home/index.jsx',
|
|
10
11
|
// },
|
|
11
12
|
// copyFolder:['static','pluginjs'],//完整复制的文件夹,除了static和pluginjs外其它需要被完整复制的文件夹
|
|
13
|
+
// copyFolder:[{from:'static',to:'folder/static'}],//支持目录自定义配置
|
|
12
14
|
// hashMode:false,//false=关闭编译后的文件使用hash模式使用原始文件名
|
|
13
15
|
// cssModule:'global',//css引用默认的模式,global/local/(path)=>global/local
|
|
14
16
|
// cssModule: (resourcePath) => {
|
package/build/webpack.config.js
CHANGED
|
@@ -11,7 +11,6 @@ const CopyPlugin = require('copy-webpack-plugin');
|
|
|
11
11
|
|
|
12
12
|
//////////// CONFIG ENV ///////////////
|
|
13
13
|
const API_CONFIG = require('./webpack.api.js');
|
|
14
|
-
const cliConfig = require('./cli.config.js');
|
|
15
14
|
let CLI_CONFIG = {};
|
|
16
15
|
let existsCli= fs.existsSync('./cli.config.js');
|
|
17
16
|
if(existsCli){
|
|
@@ -32,7 +31,7 @@ console.log(`=====================env end=========================`);
|
|
|
32
31
|
const devMode = process.env.build_env !== 'prod';
|
|
33
32
|
const hashMode = CLI_CONFIG?.hashMode ?? process.env.build_env != 'localdebug';
|
|
34
33
|
const cssSplitMode = CLI_CONFIG?.cssSplitMode??true;
|
|
35
|
-
const resource_path_relative='';
|
|
34
|
+
const resource_path_relative= CLI_CONFIG?.site_root_path??'';
|
|
36
35
|
const support_sass=CLI_CONFIG?.sass??false;
|
|
37
36
|
const css_modules= CLI_CONFIG?.cssModule??'local';
|
|
38
37
|
const jsSplitMode = CLI_CONFIG?.jsSplitMode??true;
|
|
@@ -51,6 +50,7 @@ if(CLI_CONFIG?.dist){
|
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
|
|
53
|
+
|
|
54
54
|
//////////// CONFIG ENV-END ///////////////
|
|
55
55
|
|
|
56
56
|
|
|
@@ -352,10 +352,15 @@ if(indexHtml){
|
|
|
352
352
|
)
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
-
|
|
355
|
+
let COPY_FOLDER= CLI_CONFIG.copyFolder?['static','pluginjs'].concat(CLI_CONFIG.copyFolder):['static','pluginjs'];
|
|
356
|
+
COPY_FOLDER = [...new Set(COPY_FOLDER)];
|
|
356
357
|
const folderPatterns = COPY_FOLDER.map(folder=>{
|
|
357
|
-
|
|
358
|
-
}
|
|
358
|
+
if(typeof folder === 'string'){
|
|
359
|
+
return { from: dirname + '/' + folder, to: dirname + '/'+distFolder+'/' + folder ,noErrorOnMissing:true};
|
|
360
|
+
}else{
|
|
361
|
+
return { from: dirname + '/' + folder.from, to: dirname + '/'+distFolder+'/' + folder.to ,noErrorOnMissing:true};
|
|
362
|
+
}
|
|
363
|
+
});
|
|
359
364
|
plugins.push(
|
|
360
365
|
new CopyPlugin({
|
|
361
366
|
patterns: folderPatterns||[]
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -29,6 +29,7 @@ module.exports = {
|
|
|
29
29
|
'home/index': 'src/jsx/home/index.jsx',
|
|
30
30
|
},
|
|
31
31
|
copyFolder:['static','pluginjs'],//默认:[],完整复制的文件夹,除了static和pluginjs外其它需要被完整复制的文件夹
|
|
32
|
+
// copyFolder:[{from:'static',to:'folder/static'}],//支持目录自定义配置
|
|
32
33
|
hashMode:false,//默认:true,false=关闭编译后的文件使用hash模式使用原始文件名
|
|
33
34
|
cssModule:'global',//默认:local, css引用默认的模式,global/local/(path)=>global/local
|
|
34
35
|
// cssModule: (resourcePath) => {
|
|
@@ -46,10 +47,21 @@ module.exports = {
|
|
|
46
47
|
sass:true,//默认:false,true=开启sass支持,默认仅支持less
|
|
47
48
|
indexHtml:false,//默认:true,false=关闭index.html的注入
|
|
48
49
|
projectSourceFolder:'./',//默认:'./public',项目源代码文件夹所在位置,默认是'src'
|
|
50
|
+
site_root_path:'',//默认:'',站点根目录,
|
|
51
|
+
// dist:'dist',// 默认:'dist',编译后文件输出目录
|
|
52
|
+
// dist:{// 可详细配置相应资源的输出目录
|
|
53
|
+
// base:'',
|
|
54
|
+
// js:'',//js输出的目录
|
|
55
|
+
// }
|
|
49
56
|
};
|
|
50
57
|
```
|
|
51
58
|
|
|
52
59
|
# 更新日志
|
|
60
|
+
* 1.0.21
|
|
61
|
+
1. cli.config.js内扩展了copyFolder配置项目的功能,现在支持更多配置,详细参考注释
|
|
62
|
+
|
|
63
|
+
* 1.0.20
|
|
64
|
+
1. cli.config.js增加配置site_root_path,用于设置站点根目录
|
|
53
65
|
|
|
54
66
|
* 1.0.19
|
|
55
67
|
1. 对splitChunks内runtime的cli配置支持
|