kn-cli 1.0.56 → 1.0.58

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 (218) hide show
  1. package/build/cli.config.js +5 -0
  2. package/build/webpack.config.js +4 -3
  3. package/package.json +3 -1
  4. package/readme.md +8 -0
  5. package/src/build.js +1 -0
  6. package/templates/template_oa/.DS_Store +0 -0
  7. package/templates/template_oa/build.sh +2 -0
  8. package/templates/template_oa/cli.config.js +24 -0
  9. package/templates/template_oa/dev.sh +89 -0
  10. package/templates/template_oa/frontend_build.sh +83 -0
  11. package/templates/template_oa/init/prepare-commit-msg +5 -0
  12. package/templates/template_oa/init.sh +33 -0
  13. package/templates/template_oa/jsconfig.json +10 -0
  14. package/templates/template_oa/package-lock.json +1925 -0
  15. package/templates/template_oa/package.json +24 -0
  16. package/templates/template_oa/public/.DS_Store +0 -0
  17. package/templates/template_oa/public/404.html +26 -0
  18. package/templates/template_oa/public/favicon.ico +0 -0
  19. package/templates/template_oa/public/favicon.png +0 -0
  20. package/templates/template_oa/public/index.html +43 -0
  21. package/templates/template_oa/public/pluginjs/.DS_Store +0 -0
  22. package/templates/template_oa/public/src/.DS_Store +0 -0
  23. package/templates/template_oa/public/src/_antd.less +237 -0
  24. package/templates/template_oa/public/src/_reset.less +131 -0
  25. package/templates/template_oa/public/src/_variable.less +84 -0
  26. package/templates/template_oa/public/src/assets/.DS_Store +0 -0
  27. package/templates/template_oa/public/src/assets/iconfont/.DS_Store +0 -0
  28. package/templates/template_oa/public/src/assets/iconfont/iconfont.eot +0 -0
  29. package/templates/template_oa/public/src/assets/iconfont/iconfont.less +57 -0
  30. package/templates/template_oa/public/src/assets/iconfont/iconfont.svg +36 -0
  31. package/templates/template_oa/public/src/assets/iconfont/iconfont.ttf +0 -0
  32. package/templates/template_oa/public/src/assets/iconfont/iconfont.woff +0 -0
  33. package/templates/template_oa/public/src/assets/iconfont/iconfont.woff2 +0 -0
  34. package/templates/template_oa/public/src/assets/images/.DS_Store +0 -0
  35. package/templates/template_oa/public/src/assets/images/avatar.png +0 -0
  36. package/templates/template_oa/public/src/assets/images/loading.svg +40 -0
  37. package/templates/template_oa/public/src/components/.DS_Store +0 -0
  38. package/templates/template_oa/public/src/components/Alert/index.jsx +0 -0
  39. package/templates/template_oa/public/src/components/Alert/index.less +0 -0
  40. package/templates/template_oa/public/src/components/Auth/index.jsx +44 -0
  41. package/templates/template_oa/public/src/components/Footer/index.jsx +17 -0
  42. package/templates/template_oa/public/src/components/Footer/index.less +28 -0
  43. package/templates/template_oa/public/src/components/IFrame/index.jsx +37 -0
  44. package/templates/template_oa/public/src/components/IFrame/index.less +4 -0
  45. package/templates/template_oa/public/src/components/IconFont/index.jsx +10 -0
  46. package/templates/template_oa/public/src/components/IconFont/index.less +5 -0
  47. package/templates/template_oa/public/src/components/Layout/.DS_Store +0 -0
  48. package/templates/template_oa/public/src/components/Layout/Basic/index.jsx +31 -0
  49. package/templates/template_oa/public/src/components/Layout/Basic/index.less +74 -0
  50. package/templates/template_oa/public/src/components/Layout/CenterBody/index.jsx +15 -0
  51. package/templates/template_oa/public/src/components/Layout/CenterBody/index.less +36 -0
  52. package/templates/template_oa/public/src/components/Layout/FormBlock/index.jsx +23 -0
  53. package/templates/template_oa/public/src/components/Layout/FormBlock/index.less +34 -0
  54. package/templates/template_oa/public/src/components/Layout/Provider/index.jsx +12 -0
  55. package/templates/template_oa/public/src/components/Layout/index.jsx +26 -0
  56. package/templates/template_oa/public/src/components/Layout/index.less +8 -0
  57. package/templates/template_oa/public/src/components/Link/index.jsx +24 -0
  58. package/templates/template_oa/public/src/components/Link/index.less +11 -0
  59. package/templates/template_oa/public/src/components/Loading/index.jsx +14 -0
  60. package/templates/template_oa/public/src/components/Loading/index.less +85 -0
  61. package/templates/template_oa/public/src/components/Nav/index.jsx +121 -0
  62. package/templates/template_oa/public/src/components/Nav/index.less +38 -0
  63. package/templates/template_oa/public/src/components/Page/.DS_Store +0 -0
  64. package/templates/template_oa/public/src/components/Page/PageLoading/index.jsx +30 -0
  65. package/templates/template_oa/public/src/components/Page/PageLoading/index.less +29 -0
  66. package/templates/template_oa/public/src/components/Popup/index.jsx +22 -0
  67. package/templates/template_oa/public/src/components/Popup/index.less +18 -0
  68. package/templates/template_oa/public/src/components/Toast/index.jsx +60 -0
  69. package/templates/template_oa/public/src/components/Toast/index.less +43 -0
  70. package/templates/template_oa/public/src/components/mask/index.jsx +47 -0
  71. package/templates/template_oa/public/src/components/mask/index.less +32 -0
  72. package/templates/template_oa/public/src/dictionary/index.js +39 -0
  73. package/templates/template_oa/public/src/hooks/.DS_Store +0 -0
  74. package/templates/template_oa/public/src/hooks/index.jsx +20 -0
  75. package/templates/template_oa/public/src/hooks/useDelay.jsx +29 -0
  76. package/templates/template_oa/public/src/hooks/useImageLoader.jsx +27 -0
  77. package/templates/template_oa/public/src/hooks/useLoading.jsx +42 -0
  78. package/templates/template_oa/public/src/hooks/useLogin.jsx +33 -0
  79. package/templates/template_oa/public/src/hooks/usePreload.jsx +66 -0
  80. package/templates/template_oa/public/src/hooks/useScrollTop.jsx +32 -0
  81. package/templates/template_oa/public/src/hooks/useSearch.jsx +137 -0
  82. package/templates/template_oa/public/src/hooks/useUpdate.jsx +11 -0
  83. package/templates/template_oa/public/src/index.jsx +50 -0
  84. package/templates/template_oa/public/src/mock/auth.js +91 -0
  85. package/templates/template_oa/public/src/mock/index.js +63 -0
  86. package/templates/template_oa/public/src/mock/user.js +70 -0
  87. package/templates/template_oa/public/src/mock/utils.js +33 -0
  88. package/templates/template_oa/public/src/pages/.DS_Store +0 -0
  89. package/templates/template_oa/public/src/pages/components/pageTitle/index.jsx +13 -0
  90. package/templates/template_oa/public/src/pages/components/pageTitle/index.less +20 -0
  91. package/templates/template_oa/public/src/pages/login/index.jsx +27 -0
  92. package/templates/template_oa/public/src/pages/login/index.less +44 -0
  93. package/templates/template_oa/public/src/pages/video/index.jsx +91 -0
  94. package/templates/template_oa/public/src/pages/video/index.less +12 -0
  95. package/templates/template_oa/public/src/provider/app.jsx +119 -0
  96. package/templates/template_oa/public/src/provider/menu.jsx +20 -0
  97. package/templates/template_oa/public/src/route.jsx +43 -0
  98. package/templates/template_oa/public/src/services/.DS_Store +0 -0
  99. package/templates/template_oa/public/src/services/auth.js +121 -0
  100. package/templates/template_oa/public/src/services/index.js +181 -0
  101. package/templates/template_oa/public/src/services/user.js +26 -0
  102. package/templates/template_oa/public/src/services/video.js +33 -0
  103. package/templates/template_oa/public/src/utils/.DS_Store +0 -0
  104. package/templates/template_oa/public/src/utils/index.js +66 -0
  105. package/templates/template_oa/public/static/.DS_Store +0 -0
  106. package/templates/template_oa/public/static/about.html +1 -0
  107. package/templates/template_oa/public/static/kssoLogin.html +22 -0
  108. package/templates/template_oa/readme.md +60 -0
  109. package/templates/template_oa/release/.DS_Store +0 -0
  110. package/templates/template_oa/report.sh +68 -0
  111. package/templates/template_oa/tools/.DS_Store +0 -0
  112. package/templates/template_oa/tools/iconfont/.DS_Store +0 -0
  113. package/templates/template_oa/tools/iconfont/dist/.DS_Store +0 -0
  114. package/templates/template_oa/tools/iconfont/gulpfile.js +70 -0
  115. package/templates/template_oa/tools/iconfont/package.json +20 -0
  116. package/templates/template_oa/tools/iconfont/run.sh +39 -0
  117. package/templates/template_oa/tools/iconfont/svg/.DS_Store +0 -0
  118. package/templates/template_oa/tools/iconfont/svg/arrowBack.svg +1 -0
  119. package/templates/template_oa/tools/iconfont/svg/check.svg +1 -0
  120. package/templates/template_oa/tools/iconfont/svg/close.svg +1 -0
  121. package/templates/template_oa/tools/iconfont/svg/down.svg +1 -0
  122. package/templates/template_oa/tools/iconfont/svg/image.svg +1 -0
  123. package/templates/template_oa/tools/iconfont/svg/play.svg +1 -0
  124. package/templates/template_oa/tools/iconfont/svg/refresh.svg +1 -0
  125. package/templates/template_oa/tools/iconfont/svg/warn.svg +1 -0
  126. package/templates/template_oa/tools/iconfont/templates/_icons.css +26 -0
  127. package/templates/template_oa/tools/iconfont/templates/_icons.less +29 -0
  128. package/templates/template_oa/tools/iconfont/templates/index.html +56 -0
  129. package/templates/template_oa/tools/tinypng/.DS_Store +0 -0
  130. package/templates/template_oa/tools/tinypng/img/.DS_Store +0 -0
  131. package/templates/template_oa/tools/tinypng/package.json +11 -0
  132. package/templates/template_oa/tools/tinypng/run.sh +15 -0
  133. package/templates/template_oa/versionPublish.sh +27 -0
  134. package/templates/template_oa/webpack.api.js +62 -0
  135. package/templates/template_offcial/.gitignore +6 -0
  136. package/templates/template_offcial/build.sh +2 -0
  137. package/templates/template_offcial/cli.config.js +25 -0
  138. package/templates/template_offcial/dev.sh +89 -0
  139. package/templates/template_offcial/frontend_build.sh +83 -0
  140. package/templates/template_offcial/init/prepare-commit-msg +5 -0
  141. package/templates/template_offcial/init.sh +33 -0
  142. package/templates/template_offcial/jsconfig.json +10 -0
  143. package/templates/template_offcial/package.json +23 -0
  144. package/templates/template_offcial/public/404.html +26 -0
  145. package/templates/template_offcial/public/favicon.ico +0 -0
  146. package/templates/template_offcial/public/favicon.png +0 -0
  147. package/templates/template_offcial/public/index.html +52 -0
  148. package/templates/template_offcial/public/src/_antd.less +4 -0
  149. package/templates/template_offcial/public/src/_reset.less +130 -0
  150. package/templates/template_offcial/public/src/_variable.less +78 -0
  151. package/templates/template_offcial/public/src/assets/iconfont/iconfont.eot +0 -0
  152. package/templates/template_offcial/public/src/assets/iconfont/iconfont.less +57 -0
  153. package/templates/template_offcial/public/src/assets/iconfont/iconfont.svg +36 -0
  154. package/templates/template_offcial/public/src/assets/iconfont/iconfont.ttf +0 -0
  155. package/templates/template_offcial/public/src/assets/iconfont/iconfont.woff +0 -0
  156. package/templates/template_offcial/public/src/assets/iconfont/iconfont.woff2 +0 -0
  157. package/templates/template_offcial/public/src/assets/images/avatar.png +0 -0
  158. package/templates/template_offcial/public/src/assets/images/loading.svg +40 -0
  159. package/templates/template_offcial/public/src/components/Alert/index.jsx +0 -0
  160. package/templates/template_offcial/public/src/components/Alert/index.less +0 -0
  161. package/templates/template_offcial/public/src/components/Footer/index.jsx +32 -0
  162. package/templates/template_offcial/public/src/components/Footer/index.less +8 -0
  163. package/templates/template_offcial/public/src/components/Header/index.jsx +68 -0
  164. package/templates/template_offcial/public/src/components/Header/index.less +76 -0
  165. package/templates/template_offcial/public/src/components/IconFont/index.jsx +10 -0
  166. package/templates/template_offcial/public/src/components/IconFont/index.less +5 -0
  167. package/templates/template_offcial/public/src/components/Layout/Provider/index.jsx +12 -0
  168. package/templates/template_offcial/public/src/components/Layout/index.jsx +20 -0
  169. package/templates/template_offcial/public/src/components/Layout/index.less +20 -0
  170. package/templates/template_offcial/public/src/components/Link/index.jsx +24 -0
  171. package/templates/template_offcial/public/src/components/Link/index.less +11 -0
  172. package/templates/template_offcial/public/src/components/Page/PageLoading/index.jsx +30 -0
  173. package/templates/template_offcial/public/src/components/Page/PageLoading/index.less +29 -0
  174. package/templates/template_offcial/public/src/components/Popup/index.jsx +22 -0
  175. package/templates/template_offcial/public/src/components/Popup/index.less +18 -0
  176. package/templates/template_offcial/public/src/components/Toast/index.jsx +60 -0
  177. package/templates/template_offcial/public/src/components/Toast/index.less +43 -0
  178. package/templates/template_offcial/public/src/hooks/index.jsx +12 -0
  179. package/templates/template_offcial/public/src/hooks/useImageLoader.jsx +27 -0
  180. package/templates/template_offcial/public/src/hooks/useInToView.jsx +55 -0
  181. package/templates/template_offcial/public/src/hooks/usePreload.jsx +66 -0
  182. package/templates/template_offcial/public/src/hooks/useScroll.jsx +66 -0
  183. package/templates/template_offcial/public/src/index.jsx +50 -0
  184. package/templates/template_offcial/public/src/mock/index.js +63 -0
  185. package/templates/template_offcial/public/src/mock/user.js +70 -0
  186. package/templates/template_offcial/public/src/mock/utils.js +33 -0
  187. package/templates/template_offcial/public/src/pages/index.jsx +23 -0
  188. package/templates/template_offcial/public/src/pages/index.less +0 -0
  189. package/templates/template_offcial/public/src/pages/mobile/index.jsx +11 -0
  190. package/templates/template_offcial/public/src/pages/mobile/index.less +0 -0
  191. package/templates/template_offcial/public/src/pages/pc/index.jsx +45 -0
  192. package/templates/template_offcial/public/src/pages/pc/index.less +42 -0
  193. package/templates/template_offcial/public/src/provider/app.jsx +26 -0
  194. package/templates/template_offcial/public/src/route.jsx +26 -0
  195. package/templates/template_offcial/public/src/services/index.js +182 -0
  196. package/templates/template_offcial/public/src/services/user.js +26 -0
  197. package/templates/template_offcial/public/src/utils/index.js +109 -0
  198. package/templates/template_offcial/public/static/about.html +1 -0
  199. package/templates/template_offcial/readme.md +59 -0
  200. package/templates/template_offcial/report.sh +68 -0
  201. package/templates/template_offcial/tools/iconfont/gulpfile.js +70 -0
  202. package/templates/template_offcial/tools/iconfont/package.json +20 -0
  203. package/templates/template_offcial/tools/iconfont/run.sh +39 -0
  204. package/templates/template_offcial/tools/iconfont/svg/arrowBack.svg +1 -0
  205. package/templates/template_offcial/tools/iconfont/svg/check.svg +1 -0
  206. package/templates/template_offcial/tools/iconfont/svg/close.svg +1 -0
  207. package/templates/template_offcial/tools/iconfont/svg/down.svg +1 -0
  208. package/templates/template_offcial/tools/iconfont/svg/image.svg +1 -0
  209. package/templates/template_offcial/tools/iconfont/svg/play.svg +1 -0
  210. package/templates/template_offcial/tools/iconfont/svg/refresh.svg +1 -0
  211. package/templates/template_offcial/tools/iconfont/svg/warn.svg +1 -0
  212. package/templates/template_offcial/tools/iconfont/templates/_icons.css +26 -0
  213. package/templates/template_offcial/tools/iconfont/templates/_icons.less +29 -0
  214. package/templates/template_offcial/tools/iconfont/templates/index.html +56 -0
  215. package/templates/template_offcial/tools/tinypng/package.json +11 -0
  216. package/templates/template_offcial/tools/tinypng/run.sh +15 -0
  217. package/templates/template_offcial/versionPublish.sh +27 -0
  218. package/templates/template_offcial/webpack.api.js +36 -0
