neo-cmp-cli 1.1.7 → 1.1.9

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 (65) hide show
  1. package/package.json +1 -1
  2. package/src/cmpUtils/createCommonModulesCode.js +61 -0
  3. package/src/cmpUtils/getCmpPreview.js +3 -1
  4. package/src/module/index.js +15 -0
  5. package/src/module/main.js +35 -12
  6. package/src/module/neoInitByCopy.js +12 -0
  7. package/src/neo/neoRequire.js +14 -2
  8. package/src/template/antd-custom-cmp-template/.prettierrc.js +12 -0
  9. package/src/template/antd-custom-cmp-template/README.md +47 -0
  10. package/src/template/antd-custom-cmp-template/commitlint.config.js +59 -0
  11. package/src/template/antd-custom-cmp-template/neo.config.js +115 -0
  12. package/src/template/antd-custom-cmp-template/package.json +59 -0
  13. package/src/template/antd-custom-cmp-template/public/css/base.css +283 -0
  14. package/src/template/antd-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  15. package/src/template/antd-custom-cmp-template/public/template.html +13 -0
  16. package/src/template/antd-custom-cmp-template/src/assets/css/common.scss +127 -0
  17. package/src/template/antd-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  18. package/src/template/antd-custom-cmp-template/src/components/data-dashboard/README.md +39 -0
  19. package/src/template/antd-custom-cmp-template/src/components/data-dashboard/index.tsx +462 -0
  20. package/src/template/antd-custom-cmp-template/src/components/data-dashboard/model.ts +76 -0
  21. package/src/template/antd-custom-cmp-template/src/components/data-dashboard/style.scss +1667 -0
  22. package/src/template/antd-custom-cmp-template/src/components/info-card/index.tsx +72 -0
  23. package/src/template/antd-custom-cmp-template/src/components/info-card/model.ts +78 -0
  24. package/src/template/antd-custom-cmp-template/src/components/info-card/style.scss +105 -0
  25. package/src/template/antd-custom-cmp-template/tsconfig.json +68 -0
  26. package/src/template/echarts-custom-cmp-template/.prettierrc.js +12 -0
  27. package/src/template/echarts-custom-cmp-template/README.md +91 -0
  28. package/src/template/echarts-custom-cmp-template/commitlint.config.js +59 -0
  29. package/src/template/echarts-custom-cmp-template/neo.config.js +117 -0
  30. package/src/template/echarts-custom-cmp-template/package.json +60 -0
  31. package/src/template/echarts-custom-cmp-template/public/css/base.css +283 -0
  32. package/src/template/echarts-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  33. package/src/template/echarts-custom-cmp-template/public/template.html +13 -0
  34. package/src/template/echarts-custom-cmp-template/src/assets/css/common.scss +127 -0
  35. package/src/template/echarts-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  36. package/src/template/echarts-custom-cmp-template/src/components/chart-widget/README.md +186 -0
  37. package/src/template/echarts-custom-cmp-template/src/components/chart-widget/index.tsx +724 -0
  38. package/src/template/echarts-custom-cmp-template/src/components/chart-widget/model.ts +153 -0
  39. package/src/template/echarts-custom-cmp-template/src/components/chart-widget/style.scss +209 -0
  40. package/src/template/echarts-custom-cmp-template/src/components/info-card/index.tsx +69 -0
  41. package/src/template/echarts-custom-cmp-template/src/components/info-card/model.ts +78 -0
  42. package/src/template/echarts-custom-cmp-template/src/components/info-card/style.scss +105 -0
  43. package/src/template/echarts-custom-cmp-template/tsconfig.json +68 -0
  44. package/src/template/neo-custom-cmp-template/.prettierrc.js +12 -0
  45. package/src/template/neo-custom-cmp-template/README.md +47 -0
  46. package/src/template/neo-custom-cmp-template/commitlint.config.js +59 -0
  47. package/src/template/neo-custom-cmp-template/neo.config.js +109 -0
  48. package/src/template/neo-custom-cmp-template/package.json +60 -0
  49. package/src/template/neo-custom-cmp-template/public/css/base.css +283 -0
  50. package/src/template/neo-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  51. package/src/template/neo-custom-cmp-template/public/template.html +13 -0
  52. package/src/template/neo-custom-cmp-template/src/assets/css/common.scss +127 -0
  53. package/src/template/neo-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  54. package/src/template/neo-custom-cmp-template/src/components/info-card/index.tsx +69 -0
  55. package/src/template/neo-custom-cmp-template/src/components/info-card/model.ts +78 -0
  56. package/src/template/neo-custom-cmp-template/src/components/info-card/style.scss +105 -0
  57. package/src/template/neo-custom-cmp-template/src/components/neo-entity-grid/README.md +128 -0
  58. package/src/template/neo-custom-cmp-template/src/components/neo-entity-grid/index.tsx +295 -0
  59. package/src/template/neo-custom-cmp-template/src/components/neo-entity-grid/model.ts +94 -0
  60. package/src/template/neo-custom-cmp-template/src/components/neo-entity-grid/style.scss +127 -0
  61. package/src/template/neo-custom-cmp-template/tsconfig.json +68 -0
  62. package/src/template/react-custom-cmp-template/package.json +1 -1
  63. package/src/template/react-ts-custom-cmp-template/package.json +1 -2
  64. package/src/template/react-ts-custom-cmp-template/src/components/info-card/index.tsx +1 -4
  65. package/src/template/vue2-custom-cmp-template/package.json +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo-cmp-cli",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "前端脚手架:自定义组件开发工具,支持react 和 vue2.0技术栈。",
