neo-cmp-cli 1.8.2 → 1.8.3

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 (200) hide show
  1. package/bin/neo.js +1 -1
  2. package/package.json +6 -5
  3. package/src/{module/index.js → index.js} +14 -14
  4. package/src/{module/main.js → main.js} +18 -18
  5. package/src/module/neoInitByCopy.js +6 -6
  6. package/src/neo/webpack.mf.js +1 -1
  7. package/src/oss/publish2oss.js +1 -1
  8. package/src/utils/cmpUtils/createCmpByZip.js +7 -5
  9. package/src/utils/cmpUtils/pullCmp.js +1 -1
  10. package/src/utils/cmpUtils/pushCmp.js +9 -7
  11. package/src/utils/projectUtils/updatePublishLog.js +1 -1
  12. package/test/demo.js +1 -1
  13. package/test/demo3.js +1 -1
  14. package/test/neo.config.js +77 -0
  15. package/src/template/antd-custom-cmp-template/.prettierrc.js +0 -12
  16. package/src/template/antd-custom-cmp-template/README.md +0 -153
  17. package/src/template/antd-custom-cmp-template/commitlint.config.js +0 -59
  18. package/src/template/antd-custom-cmp-template/neo.config.js +0 -144
  19. package/src/template/antd-custom-cmp-template/package.json +0 -60
  20. package/src/template/antd-custom-cmp-template/public/css/base.css +0 -283
  21. package/src/template/antd-custom-cmp-template/public/scripts/app/bluebird.js +0 -6679
  22. package/src/template/antd-custom-cmp-template/public/template.html +0 -13
  23. package/src/template/antd-custom-cmp-template/src/assets/css/common.scss +0 -127
  24. package/src/template/antd-custom-cmp-template/src/assets/css/mixin.scss +0 -47
  25. package/src/template/antd-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  26. package/src/template/antd-custom-cmp-template/src/assets/img/custom-widget.svg +0 -1
  27. package/src/template/antd-custom-cmp-template/src/assets/img/favicon.png +0 -0
  28. package/src/template/antd-custom-cmp-template/src/components/dataDashboard/README.md +0 -39
  29. package/src/template/antd-custom-cmp-template/src/components/dataDashboard/index.tsx +0 -462
  30. package/src/template/antd-custom-cmp-template/src/components/dataDashboard/model.ts +0 -75
  31. package/src/template/antd-custom-cmp-template/src/components/dataDashboard/style.scss +0 -1667
  32. package/src/template/antd-custom-cmp-template/src/components/infoCard/index.tsx +0 -87
  33. package/src/template/antd-custom-cmp-template/src/components/infoCard/model.ts +0 -80
  34. package/src/template/antd-custom-cmp-template/src/components/infoCard/style.scss +0 -105
  35. package/src/template/antd-custom-cmp-template/tsconfig.json +0 -68
  36. package/src/template/develop/neo-custom-cmp-template/.prettierrc.js +0 -12
  37. package/src/template/develop/neo-custom-cmp-template/README.md +0 -48
  38. package/src/template/develop/neo-custom-cmp-template/commitlint.config.js +0 -59
  39. package/src/template/develop/neo-custom-cmp-template/docs/README.md +0 -13
  40. package/src/template/develop/neo-custom-cmp-template/neo.config.js +0 -121
  41. package/src/template/develop/neo-custom-cmp-template/package.json +0 -63
  42. package/src/template/develop/neo-custom-cmp-template/public/css/base.css +0 -283
  43. package/src/template/develop/neo-custom-cmp-template/public/scripts/app/bluebird.js +0 -6679
  44. package/src/template/develop/neo-custom-cmp-template/public/template.html +0 -13
  45. package/src/template/develop/neo-custom-cmp-template/src/assets/css/common.scss +0 -127
  46. package/src/template/develop/neo-custom-cmp-template/src/assets/css/mixin.scss +0 -47
  47. package/src/template/develop/neo-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  48. package/src/template/develop/neo-custom-cmp-template/src/assets/img/custom-widget.svg +0 -1
  49. package/src/template/develop/neo-custom-cmp-template/src/assets/img/favicon.png +0 -0
  50. package/src/template/develop/neo-custom-cmp-template/src/assets/img/table.svg +0 -1
  51. package/src/template/develop/neo-custom-cmp-template/src/components/contactCardList/README.md +0 -65
  52. package/src/template/develop/neo-custom-cmp-template/src/components/contactCardList/index.tsx +0 -180
  53. package/src/template/develop/neo-custom-cmp-template/src/components/contactCardList/model.ts +0 -50
  54. package/src/template/develop/neo-custom-cmp-template/src/components/contactCardList/style.scss +0 -260
  55. package/src/template/develop/neo-custom-cmp-template/src/components/contactForm/README.md +0 -94
  56. package/src/template/develop/neo-custom-cmp-template/src/components/contactForm/index.tsx +0 -251
  57. package/src/template/develop/neo-custom-cmp-template/src/components/contactForm/model.ts +0 -56
  58. package/src/template/develop/neo-custom-cmp-template/src/components/contactForm/style.scss +0 -120
  59. package/src/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/README.md +0 -115
  60. package/src/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/index.tsx +0 -304
  61. package/src/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/model.ts +0 -87
  62. package/src/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/style.scss +0 -127
  63. package/src/template/develop/neo-custom-cmp-template/src/utils/axiosFetcher.ts +0 -29
  64. package/src/template/develop/neo-custom-cmp-template/src/utils/queryObjectData.ts +0 -39
  65. package/src/template/develop/neo-custom-cmp-template/src/utils/xobjects.ts +0 -203
  66. package/src/template/develop/neo-custom-cmp-template/tsconfig.json +0 -68
  67. package/src/template/echarts-custom-cmp-template/.prettierrc.js +0 -12
  68. package/src/template/echarts-custom-cmp-template/README.md +0 -198
  69. package/src/template/echarts-custom-cmp-template/commitlint.config.js +0 -59
  70. package/src/template/echarts-custom-cmp-template/neo.config.js +0 -140
  71. package/src/template/echarts-custom-cmp-template/package.json +0 -61
  72. package/src/template/echarts-custom-cmp-template/public/css/base.css +0 -283
  73. package/src/template/echarts-custom-cmp-template/public/scripts/app/bluebird.js +0 -6679
  74. package/src/template/echarts-custom-cmp-template/public/template.html +0 -13
  75. package/src/template/echarts-custom-cmp-template/src/assets/css/common.scss +0 -127
  76. package/src/template/echarts-custom-cmp-template/src/assets/css/mixin.scss +0 -47
  77. package/src/template/echarts-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  78. package/src/template/echarts-custom-cmp-template/src/assets/img/chart.svg +0 -1
  79. package/src/template/echarts-custom-cmp-template/src/assets/img/custom-widget.svg +0 -1
  80. package/src/template/echarts-custom-cmp-template/src/assets/img/favicon.png +0 -0
  81. package/src/template/echarts-custom-cmp-template/src/components/chartWidget/README.md +0 -186
  82. package/src/template/echarts-custom-cmp-template/src/components/chartWidget/index.tsx +0 -724
  83. package/src/template/echarts-custom-cmp-template/src/components/chartWidget/model.ts +0 -151
  84. package/src/template/echarts-custom-cmp-template/src/components/chartWidget/style.scss +0 -209
  85. package/src/template/echarts-custom-cmp-template/src/components/mapWidget/README.md +0 -125
  86. package/src/template/echarts-custom-cmp-template/src/components/mapWidget/USAGE.md +0 -190
  87. package/src/template/echarts-custom-cmp-template/src/components/mapWidget/index.tsx +0 -385
  88. package/src/template/echarts-custom-cmp-template/src/components/mapWidget/model.ts +0 -107
  89. package/src/template/echarts-custom-cmp-template/src/components/mapWidget/style.scss +0 -192
  90. package/src/template/echarts-custom-cmp-template/src/utils/url.ts +0 -82
  91. package/src/template/echarts-custom-cmp-template/tsconfig.json +0 -68
  92. package/src/template/empty-cmp/index.tsx +0 -58
  93. package/src/template/empty-cmp/model.ts +0 -79
  94. package/src/template/empty-cmp/style.scss +0 -72
  95. package/src/template/empty-custom-cmp-template/.prettierrc.js +0 -12
  96. package/src/template/empty-custom-cmp-template/README.md +0 -154
  97. package/src/template/empty-custom-cmp-template/commitlint.config.js +0 -59
  98. package/src/template/empty-custom-cmp-template/neo.config.js +0 -138
  99. package/src/template/empty-custom-cmp-template/package.json +0 -58
  100. package/src/template/empty-custom-cmp-template/public/css/base.css +0 -283
  101. package/src/template/empty-custom-cmp-template/public/scripts/app/bluebird.js +0 -6679
  102. package/src/template/empty-custom-cmp-template/public/template.html +0 -13
  103. package/src/template/empty-custom-cmp-template/src/assets/css/common.scss +0 -127
  104. package/src/template/empty-custom-cmp-template/src/assets/css/mixin.scss +0 -47
  105. package/src/template/empty-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  106. package/src/template/empty-custom-cmp-template/src/assets/img/custom-widget.svg +0 -1
  107. package/src/template/empty-custom-cmp-template/src/assets/img/favicon.png +0 -0
  108. package/src/template/empty-custom-cmp-template/src/assets/img/map.svg +0 -1
  109. package/src/template/empty-custom-cmp-template/src/components/README.md +0 -3
  110. package/src/template/empty-custom-cmp-template/tsconfig.json +0 -68
  111. package/src/template/neo-custom-cmp-template/.prettierrc.js +0 -12
  112. package/src/template/neo-custom-cmp-template/README.md +0 -155
  113. package/src/template/neo-custom-cmp-template/commitlint.config.js +0 -59
  114. package/src/template/neo-custom-cmp-template/docs/README.md +0 -244
  115. package/src/template/neo-custom-cmp-template/neo.config.js +0 -140
  116. package/src/template/neo-custom-cmp-template/package.json +0 -66
  117. package/src/template/neo-custom-cmp-template/public/css/base.css +0 -283
  118. package/src/template/neo-custom-cmp-template/public/scripts/app/bluebird.js +0 -6679
  119. package/src/template/neo-custom-cmp-template/public/template.html +0 -13
  120. package/src/template/neo-custom-cmp-template/src/assets/css/common.scss +0 -127
  121. package/src/template/neo-custom-cmp-template/src/assets/css/mixin.scss +0 -47
  122. package/src/template/neo-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  123. package/src/template/neo-custom-cmp-template/src/assets/img/card-list.svg +0 -1
  124. package/src/template/neo-custom-cmp-template/src/assets/img/contact-form.svg +0 -1
  125. package/src/template/neo-custom-cmp-template/src/assets/img/custom-form.svg +0 -1
  126. package/src/template/neo-custom-cmp-template/src/assets/img/custom-widget.svg +0 -1
  127. package/src/template/neo-custom-cmp-template/src/assets/img/data-list.svg +0 -1
  128. package/src/template/neo-custom-cmp-template/src/assets/img/detail.svg +0 -1
  129. package/src/template/neo-custom-cmp-template/src/assets/img/table.svg +0 -1
  130. package/src/template/neo-custom-cmp-template/src/components/entityCardList/README.md +0 -61
  131. package/src/template/neo-custom-cmp-template/src/components/entityCardList/index.tsx +0 -202
  132. package/src/template/neo-custom-cmp-template/src/components/entityCardList/model.ts +0 -74
  133. package/src/template/neo-custom-cmp-template/src/components/entityCardList/style.scss +0 -260
  134. package/src/template/neo-custom-cmp-template/src/components/entityDetail/README.md +0 -176
  135. package/src/template/neo-custom-cmp-template/src/components/entityDetail/index.tsx +0 -334
  136. package/src/template/neo-custom-cmp-template/src/components/entityDetail/model.ts +0 -123
  137. package/src/template/neo-custom-cmp-template/src/components/entityDetail/style.scss +0 -292
  138. package/src/template/neo-custom-cmp-template/src/components/entityForm/README.md +0 -176
  139. package/src/template/neo-custom-cmp-template/src/components/entityForm/index.tsx +0 -615
  140. package/src/template/neo-custom-cmp-template/src/components/entityForm/model.ts +0 -107
  141. package/src/template/neo-custom-cmp-template/src/components/entityForm/style.scss +0 -370
  142. package/src/template/neo-custom-cmp-template/src/components/entityTable/README.md +0 -92
  143. package/src/template/neo-custom-cmp-template/src/components/entityTable/index.tsx +0 -784
  144. package/src/template/neo-custom-cmp-template/src/components/entityTable/model.ts +0 -134
  145. package/src/template/neo-custom-cmp-template/src/components/entityTable/style.scss +0 -304
  146. package/src/template/neo-custom-cmp-template/src/utils/axiosFetcher.ts +0 -37
  147. package/src/template/neo-custom-cmp-template/src/utils/queryObjectData.ts +0 -76
  148. package/src/template/neo-custom-cmp-template/src/utils/xobjects.ts +0 -162
  149. package/src/template/neo-custom-cmp-template/tsconfig.json +0 -49
  150. package/src/template/react-custom-cmp-template/.prettierrc.js +0 -12
  151. package/src/template/react-custom-cmp-template/README.md +0 -154
  152. package/src/template/react-custom-cmp-template/commitlint.config.js +0 -59
  153. package/src/template/react-custom-cmp-template/neo.config.js +0 -137
  154. package/src/template/react-custom-cmp-template/package.json +0 -57
  155. package/src/template/react-custom-cmp-template/public/css/base.css +0 -283
  156. package/src/template/react-custom-cmp-template/public/scripts/app/bluebird.js +0 -6679
  157. package/src/template/react-custom-cmp-template/public/template.html +0 -13
  158. package/src/template/react-custom-cmp-template/src/assets/css/common.scss +0 -127
  159. package/src/template/react-custom-cmp-template/src/assets/css/mixin.scss +0 -47
  160. package/src/template/react-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  161. package/src/template/react-custom-cmp-template/src/assets/img/custom-widget.svg +0 -1
  162. package/src/template/react-custom-cmp-template/src/assets/img/favicon.png +0 -0
  163. package/src/template/react-custom-cmp-template/src/components/infoCard/index.jsx +0 -45
  164. package/src/template/react-custom-cmp-template/src/components/infoCard/model.js +0 -81
  165. package/src/template/react-custom-cmp-template/src/components/infoCard/style.scss +0 -67
  166. package/src/template/react-ts-custom-cmp-template/.prettierrc.js +0 -12
  167. package/src/template/react-ts-custom-cmp-template/README.md +0 -154
  168. package/src/template/react-ts-custom-cmp-template/commitlint.config.js +0 -59
  169. package/src/template/react-ts-custom-cmp-template/neo.config.js +0 -138
  170. package/src/template/react-ts-custom-cmp-template/package.json +0 -59
  171. package/src/template/react-ts-custom-cmp-template/public/css/base.css +0 -283
  172. package/src/template/react-ts-custom-cmp-template/public/scripts/app/bluebird.js +0 -6679
  173. package/src/template/react-ts-custom-cmp-template/public/template.html +0 -13
  174. package/src/template/react-ts-custom-cmp-template/src/assets/css/common.scss +0 -127
  175. package/src/template/react-ts-custom-cmp-template/src/assets/css/mixin.scss +0 -47
  176. package/src/template/react-ts-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  177. package/src/template/react-ts-custom-cmp-template/src/assets/img/custom-widget.svg +0 -1
  178. package/src/template/react-ts-custom-cmp-template/src/assets/img/favicon.png +0 -0
  179. package/src/template/react-ts-custom-cmp-template/src/assets/img/map.svg +0 -1
  180. package/src/template/react-ts-custom-cmp-template/src/components/listWidget/README.md +0 -2
  181. package/src/template/react-ts-custom-cmp-template/src/components/listWidget/index.tsx +0 -208
  182. package/src/template/react-ts-custom-cmp-template/src/components/listWidget/model.ts +0 -92
  183. package/src/template/react-ts-custom-cmp-template/src/components/listWidget/style.scss +0 -350
  184. package/src/template/react-ts-custom-cmp-template/tsconfig.json +0 -68
  185. package/src/template/vue2-custom-cmp-template/.prettierrc.js +0 -12
  186. package/src/template/vue2-custom-cmp-template/README.md +0 -154
  187. package/src/template/vue2-custom-cmp-template/commitlint.config.js +0 -59
  188. package/src/template/vue2-custom-cmp-template/neo.config.js +0 -146
  189. package/src/template/vue2-custom-cmp-template/package.json +0 -59
  190. package/src/template/vue2-custom-cmp-template/public/css/base.css +0 -283
  191. package/src/template/vue2-custom-cmp-template/public/scripts/app/bluebird.js +0 -6679
  192. package/src/template/vue2-custom-cmp-template/public/template.html +0 -13
  193. package/src/template/vue2-custom-cmp-template/src/assets/css/common.scss +0 -126
  194. package/src/template/vue2-custom-cmp-template/src/assets/css/mixin.scss +0 -47
  195. package/src/template/vue2-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  196. package/src/template/vue2-custom-cmp-template/src/assets/img/custom-widget.svg +0 -1
  197. package/src/template/vue2-custom-cmp-template/src/assets/img/favicon.png +0 -0
  198. package/src/template/vue2-custom-cmp-template/src/components/vueInfoCard/index.vue +0 -131
  199. package/src/template/vue2-custom-cmp-template/src/components/vueInfoCard/model.js +0 -81
  200. package/src/utils/getConfigObj.js +0 -18