@@ -38,4 +38,9 @@ module.exports = {
38
38
  // output:'../index.html',//将index.html输出到 dist目录外的index.html
39
39
  // },
40
40
  // projectSourceFolder:'./',//项目源代码文件夹所在位置,默认是'src'
41
+ // devServer:{
42
+ // host:'0.0.0.0',//指定调试地址IP
43
+ // port:8080,
44
+ // useLocalIp:false,//是否使用本地IP地址代替localhost
45
+ // }
41
46
  };
@@ -41,6 +41,7 @@ const jsSplitMode = CLI_CONFIG?.jsSplitMode??true;
41
41
  const indexHtml = CLI_CONFIG?.indexHtml ?? true;
42
42
  const https= CLI_CONFIG?.https ?? false;
43
43
  const appVersion= CLI_CONFIG?.version ?? '';
44
+ const devServer=CLI_CONFIG?.devServer??{};
44
45
 
45
46
  let distFolder = 'dist';
46
47
  let distJsFolder='';
@@ -460,7 +461,7 @@ module.exports = {
460
461
  devServer: {
461
462
  disableHostCheck: true,
462
463
  contentBase: distFolder,
463
- host: '0.0.0.0',
464
+ host: devServer?.host??'localhost',
464
465
  open: true,
465
466
  overlay:true,
466
467
  stats:{
@@ -470,8 +471,8 @@ module.exports = {
470
471
  errorDetails:true,
471
472
  warnings:true
472
473
  },
473
- // port: 8080,
474
- // useLocalIp:true,
474
+ port: devServer?.port??8080,
475
+ useLocalIp:devServer?.useLocalIp??false,
475
476
  https:https,//true,//注意开了https就不能使用本地ip访问,只能使用0.0.0.0
476
477
  proxy: API_CONFIG.API_PROXY
477
478
  // hot: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kn-cli",
3
- "version": "1.0.56",
3
+ "version": "1.0.58",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -11,6 +11,8 @@
11
11
  "src/",
12
12
  "templates/template_app/",
13
13
  "templates/template_admin/",
14
+ "templates/template_oa/",
15
+ "templates/template_offcial/",
14
16
  "build"
15
17
  ],
16
18
  "bin": {
package/readme.md CHANGED
@@ -65,10 +65,18 @@ module.exports = {
65
65
  // rules:{
66
66
  // compileNpmPackage:['kn-hooks'],//需要参与编译的npm包
67
67
  // },
68
+ // devServer:{
69
+ // host:'0.0.0.0',//指定调试地址IP
70
+ // port:8080,
71
+ // useLocalIp:false,//是否使用本地IP地址代替localhost
72
+ // }
68
73
  };
69
74
  ```
70
75
 
71
76
  # 更新日志
77
+ * 1.0.57
78
+ 增加cli.config.js内devServer配置
79
+
72
80
  * 1.0.56
73
81
  OA模板更新
74
82
 
package/src/build.js CHANGED
@@ -315,6 +315,7 @@ module.exports= async (options={})=> {
315
315
  throw new Error(`
316
316
  ==============执行build异常=============
317
317
  ${req.stdout}
318
+ ${req.stderr}
318
319
  ==============执行build异常END=============
319
320
  `);
320
321
  }
Binary file
@@ -0,0 +1,2 @@
1
+ export build_env=dev
2
+ sh frontend_build.sh
@@ -0,0 +1,24 @@
1
+
2
+ module.exports = {
3
+ name:'template-oa',
4
+ registryType:'npm',//npm镜像源,taobao|npm
5
+ less:{
6
+ javascriptEnabled:true,//是否开启less js
7
+ },
8
+ rules:{
9
+ compileNpmPackage:['kn-hooks'],//需要参与编译的npm包
10
+ },
11
+ cssModule: (resourcePath) => {
12
+ console.log(resourcePath)
13
+ // antd.less编译的时候使用global模式
14
+ if (/antd.less$/i.test(resourcePath)) {
15
+ return 'global'
16
+ }
17
+ return "local";
18
+ },
19
+ // 自定义多入口
20
+ // entry:{
21
+ // 'home/index': 'src/jsx/home/index.jsx',
22
+ // },
23
+ // copyFolder:['images','plugins'],//完整复制的文件夹
24
+ };
@@ -0,0 +1,89 @@
1
+ if [ -d "${HOME}/.nvm/" ]
2
+ then
3
+ . ${HOME}/.nvm/nvm.sh
4
+ fi
5
+
6
+ node_version="v16.18.0"
7
+
8
+ checkNode(){
9
+ for line in `node -v`
10
+ do
11
+ if [ $line != $node_version ]
12
+ then
13
+ echo "change Node from $line to $node_version"
14
+ nvm use $node_version
15
+ ret=$?
16
+ if [ $ret != 0 ]
17
+ then
18
+ echo "Please run nvm install $node_version"
19
+ exit 3
20
+ else
21
+ return 0
22
+ fi
23
+ else
24
+ return 0
25
+ fi
26
+ done
27
+ }
28
+
29
+ checkResult(){
30
+ ret=$?
31
+ if [ $ret != 0 ]
32
+ then
33
+ echo "[$1]执行失败"
34
+ exit 2
35
+ return 0
36
+ else
37
+ echo "[$1]执行成功"
38
+ return 0
39
+ fi
40
+ }
41
+
42
+
43
+
44
+
45
+ # 智能检测并安装/升级CLI的版本
46
+ checkKnCli(){
47
+ # dev只需要保持安装了就行,版本通过开发自己控制
48
+ if ! [ -x "$(command -v kn-cli)" ]
49
+ then
50
+ echo "安装kn-cli"
51
+ npm i kn-cli -g
52
+ return 0
53
+ fi
54
+ # for line in `npm view kn-cli version`
55
+ # do
56
+ # for line2 in `kn-cli -v`
57
+ # do
58
+ # if [ $line != $line2 ]
59
+ # then
60
+ # echo "升级kn-cli"
61
+ # npm upgrade kn-cli -g
62
+ # return 0
63
+ # fi
64
+ # done
65
+ # done
66
+ # return 0
67
+ }
68
+
69
+
70
+
71
+ build(){
72
+ npm config delete registry -g
73
+ npm config delete registry
74
+
75
+ checkKnCli
76
+ checkResult "检查kn-cli"
77
+ # dev_mode=watch 代表使用 webpack -w模式将文件编译后生成到磁盘上进行监听更新
78
+ # 默认情况下为 webpack-dev-server模式,将资源编译后放入内存监听
79
+ # export dev_mode=watch
80
+
81
+ kn-cli --dev
82
+ checkResult "kn-cli --dev"
83
+ }
84
+
85
+ checkNode
86
+ checkResult "检查node"
87
+
88
+ build
89
+ checkResult "build"
@@ -0,0 +1,83 @@
1
+ if [ -d "${HOME}/.nvm/" ]
2
+ then
3
+ . ${HOME}/.nvm/nvm.sh
4
+ fi
5
+
6
+ export mock=0
7
+ export oSkipNpmInstall=1
8
+ node_version="v16.18.0"
9
+
10
+ checkNode(){
11
+ for line in `node -v`
12
+ do
13
+ if [ $line != $node_version ]
14
+ then
15
+ echo "change Node from $line to $node_version"
16
+ nvm use $node_version
17
+ ret=$?
18
+ if [ $ret != 0 ]
19
+ then
20
+ echo "Please run nvm install $node_version"
21
+ exit 3
22
+ else
23
+ return 0
24
+ fi
25
+ else
26
+ return 0
27
+ fi
28
+ done
29
+ }
30
+
31
+
32
+ checkKnCli(){
33
+ if ! [ -x "$(command -v kn-cli)" ]
34
+ then
35
+ npm i kn-cli -g
36
+ return 0
37
+ fi
38
+ return 0
39
+ }
40
+
41
+
42
+ checkResult(){
43
+ ret=$?
44
+ if [ $ret != 0 ]
45
+ then
46
+ echo "[$1]执行失败"
47
+ exit 2
48
+ return 0
49
+ else
50
+ echo "[$1]执行成功"
51
+ return 0
52
+ fi
53
+ }
54
+
55
+ build(){
56
+ npm config delete registry -g
57
+ npm config delete registry
58
+
59
+ rm -rf release
60
+ checkResult "清理release"
61
+
62
+ checkKnCli
63
+ checkResult "检查kn-cli"
64
+
65
+ # npm i kn-cli@1.0.2 -g
66
+ # checkResult "npm kn-cli"
67
+
68
+ kn-cli --build
69
+ checkResult "kn-cli --build"
70
+
71
+ mv public/dist release/
72
+ checkResult "打包结果同步至release"
73
+ }
74
+
75
+ checkNode
76
+ checkResult "检查node"
77
+
78
+
79
+ build
80
+ checkResult "build"
81
+
82
+
83
+
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ # 查询当前分支
4
+ NAME=[$(git branch | grep '*' | grep -Eo "\S+$")]
5
+ echo "$NAME"': '$(cat "$1") > "$1"
@@ -0,0 +1,33 @@
1
+ checkResult(){
2
+ ret=$?
3
+ if [ $ret != 0 ]
4
+ then
5
+ echo "[$1]执行失败"
6
+ exit 2
7
+ return 0
8
+ else
9
+ echo "[$1]执行成功"
10
+ return 0
11
+ fi
12
+ }
13
+
14
+ echo "安装git提交钩子脚本 cp prepare-commit-msg ./.git/hooks/prepare-commit-msg"
15
+ ls -A ./.git/
16
+ ret=$?
17
+ if [ $ret != 0 ]
18
+ then
19
+ echo "缺少.git文件夹"
20
+ exit 2
21
+ fi
22
+
23
+ ls -A ./.git/hooks/
24
+ ret=$?
25
+ if [ $ret != 0 ]
26
+ then
27
+ mkdir ./.git/hooks
28
+ checkResult '创建hooks文件夹'
29
+ fi
30
+ cp ./init/prepare-commit-msg ./.git/hooks/prepare-commit-msg
31
+ checkResult '复制prepare-commit-msg'
32
+ chmod u+x ./.git/hooks/prepare-commit-msg
33
+ checkResult '权限变更prepare-commit-msg'
@@ -0,0 +1,10 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "emitDecoratorMetadata": true,
5
+ "experimentalDecorators": true,
6
+ "paths": {
7
+ "@/*": ["./public/src/*"]
8
+ }
9
+ },
10
+ }