5
5
  "keywords": [
6
6
  "neo-cli",
@@ -0,0 +1,61 @@
1
+ const fs = require('fs');
2
+ const { resolveToCurrentRoot } = require('../utils/pathUtils');
3
+ const { isPlainObject } = require('lodash');
4
+
5
+ /**
6
+ * 获取组件预览代码
7
+ * @param {*} cmpsDir 自定义组件目录
8
+ * @param {*} cmpName 自定义组件名称
9
+ * @returns 组件预览代码
10
+ */
11
+ const createCommonModulesCode = (neoExports) => {
12
+ if (!neoExports) {
13
+ return '';
14
+ }
15
+ const CustomCmpCommonModules = {};
16
+
17
+ // 根据 neoExports 获取共享的依赖模块
18
+ if (Array.isArray(neoExports) && neoExports.length > 0) {
19
+ neoExports.forEach(module => {
20
+ CustomCmpCommonModules[module] = require(module);
21
+ });
22
+ } else if (isPlainObject(neoExports)) {
23
+ CustomCmpCommonModules = Object.assign(CustomCmpCommonModules, neoExports);
24
+ } else {
25
+ console.error('neoExports 格式不正确,请检查 neo.config.js 文件中的 neoCommonModule / neoExports 配置');
26
+ process.exit(1);
27
+ return '';
28
+ }
29
+
30
+ const commonModulesCode = `
31
+ /**
32
+ * 自定义组件 共享出来的依赖模块
33
+ * 备注:可在其他模块中通过 neoRequire 中使用
34
+ */
35
+ const CustomCmpCommonModules = ${JSON.stringify(CustomCmpCommonModules)};
36
+
37
+ // 用于添加共享的依赖模块
38
+ const addNeoCommonModules = (modules) => {
39
+ if (!window.__NeoCommonModules) {
40
+ window.__NeoCommonModules = {};
41
+ }
42
+ window.__NeoCommonModules = Object.assign(window.__NeoCommonModules, modules);
43
+ };
44
+
45
+ addNeoCommonModules(CustomCmpCommonModules);
46
+ `;
47
+
48
+ // 创建存放 cli 的临时目录
49
+ const cliTempDir = resolveToCurrentRoot('./.neo-cli');
50
+ if (!fs.existsSync(cliTempDir)) {
51
+ fs.mkdirSync(cliTempDir);
52
+ }
53
+
54
+ // 将 commonModulesCode 写入到临时目录中
55
+ const commonModulesFilePath = `${cliTempDir}/commonModules.js`;
56
+ fs.writeFileSync(commonModulesFilePath, commonModulesCode);
57
+
58
+ return commonModulesFilePath;
59
+ };
60
+
61
+ module.exports = createCommonModulesCode;
@@ -35,13 +35,15 @@ import CustomCmpModel from '${cpmModelDir}';
35
35
 
36
36
  // 获取组件模型中的默认属性
37
37
  const curDefaultComProps = new CustomCmpModel().defaultComProps;
38
+ const previewComProps = new CustomCmpModel().previewComProps;
39
+ const curPreviewComProps = Object.assign(curDefaultComProps, previewComProps);
38
40
 
39
41
  /* 引入公共的静态资源 */
40
42
  import '$public/css/base.css';
41
43
 
42
44
  // 预览 自定义组件
43
45
  ReactDOM.render(
44
- <CustomCmp {...curDefaultComProps} />,
46
+ <CustomCmp {...curPreviewComProps} />,
45
47
  document.getElementById('root'),
46
48
  );
47
49
  `;
@@ -66,6 +66,21 @@ yargs
66
66
  value: 'react-ts',
67
67
  short: 'react-ts'
68
68
  },
69
+ {
70
+ name: 'antd 自定义组件',
71
+ value: 'antd',
72
+ short: 'antd'
73
+ },
74
+ {
75
+ name: 'echarts 自定义组件',
76
+ value: 'echarts',
77
+ short: 'echarts'
78
+ },
79
+ {
80
+ name: 'Neo 自定义组件',
81
+ value: 'neo',
82
+ short: 'neo'
83
+ },
69
84
  {
70
85
  name: 'react 自定义组件',
71
86
  value: 'react',
@@ -14,11 +14,18 @@ const previewCmp = require('./previewCmp');
14
14
  const AddNeoRequirePlugin = require('../plugins/AddNeoRequirePlugin');
15
15
  const { getExternalsByNeoCommonModules } = require('../neo/neoRequire');
16
16
  // const { MFPlugins } = require('../utils/webpack.mf');
17
+ const createCommonModulesCode = require('../cmpUtils/createCommonModulesCode');
17
18
 
18
19
  const getValue = (originValue, defaultValue) => {
19
20
  return originValue !== undefined ? originValue : defaultValue;
20
21
  };
21
22
 
23
+ const neoCommonModule = curConfig.neoCommonModule || {};
24
+ // 自定义组件 共享出来的依赖模块
25
+ const cmpNeoExports = neoCommonModule.neoExports || [];
26
+ // 自定义组件 需要剔除的依赖模块
27
+ const cmpNeoExternals = neoCommonModule.neoExternals || [];
28
+
22
29
  module.exports = {
23
30
  neoInit,
24
31
  neoInitByCopy,
@@ -111,16 +118,24 @@ module.exports = {
111
118
  }
112
119
 
113
120
  // 添加 内置 Neo 的 externals 配置
114
- const neoExternals = getExternalsByNeoCommonModules();
115
- if (
116
- curConfig.dev.externals &&
117
- _.isPlainObject(curConfig.dev.externals)
118
- ) {
121
+ const neoExternals = getExternalsByNeoCommonModules(cmpNeoExternals);
122
+ if (curConfig.dev.externals && _.isPlainObject(curConfig.dev.externals)) {
119
123
  curConfig.dev.externals = Object.assign(curConfig.dev.externals, neoExternals);
120
124
  } else {
121
125
  curConfig.dev.externals = neoExternals;
122
126
  }
123
127
 
128
+ if (cmpNeoExports && Array.isArray(cmpNeoExports) && cmpNeoExports.length > 0) {
129
+ const commonModulesFilePath = createCommonModulesCode(cmpNeoExports);
130
+
131
+ // 所有入口文件添加 commonModulesFile
132
+ if (curConfig.dev.entry) {
133
+ Object.keys(curConfig.dev.entry).forEach((name) => {
134
+ webpackDevConfig.entry[name] = [commonModulesFilePath].concat(webpackDevConfig.entry[name]);
135
+ });
136
+ }
137
+ }
138
+
124
139
  akfun.dev(curConfig, consoleTag);
125
140
  },
126
141
  build: () => akfun.build('build', curConfig, consoleTag), // 构建脚本:生产环境
@@ -214,14 +229,22 @@ module.exports = {
214
229
  }
215
230
 
216
231
  // 添加 内置 Neo 的 externals 配置
217
- const neoExternals = getExternalsByNeoCommonModules();
218
- if (
219
- curConfig.dev.externals &&
220
- _.isPlainObject(curConfig.dev.externals)
221
- ) {
222
- curConfig.dev.externals = Object.assign(curConfig.dev.externals, neoExternals);
232
+ const neoExternals = getExternalsByNeoCommonModules(cmpNeoExternals);
233
+ if (curConfig.build2lib.externals && _.isPlainObject(curConfig.dev.externals)) {
234
+ curConfig.build2lib.externals = Object.assign(curConfig.build2lib.externals, neoExternals);
223
235
  } else {
224
- curConfig.dev.externals = neoExternals;
236
+ curConfig.build2lib.externals = neoExternals;
237
+ }
238
+
239
+ if (cmpNeoExports && Array.isArray(cmpNeoExports) && cmpNeoExports.length > 0) {
240
+ const commonModulesFilePath = createCommonModulesCode(cmpNeoExports);
241
+
242
+ // 所有入口文件添加 commonModulesFile
243
+ if (curConfig.dev.entry) {
244
+ Object.keys(curConfig.dev.entry).forEach((name) => {
245
+ webpackDevConfig.entry[name] = [commonModulesFilePath].concat(webpackDevConfig.entry[name]);
246
+ });
247
+ }
225
248
  }
226
249
 
227
250
  akfun.build('lib', curConfig, consoleTag, () => {
@@ -12,6 +12,18 @@ const templateList = {
12
12
  projectName: 'react-ts-custom-cmp-template',
13
13
  dir: path.resolve(__dirname, '../template/react-ts-custom-cmp-template')
14
14
  },
15
+ 'antd': {
16
+ projectName: 'antd-custom-cmp-template',
17
+ dir: path.resolve(__dirname, '../template/antd-custom-cmp-template')
18
+ },
19
+ echarts: {
20
+ projectName: 'echarts-custom-cmp-template',
21
+ dir: path.resolve(__dirname, '../template/echarts-custom-cmp-template')
22
+ },
23
+ 'neo': {
24
+ projectName: 'neo-custom-cmp-template',
25
+ dir: path.resolve(__dirname, '../template/neo-custom-cmp-template')
26
+ },
15
27
  vue2: {
16
28
  projectName: 'vue2-custom-cmp-template',
17
29
  dir: path.resolve(__dirname, '../template/vue2-custom-cmp-template')
@@ -1,3 +1,5 @@
1
+ const _ = require('lodash');
2
+
1
3
  // Neo 共享出来的依赖模块
2
4
  const NeoCommonModules = {
3
5
  react: '^16.13.1',
@@ -13,15 +15,25 @@ const NeoCommonModules = {
13
15
  axios: '^0.27.2',
14
16
  classnames: '^2.3.2',
15
17
  qs: '^6.11.0',
16
- lodash: '^4.17.21'
18
+ lodash: '^4.17.21',
19
+ 'neo-ui-component-web': '^1.0.0',
20
+ 'neo-ui-common': '^1.0.0'
17
21
  };
18
22
 
19
23
  // 根据 Neo 共享出来的依赖模块,获取 externals 配置
20
- const getExternalsByNeoCommonModules = () => {
24
+ const getExternalsByNeoCommonModules = (cmpNeoExternals) => {
21
25
  const neoExternals = {};
22
26
  Object.keys(NeoCommonModules).forEach(moduleName => {
23
27
  neoExternals[moduleName] = `commonjs ${moduleName}`;
24
28
  });
29
+
30
+ // 如果自定义组件有共享的依赖模块,则合并到 neoExternals 中
31
+ if (cmpNeoExternals && _.isPlainObject(cmpNeoExternals) && Object.keys(cmpNeoExternals).length > 0) {
32
+ Object.keys(cmpNeoExternals).forEach(moduleName => {
33
+ neoExternals[moduleName] = `commonjs ${moduleName}`;
34
+ });
35
+ }
36
+
25
37
  return neoExternals;
26
38
  };
27
39
 
@@ -0,0 +1,12 @@
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
+ };
@@ -0,0 +1,47 @@
1
+ ### 目录说明
2
+ - src: 自定义组件源码;
3
+ - src/assets: 存放组件静态资源,比如 css、img等;
4
+ - src/components: 存放自定义组件代码,每个自定义组件以自身名称(cmpType 数值)作为目录进行存放;
5
+ - src/components/info-card/index.tsx: 自定义组件的内容文件;
6
+ - src/components/info-card/model.ts: 自定义组件的模型文件,用于对接页面设计器;
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. **发布到对象存储服务中**
41
+ > 需要确保 package.json 中的 name 值唯一,version 值不重复。
42
+ ```bash
43
+ $ npm run publish2oss
44
+ ```
45
+
46
+ ### 配置项说明(neo-cmp-cli)
47
+ [请查看neo-cmp-cli](https://github.com/wibetter/neo-cmp-cli)
@@ -0,0 +1,59 @@
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
+ };
@@ -0,0 +1,115 @@
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: true, // 调试模式是否开启ESLint,默认开启ESLint检测代码格式
13
+ enableESLintFix: true, // 是否自动修正代码格式,默认不自动修正
14
+ enableStyleLint: false, // 是否开启StyleLint,默认开启ESLint检测代码格式
15
+ enableStyleLintFix: false, // 是否需要StyleLint自动修正代码格式
16
+ },
17
+ webpack: {
18
+ target: ['web', 'es5'], // 指定目标环境为 web 和 es5,确保兼容性
19
+ resolve: {
20
+ // webpack的resolve配置
21
+ extensions: ['.js', '.jsx', '.ts', '.tsx', '.umd.js', '.min.js', '.json'], // 用于配置webpack在尝试过程中用到的后缀列表
22
+ alias: {
23
+ '@': resolve('src'),
24
+ $assets: resolve('src/assets'),
25
+ $public: resolve('public'),
26
+ },
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: [],
39
+ // babelPlugins: [],
40
+ },
41
+ // Neo 共享依赖模块
42
+ neoCommonModule: {
43
+ // neoExports: ['echarts'], // 自定义组件 共享出来的模块,支持数组和对象
44
+ // neoExports: {},
45
+ neoExternals: ['neo-register'], // 自定义组件 需要剔除的模块,仅支持数组写法
46
+ },
47
+ preview: {
48
+ // 用于开启本地预览模式的相关配置信息
49
+ /*
50
+ 【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
51
+ entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
52
+ // 本地预览自定义组件内容
53
+ index: './src/preview.jsx',
54
+ },
55
+ NODE_ENV: 'development',
56
+ port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
57
+ assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
58
+ assetsSubDirectory: '',
59
+ hostname: 'localhost',
60
+ proxyTable: {
61
+ '/apiTest': {
62
+ target: 'http://api-test.com.cn', // 不支持跨域的接口根地址
63
+ ws: true,
64
+ changeOrigin: true,
65
+ },
66
+ },
67
+ */
68
+ },
69
+ linkDebug: {
70
+ // 用于开启本地调试模式的相关配置信息
71
+ /*
72
+ 【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
73
+ entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
74
+ // 外链调试(在线上页面设计器端预览自定义组件)
75
+ index: [
76
+ './src/components/info-card/register.ts',
77
+ './src/components/info-card/model.ts',
78
+ ],
79
+ },
80
+ NODE_ENV: 'development',
81
+ port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
82
+ closeHotReload: true, // 是否关闭热更新
83
+ assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
84
+ assetsSubDirectory: '',
85
+ hostname: 'localhost',
86
+ proxyTable: {
87
+ '/apiTest': {
88
+ target: 'http://api-test.com.cn', // 不支持跨域的接口根地址
89
+ ws: true,
90
+ changeOrigin: true,
91
+ },
92
+ }
93
+ */
94
+ },
95
+ publish2oss: {
96
+ // 用于构建并发布至 OSS 的相关配置
97
+ /*
98
+ 【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
99
+ NODE_ENV: 'production',
100
+ entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
101
+ InfoCardModel: './src/components/info-card/model.ts',
102
+ infoCard: './src/components/info-card/register.ts'
103
+ },
104
+ cssExtract: false, // 不额外提取css文件
105
+ ossType: 'ali', // oss类型:ali、baidu
106
+ ossConfig: {
107
+ endpoint: 'https://oss-cn-beijing.aliyuncs.com',
108
+ AccessKeyId: 'xxx',
109
+ AccessKeySecret: 'xx',
110
+ bucket: 'neo-widgets' // 存储桶名称
111
+ },
112
+ assetsRoot: resolve('dist') // 上传指定目录下的脚本文件
113
+ */
114
+ },
115
+ };
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "antd-custom-cmp-template",
3
+ "version": "1.0.2",
4
+ "description": "neo自定义组件模板(react&ts技术栈)",
5
+ "keywords": [
6
+ "自定义组件模板",
7
+ "react&ts技术栈",
8
+ "neo自定义组件"
9
+ ],
10
+ "author": "wibetter",
11
+ "license": "MIT",
12
+ "scripts": {
13
+ "preview": "neo preview --cmpType=data-dashboard",
14
+ "linkDebug": "neo linkDebug",
15
+ "publish2oss": "neo publish2oss",
16
+ "format": "prettier --write \"src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}\""
17
+ },
18
+ "files": [
19
+ "dist/*"
20
+ ],
21
+ "husky": {
22
+ "hooks": {
23
+ "pre-commit": "lint-staged",
24
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
25
+ }
26
+ },
27
+ "lint-staged": {
28
+ "src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}": [
29
+ "prettier --write"
30
+ ]
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://git@github.com:wibetter/antd-custom-cmp-template.git"
35
+ },
36
+ "bugs": {
37
+ "url": "https://github.com/wibetter/antd-custom-cmp-template/issues"
38
+ },
39
+ "dependencies": {
40
+ "neo-register": "^1.0.2",
41
+ "antd": "4.9.4",
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
+ "@types/react": "^16.9.11",
49
+ "@types/react-dom": "^16.9.15",
50
+ "neo-cmp-cli": "^1.1.8",
51
+ "husky": "^4.2.5",
52
+ "lint-staged": "^10.2.9",
53
+ "prettier": "^2.0.5"
54
+ },
55
+ "engines": {
56
+ "node": ">= 10.13.0",
57
+ "npm": ">= 6.4.1"
58
+ }
59
+ }