@@ -1,49 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "experimentalDecorators": true,
4
- "target": "esnext",
5
- "module": "esnext",
6
- "allowJs": false,
7
- "jsx": "react",
8
- "declaration": false,
9
- "noEmit": false,
10
- "importHelpers": true,
11
- "isolatedModules": false,
12
- "strict": false,
13
- "noImplicitAny": true,
14
- "strictNullChecks": true,
15
- "noImplicitThis": true,
16
- "noUnusedLocals": false,
17
- "noImplicitReturns": true,
18
- "moduleResolution": "node",
19
- "baseUrl": "./",
20
- "paths": {
21
- "@": [
22
- "./src"
23
- ],
24
- "@assets/*": [
25
- "src/assets/*"
26
- ],
27
- "@components/*": [
28
- "src/components/*"
29
- ],
30
- "$utils/*": [
31
- "src/utils/*"
32
- ]
33
- },
34
- "typeRoots": [
35
- "./@types",
36
- "./node_modules/@types"
37
- ],
38
- "allowSyntheticDefaultImports": true,
39
- "esModuleInterop": true,
40
- "forceConsistentCasingInFileNames": true
41
- },
42
- "include": [
43
- "src",
44
- "test"
45
- ],
46
- "exclude": [
47
- "node_modules"
48
- ]
49
- }
@@ -1,12 +0,0 @@
1
- /*
2
- prettier 配置文件
3
- 更多配置信息:https://prettier.io/docs/en/options.html
4
- */
5
- module.exports = {
6
- semi: true, // Semicolons 分号,默认需要分号
7
- tabWidth: 2, // 空格,默认 2,
8
- useTabs: false,
9
- singleQuote: true, // 单引号还是双引号,默认为 false 双引号
10
- trailingComma: 'all', // 逗号
11
- jsxBracketSameLine: false, // 默认为false,Put the > of a multi-line JSX element at the end of the last line instead of being alone on the next line (does not apply to self closing elements).
12
- };
@@ -1,154 +0,0 @@
1
- ### 目录说明
2
- - src: 自定义组件源码;
3
- - src/assets: 存放组件静态资源,比如 css、img等;
4
- - src/components: 存放自定义组件代码,每个自定义组件以自身名称(cmpType 数值)作为目录进行存放;
5
- - src/components/xxCmp/index: 自定义组件的内容文件;
6
- - src/components/xxCmp/model: 自定义组件的模型文件,用于对接页面设计器;
7
- - neo.config.js: neo-cmp-cli 配置文件。
8
-
9
- ### 组件开发规范
10
- - 存放在 src/components 目录下的自定义组件,默认 index 为自定义组件源码入口文件,register.[tj]s 为注册 自定义组件的脚本文件,model.[tj]s 为自定义组件的模型文件(对接页面设计器需要);
11
- - 当 neo.config.js 中的 entry 为空或者不存在时,cli 将根据 src/components 目录下的自定义组件结构生成对应的 entry 配置(可在命令控制台查看生成的 entry 配置);
12
- - 自定义组件中可用的配置项类型 请见 [当前可用表单项](https://github.com/wibetter/neo-register/blob/master/docs/FormItemType.md);
13
- - 自定义组件最外层请设置一个唯一的 ClassName(比如 xx-cmpType-container),所有内容样式请放在该 ClassName 中,避免自定义组件样式相互干扰;
14
- - 默认开启代码规范检测(含样式内容),如需关闭,请调整 neo.config.js 相关配置;
15
- - 请使用 react 16版本。
16
-
17
- ### 自定义组件注册器使用说明
18
- - [neo-register 使用说明](https://www.npmjs.com/package/neo-register?activeTab=readme)
19
- 备注:预览、调试(linkDebug)和构建发布时 cli 会自动创建对应的注册文件(含 neo-register 的使用),用户无需关注 neo-register。
20
-
21
- ### 开发说明
22
-
23
- 1. **安装依赖**
24
- ```bash
25
- $ npm i 或者 yarn
26
- ```
27
-
28
- 2. **preview: 组件预览模式(带热更新)**
29
- > preview模式:用于预览自定义组件内容。
30
- ```bash
31
- $ npm run preview
32
- ```
33
-
34
- 3. **linkDebug: 外链调试(在线上页面设计器端预览自定义组件)**
35
- > linkDebug模式:用于在线上页面设计器中预览和调试自定义组件。
36
- ```bash
37
- $ npm run linkDebug
38
- ```
39
-
40
- 4. **发布到 NeoCRM 平台**
41
- > 需要确保 package.json 中的 name 值唯一,version 值不重复。
42
- ```bash
43
- $ npm run pushCmp
44
- ```
45
-
46
-
47
- ### 🔐 授权配置
48
-
49
- 使用 `neo push cmp`、`neo pull cmp`、`neo delete cmp` 等命令与 NeoCRM 平台交互时,需要配置授权信息。
50
-
51
- #### 方式一:OAuth2 登录授权(推荐)
52
-
53
- OAuth2 授权码模式更加安全可靠,无需用户配置账户名和密码。
54
-
55
- ##### 使用步骤
56
-
57
- 1. **登录 NeoCRM 平台**
58
- ```bash
59
- neo login
60
- ```
61
-
62
- 执行流程:
63
- - 自动打开浏览器访问授权页面
64
- - 在浏览器中输入 NeoCRM 账号密码进行登录(需选择对应的租户)
65
- - 授权成功后自动跳转回本地(附带 code)
66
- - cli 端 通过 code 获取 Token,并自动保存到项目的 `.neo-cli/token.json` 文件中
67
-
68
- 2. **登出 NeoCRM 平台**
69
- ```bash
70
- neo logout
71
- ```
72
-
73
- 功能:清除本地保存的 token 文件,下次使用需要重新登录。
74
-
75
- ##### 配置示例
76
-
77
- ```javascript
78
- // neo.config.js
79
- module.exports = {
80
- neoConfig: {
81
- neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
82
- // 登录授权 URL(用于获取 code)
83
- loginURL: 'https://login-cd.xiaoshouyi.com/auc/oauth2/auth',
84
- tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址
85
- },
86
- }
87
- ```
88
-
89
- ##### Token 有效期
90
-
91
- - **access_token**:默认有效期 2 小时
92
- - **refresh_token**:默认有效期 30 天
93
- - 系统会在 access_token 过期前 5 分钟自动刷新
94
- - 如果 refresh_token 也过期,需要重新执行 `neo login`
95
-
96
- ##### 常见问题
97
-
98
- **Q1: 浏览器无法自动打开怎么办?**
99
- A: 命令行会输出授权 URL,手动复制到浏览器中打开即可。
100
-
101
- **Q2: Token 刷新失败怎么办?**
102
- A: 如果 refresh_token 也过期(默认 30 天),需要重新执行 `neo login`。同时检查网络连接是否正常。
103
-
104
- **Q3: 授权登录后没有正常跳回 redirect_uri**
105
- A: 可能被浏览器安装的插件影响,目前已知会影响授权登录的浏览器插件有:Neo UI Extension,请关闭插件后重试。
106
-
107
- #### 方式二:密码授权配置
108
-
109
- 在项目根目录的 `neo.config.js` 文件中添加 NeoCRM 平台授权配置:
110
-
111
- ```javascript
112
- module.exports = {
113
- neoConfig: {
114
- neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
115
- tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址
116
- // NeoCRM 授权配置
117
- auth: {
118
- client_id: 'xx', // 客户端 ID,从创建连接器的客户端信息中获取(Client_Id)
119
- client_secret: 'xxx', // 客户端秘钥,从创建连接器的客户端信息中获取(Client_Secret)
120
- username: 'xx', // 用户在销售易系统中的用户名
121
- /**
122
- * password 为 用户在销售易系统中的账号密码加上 8 位安全令牌。
123
- * 例如,用户密码为 123456,安全令牌为 ABCDEFGH,则 password 的值应为 123456ABCDEFGH。
124
- */
125
- password: 'xx xx' // 用户账户密码 + 8 位安全令牌
126
- },
127
- },
128
- }
129
- ```
130
-
131
- ##### 授权配置获取方式
132
-
133
- 1. **客户端 ID 和客户端秘钥**:需通过创建连接器获取
134
- - 访问 [销售易文档中心](https://doc.xiaoshouyi.com) / 创建连接器
135
- - 创建连接器后,从客户端信息中获取 `Client_Id` 和 `Client_Secret`
136
-
137
- 2. **安全令牌**:如何获取安全令牌
138
- - 访问 [销售易文档中心](https://doc.xiaoshouyi.com) / OAuth安全认证 / 密码模式 / 获取令牌
139
- - 按照文档说明获取 8 位安全令牌
140
- - `password` 字段 = 用户账户密码 + 8 位安全令牌(直接拼接,无空格或分隔符)
141
-
142
- #### OAuth2 模式 vs 密码模式
143
-
144
- | 特性 | OAuth2 授权码模式 | 密码模式 |
145
- |------|------------------|---------|
146
- | 安全性 | ✅ 高(无需在配置文件中存储密码) | ⚠️ 较低(需要配置密码和安全令牌) |
147
- | Token 刷新 | ✅ 自动刷新 | ✅ 自动刷新 |
148
- | 有效期 | 2 小时(可自动刷新) | 永不过期 |
149
- | 推荐程度 | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ |
150
-
151
- ---
152
-
153
- ### 配置项说明(neo-cmp-cli)
154
- [请查看neo-cmp-cli](https://www.npmjs.com/package/neo-cmp-cli)
@@ -1,59 +0,0 @@
1
- /**
2
- * https://www.npmjs.com/package/@commitlint/config-conventional\
3
- *
4
- * Git提交规范-配置文件
5
- * Commit message 由Header、Body 和 Footer三个部分组成,其格式如下:
6
- * <type>(<scope>): <subject>
7
- * <BLANK LINE>
8
- * <body>
9
- * <BLANK LINE>
10
- * <footer>
11
- *
12
- *【备注】
13
- * type 用于说明 commit 的类别,常用下面 7 个标识:
14
- * scope 用于说明当前功能点作用于哪个页面或者哪个功能模块;
15
- * subject 用于简短的描述当前commit,不超过50个字符;
16
- * body 用于填写对本次 commit 的详细描述,可以分成多行;
17
- * footer 不兼容变动声明,或者关闭 Issue。
18
- *
19
- * 【type类型取值类型】
20
- * feat:新功能(feature)
21
- * fix:功能优化
22
- * bug:修补bug
23
- * docs:文档(documentation)
24
- * style:格式(不影响代码运行的变动)
25
- * refactor:重构(即不是新增功能,也不是修改bug的代码变动)
26
- * test:增加测试
27
- * chore:构建过程或辅助工具的变动
28
- * build:影响构建系统或外部依赖项的更改(示例范围:gulp,broccoli,npm)
29
- * ci:对 CI 配置文件和脚本的更改(示例范围:Travis,Circle,BrowserStack,SauceLabs)
30
- * perf:改进性能的代码更改
31
- *
32
- */
33
-
34
- module.exports = {
35
- extends: ['@commitlint/config-conventional'],
36
- rules: {
37
- 'type-enum': [
38
- 2,
39
- 'always',
40
- [
41
- 'feat',
42
- 'fix',
43
- 'bug',
44
- 'docs',
45
- 'style',
46
- 'refactor',
47
- 'test',
48
- 'chore',
49
- 'perf',
50
- 'build',
51
- 'ci',
52
- ],
53
- ],
54
- 'type-empty': [2, 'never'],
55
- 'scope-empty': [1, 'never'],
56
- 'subject-full-stop': [0, 'never'],
57
- 'subject-case': [0, 'never'],
58
- },
59
- };
@@ -1,137 +0,0 @@
1
- 'use strict';
2
- const path = require('path');
3
-
4
- // 统一路径解析
5
- function resolve(dir) {
6
- return path.resolve(__dirname, dir);
7
- }
8
-
9
- // 包括生产和开发的环境配置信息
10
- module.exports = {
11
- settings: {
12
- enableESLint: false, // 调试模式是否开启ESLint,默认开启ESLint检测代码格式
13
- enableESLintFix: false, // 是否自动修正代码格式,默认不自动修正
14
- enableStyleLint: false, // 是否开启StyleLint,默认开启ESLint检测代码格式
15
- enableStyleLintFix: false, // 是否需要StyleLint自动修正代码格式
16
- },
17
- webpack: {
18
- resolve: {
19
- // webpack的resolve配置
20
- extensions: ['.js', '.jsx', '.ts', '.tsx', '.umd.js', '.min.js', '.json'], // 用于配置webpack在尝试过程中用到的后缀列表
21
- alias: {
22
- '@': resolve('src'),
23
- $assets: resolve('src/assets'),
24
- $public: resolve('public'),
25
- },
26
- // conditionNames: ['require']
27
- },
28
- // sassResources中的sass文件会自动注入每一个sass文件中
29
- sassResources: [
30
- resolve('./src/assets/css/common.scss'),
31
- resolve('./src/assets/css/mixin.scss'),
32
- ],
33
- // createDeclaration: true, // 打包时是否创建ts声明文件
34
- ignoreNodeModules: false, // 打包时是否忽略 node_modules
35
- // allowList: [], // ignoreNodeModules 为 true 时生效
36
- // projectDir: ['src'],
37
- // template: resolve('./public/template.html'), // 自定义html模板
38
- // plugins: [], // 用于添加自定义 plugins
39
- // cssLoaderUrlDir: 'antd',
40
- cssLoaderOption: {
41
- // modules: true
42
- },
43
- moduleRules: [],
44
- },
45
- // 用于添加 Neo 共享依赖模块的配置信息
46
- /*
47
- neoCommonModule: {
48
- // exports: ['xxModule'], // 数组写法,用于导出当前自定义组件中的第三方依赖模块
49
- exports: { // 对象写法,可用于导出自定义组件中的某个内容模块(需要使用绝对路径导出)
50
- 'xxModule': path.resolve('./src/components/xxModule'), // 导出 xx组件 或 xx模块
51
- },
52
- // remoteDeps: ['xxCmpType'], // 远程依赖组件,表示当前自定义组件会用到的依赖组件,需要和 externals 配合使用
53
- // externals: ['xxModule'], // 自定义组件中需要剔除的模块,仅支持数组写法
54
- },
55
- */
56
- preview: {
57
- // 用于开启本地预览模式的相关配置信息
58
- /*
59
- 【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
60
- NODE_ENV: 'development',
61
- port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
62
- assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
63
- assetsSubDirectory: '',
64
- hostname: 'localhost',
65
- proxyTable: {
66
- '/apiTest': {
67
- target: 'http://api-test.com.cn', // 不支持跨域的接口根地址
68
- ws: true,
69
- changeOrigin: true,
70
- },
71
- }
72
- */
73
- },
74
- linkDebug: {
75
- // 用于开启本地调试模式的相关配置信息
76
- /*
77
- 【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
78
- entry: { // entry 会根据 src/components 目录下的文件自动生成
79
- // 外链调试(在线上页面设计器端预览自定义组件)
80
- index: [
81
- './src/components/xxCmp/register.js',
82
- './src/components/xxCmp/model.js',
83
- ],
84
- },
85
- NODE_ENV: 'development',
86
- port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
87
- assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
88
- assetsSubDirectory: '',
89
- hostname: 'localhost',
90
- proxyTable: {
91
- '/apiTest': {
92
- target: 'http://api-test.com.cn', // 不支持跨域的接口根地址
93
- ws: true,
94
- changeOrigin: true,
95
- },
96
- }
97
- */
98
- },
99
- // 授权码授权模式下的 NeoCRM 平台配置
100
- neoConfig: {
101
- authType: 'oauth2', // 授权类型,可选值:oauth2(默认)、password
102
- neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
103
- // 当 authType 为 oauth2 时,loginURL 配置项必填
104
- loginURL: 'https://login-cd.xiaoshouyi.com/auc/oauth2/auth', // 登录授权 URL(默认:https://login.xiaoshouyi.com/auc/oauth2/auth)
105
- tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
106
- },
107
- /*
108
- // 密码授权模式下的 NeoCRM 平台配置
109
- neoConfig: {
110
- authType: 'password', // 授权类型,可选值:oauth2(默认)、password
111
- neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
112
- tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
113
- // 当 authType 为 password 时,auth 配置项必填
114
- auth: {
115
- client_id: auth.client_id || 'xx', // 客户端 ID,从创建连接器的客户端信息中获取(Client_Id)
116
- client_secret: auth.client_secret || 'xxx', // 客户端秘钥,从创建连接器的客户端信息中获取(Client_Secret)
117
- username: auth.username || 'xx', // 用户在销售易系统中的用户名
118
- // password 为 用户在销售易系统中的账号密码加上 8 位安全令牌。
119
- // 例如,用户密码为 123456,安全令牌为 ABCDEFGH,则 password 的值应为 123456ABCDEFGH。
120
- password: auth.password || 'xx xx', // 用户账户密码 + 8 位安全令牌
121
- },
122
- },
123
- */
124
- pushCmp: {
125
- // 用于构建并发布至 NeoCRM 的相关配置
126
- /*
127
- 【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
128
- NODE_ENV: 'production',
129
- entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
130
- InfoCardModel: './src/components/xxCmp/model.ts',
131
- infoCard: './src/components/xxCmp/register.ts'
132
- },
133
- cssExtract: false, // 不额外提取css文件
134
- assetsRoot: resolve('dist') // 上传指定目录下的脚本文件
135
- */
136
- },
137
- };
@@ -1,57 +0,0 @@
1
- {
2
- "name": "react-custom-cmp-template",
3
- "version": "1.1.0",
4
- "description": "neo自定义组件模板(react技术栈)",
5
- "framework": "react-js",
6
- "keywords": [
7
- "自定义组件模板",
8
- "react技术栈",
9
- "neo自定义组件"
10
- ],
11
- "author": "wibetter",
12
- "license": "MIT",
13
- "scripts": {
14
- "preview": "neo preview",
15
- "linkDebug": "neo linkDebug",
16
- "pushCmp": "neo push cmp",
17
- "format": "prettier --write \"src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}\""
18
- },
19
- "files": [
20
- "dist/*"
21
- ],
22
- "husky": {
23
- "hooks": {
24
- "pre-commit": "lint-staged",
25
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
26
- }
27
- },
28
- "lint-staged": {
29
- "src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}": [
30
- "prettier --write"
31
- ]
32
- },
33
- "repository": {
34
- "type": "git",
35
- "url": "https://git@github.com:wibetter/react-custom-cmp-template.git"
36
- },
37
- "bugs": {
38
- "url": "https://github.com/wibetter/react-custom-cmp-template/issues"
39
- },
40
- "dependencies": {
41
- "neo-register": "^1.0.7",
42
- "react": "^16.9.0",
43
- "react-dom": "^16.9.0"
44
- },
45
- "devDependencies": {
46
- "@commitlint/cli": "^8.3.5",
47
- "@commitlint/config-conventional": "^9.1.1",
48
- "neo-cmp-cli": "^1.8.0",
49
- "husky": "^4.2.5",
50
- "lint-staged": "^10.2.9",
51
- "prettier": "^2.0.5"
52
- },
53
- "engines": {
54
- "node": ">= 10.13.0",
55
- "npm": ">= 6.4.1"
56
- }
57
- }