neo-cmp-cli 1.8.7 → 1.8.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 (125) hide show
  1. package/bin/index.js +2 -2
  2. package/dist/_virtual/_commonjsHelpers.js +12 -0
  3. package/dist/_virtual/array-set.js +7 -0
  4. package/dist/_virtual/base64-vlq.js +7 -0
  5. package/dist/_virtual/base64.js +7 -0
  6. package/dist/_virtual/binary-search.js +7 -0
  7. package/dist/_virtual/mapping-list.js +7 -0
  8. package/dist/_virtual/quick-sort.js +7 -0
  9. package/dist/_virtual/source-map-consumer.js +7 -0
  10. package/dist/_virtual/source-map-generator.js +7 -0
  11. package/dist/_virtual/source-map-support.js +7 -0
  12. package/dist/_virtual/source-map.js +7 -0
  13. package/dist/_virtual/source-node.js +7 -0
  14. package/dist/_virtual/typescript.js +7 -0
  15. package/dist/_virtual/util.js +7 -0
  16. package/dist/config/auth.config.js +43 -0
  17. package/dist/config/default.config.js +192 -0
  18. package/dist/config/index.js +26 -0
  19. package/dist/main.js +9 -0
  20. package/dist/main2.js +259 -0
  21. package/dist/module/inspect.js +63 -0
  22. package/dist/module/neoInit.js +75 -0
  23. package/dist/module/neoInitByCopy.js +83 -0
  24. package/dist/neo/neoLogin.js +590 -0
  25. package/dist/neo/neoRequire.js +123 -0
  26. package/dist/neo/neoService.js +898 -0
  27. package/dist/node_modules/buffer-from/index.js +86 -0
  28. package/dist/node_modules/source-map/lib/array-set.js +138 -0
  29. package/dist/node_modules/source-map/lib/base64-vlq.js +157 -0
  30. package/dist/node_modules/source-map/lib/base64.js +83 -0
  31. package/dist/node_modules/source-map/lib/binary-search.js +129 -0
  32. package/dist/node_modules/source-map/lib/mapping-list.js +96 -0
  33. package/dist/node_modules/source-map/lib/quick-sort.js +130 -0
  34. package/dist/node_modules/source-map/lib/source-map-consumer.js +1166 -0
  35. package/dist/node_modules/source-map/lib/source-map-generator.js +445 -0
  36. package/dist/node_modules/source-map/lib/source-node.js +431 -0
  37. package/dist/node_modules/source-map/lib/util.js +506 -0
  38. package/dist/node_modules/source-map/source-map.js +27 -0
  39. package/dist/node_modules/source-map-support/source-map-support.js +646 -0
  40. package/dist/node_modules/typescript/lib/typescript.js +174130 -0
  41. package/dist/oss/publish2oss.js +331 -0
  42. package/dist/plugins/AddNeoRequirePlugin.js +195 -0
  43. package/dist/utils/autoEntryRootDir.js +103 -0
  44. package/dist/utils/cmpUtils/createCmpByTemplate.js +82 -0
  45. package/dist/utils/cmpUtils/createCmpByZip.js +433 -0
  46. package/dist/utils/cmpUtils/createCommonModulesCode.js +139 -0
  47. package/dist/utils/cmpUtils/deleteCmp.js +81 -0
  48. package/dist/utils/cmpUtils/getCmpModelRegisterCode.js +47 -0
  49. package/dist/utils/cmpUtils/getCmpPreviewCode.js +60 -0
  50. package/dist/utils/cmpUtils/getCmpRegisterCode.js +47 -0
  51. package/dist/utils/cmpUtils/getCmpTypeByDir.js +59 -0
  52. package/dist/utils/cmpUtils/hasCmpTypeByDir.js +27 -0
  53. package/dist/utils/cmpUtils/previewCmp.js +75 -0
  54. package/dist/utils/cmpUtils/pullCmp.js +126 -0
  55. package/dist/utils/cmpUtils/pushCmp.js +254 -0
  56. package/dist/utils/common.js +125 -0
  57. package/dist/utils/configureNeoBuild.js +129 -0
  58. package/dist/utils/generateEntries.js +80 -0
  59. package/dist/utils/neoConfigInit.js +30 -0
  60. package/dist/utils/neoParams.js +26 -0
  61. package/dist/utils/pathUtils.js +40 -0
  62. package/dist/utils/projectNameValidator.js +90 -0
  63. package/dist/utils/projectUtils/createCmpProjectByTemplate.js +81 -0
  64. package/dist/utils/projectUtils/createCmpProjectZip.js +141 -0
  65. package/dist/utils/projectUtils/getEntries.js +99 -0
  66. package/dist/utils/projectUtils/getEntriesWithAutoRegister.js +129 -0
  67. package/dist/utils/projectUtils/hasNeoProject.js +34 -0
  68. package/dist/utils/projectUtils/openProject.js +117 -0
  69. package/dist/utils/projectUtils/updatePublishLog.js +47 -0
  70. package/dist/utils/replaceInFilesByMap.js +71 -0
  71. package/dist/utils/replaceInPackage.js +151 -0
  72. package/dist/utils/resetPackageVersion.js +132 -0
  73. package/package.json +6 -8
  74. package/test/demo.js +0 -2
  75. package/test/deprecate-versions.js +1 -1
  76. package/src/config/auth.config.js +0 -27
  77. package/src/config/default.config.js +0 -176
  78. package/src/config/index.js +0 -9
  79. package/src/main.js +0 -221
  80. package/src/module/inspect.js +0 -41
  81. package/src/module/neoInit.js +0 -55
  82. package/src/module/neoInitByCopy.js +0 -61
  83. package/src/neo/NeoUMDContent.js +0 -30
  84. package/src/neo/neoLogin.js +0 -565
  85. package/src/neo/neoRequire.js +0 -125
  86. package/src/neo/neoService.js +0 -874
  87. package/src/neo/webpack.mf.js +0 -60
  88. package/src/neo/wrapperContent.js +0 -16
  89. package/src/oss/publish2oss.js +0 -348
  90. package/src/plugins/AddNeoRequirePlugin-v1.js +0 -47
  91. package/src/plugins/AddNeoRequirePlugin.js +0 -179
  92. package/src/plugins/README.md +0 -109
  93. package/src/utils/autoEntryRootDir.js +0 -85
  94. package/src/utils/cmpUtils/createCmpByTemplate.js +0 -60
  95. package/src/utils/cmpUtils/createCmpByZip.js +0 -408
  96. package/src/utils/cmpUtils/createCommonModulesCode.js +0 -121
  97. package/src/utils/cmpUtils/deleteCmp.js +0 -63
  98. package/src/utils/cmpUtils/getCmpModelRegisterCode.js +0 -31
  99. package/src/utils/cmpUtils/getCmpPreviewCode.js +0 -43
  100. package/src/utils/cmpUtils/getCmpRegisterCode.js +0 -31
  101. package/src/utils/cmpUtils/getCmpTypeByDir.js +0 -41
  102. package/src/utils/cmpUtils/hasCmpTypeByDir.js +0 -11
  103. package/src/utils/cmpUtils/previewCmp.js +0 -55
  104. package/src/utils/cmpUtils/pullCmp.js +0 -104
  105. package/src/utils/cmpUtils/pushCmp.js +0 -230
  106. package/src/utils/common.js +0 -107
  107. package/src/utils/configureNeoBuild.js +0 -109
  108. package/src/utils/generateEntries.js +0 -63
  109. package/src/utils/neoConfigInit.js +0 -13
  110. package/src/utils/neoParams.js +0 -12
  111. package/src/utils/pathUtils.js +0 -23
  112. package/src/utils/projectNameValidator.js +0 -76
  113. package/src/utils/projectUtils/createCmpProjectByTemplate.js +0 -59
  114. package/src/utils/projectUtils/createCmpProjectZip.js +0 -120
  115. package/src/utils/projectUtils/getEntries.js +0 -80
  116. package/src/utils/projectUtils/getEntriesWithAutoRegister.js +0 -108
  117. package/src/utils/projectUtils/hasNeoProject.js +0 -17
  118. package/src/utils/projectUtils/openProject.js +0 -96
  119. package/src/utils/projectUtils/updatePublishLog.js +0 -30
  120. package/src/utils/replaceInFiles.js +0 -47
  121. package/src/utils/replaceInFilesByMap.js +0 -54
  122. package/src/utils/replaceInPackage.js +0 -134
  123. package/src/utils/resetPackageVersion.js +0 -115
  124. /package/{src → template}/initData/defaultTemplate.html +0 -0
  125. /package/{src → template}/initData/neo.config.js +0 -0
@@ -0,0 +1,151 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const require$$0 = require('fs-extra');
6
+ const require$$1 = require('node:path');
7
+
8
+ var replaceInPackage_1;
9
+ var hasRequiredReplaceInPackage;
10
+
11
+ function requireReplaceInPackage () {
12
+ if (hasRequiredReplaceInPackage) return replaceInPackage_1;
13
+ hasRequiredReplaceInPackage = 1;
14
+ const fs = require$$0;
15
+ const path = require$$1;
16
+
17
+ /**
18
+ * package.json文件中替换指定字符串
19
+ * @param dir 项目目录
20
+ * @param oldStr 旧字符串
21
+ * @param newStr 新字符串
22
+ * @returns 替换结果对象: { success: boolean, message: string, filePath?: string, replaced?: boolean }
23
+ */
24
+ function replaceInPackage(dir, oldStr, newStr) {
25
+ try {
26
+ // 检查目录是否存在
27
+ if (!fs.existsSync(dir)) {
28
+ return {
29
+ success: false,
30
+ message: `目录不存在: ${dir}`
31
+ };
32
+ }
33
+
34
+ // 检查是否为目录
35
+ const stat = fs.statSync(dir);
36
+ if (!stat.isDirectory()) {
37
+ return {
38
+ success: false,
39
+ message: `指定路径不是目录: ${dir}`
40
+ };
41
+ }
42
+
43
+ // 构建package.json的完整路径
44
+ const packageJsonPath = path.join(dir, 'package.json');
45
+
46
+ // 检查package.json文件是否存在
47
+ if (!fs.existsSync(packageJsonPath)) {
48
+ return {
49
+ success: false,
50
+ message: `package.json文件不存在: ${packageJsonPath}`
51
+ };
52
+ }
53
+
54
+ // 读取package.json文件内容
55
+ let content = fs.readFileSync(packageJsonPath, 'utf8');
56
+
57
+ // 检查是否包含要替换的字符串
58
+ if (!content.includes(oldStr)) {
59
+ return {
60
+ success: true,
61
+ message: `package.json中未找到要替换的字符串: ${oldStr}`,
62
+ filePath: packageJsonPath,
63
+ replaced: false
64
+ };
65
+ }
66
+
67
+ // 执行全局替换
68
+ const newContent = content.replace(new RegExp(oldStr, 'g'), newStr);
69
+
70
+ // 检查是否有实际变化
71
+ if (content === newContent) {
72
+ return {
73
+ success: true,
74
+ message: '替换后内容无变化',
75
+ filePath: packageJsonPath,
76
+ replaced: false
77
+ };
78
+ }
79
+
80
+ // 写入替换后的内容
81
+ fs.writeFileSync(packageJsonPath, newContent, 'utf8');
82
+
83
+ // 统计替换次数
84
+ const matches = content.match(new RegExp(oldStr, 'g'));
85
+ const replaceCount = matches ? matches.length : 0;
86
+
87
+ return {
88
+ success: true,
89
+ message: `成功替换 ${replaceCount} 处字符串`,
90
+ filePath: packageJsonPath,
91
+ replaced: true
92
+ };
93
+ } catch (error) {
94
+ return {
95
+ success: false,
96
+ message: `replaceInPackage 运行失败: ${error.message}`
97
+ };
98
+ }
99
+ }
100
+
101
+ /**
102
+ * 批量替换多个目录中的package.json文件
103
+ * @param dirs 目录数组
104
+ * @param oldStr 旧字符串
105
+ * @param newStr 新字符串
106
+ * @returns 批量替换结果
107
+ */
108
+ function replaceInMultiplePackages(dirs, oldStr, newStr) {
109
+ const results = dirs.map((dir) => ({
110
+ dir,
111
+ result: replaceInPackage(dir, oldStr, newStr)
112
+ }));
113
+
114
+ const success = results.filter((r) => r.result.success).length;
115
+ const failed = results.length - success;
116
+
117
+ return {
118
+ total: dirs.length,
119
+ success,
120
+ failed,
121
+ results
122
+ };
123
+ }
124
+
125
+ /**
126
+ * 验证package.json文件格式是否正确
127
+ * @param filePath package.json文件路径
128
+ * @returns 验证结果: { valid: boolean, error?: string }
129
+ */
130
+ function validatePackageJson(filePath) {
131
+ try {
132
+ const content = fs.readFileSync(filePath, 'utf8');
133
+ JSON.parse(content);
134
+ return { valid: true };
135
+ } catch (error) {
136
+ return {
137
+ valid: false,
138
+ error: `JSON格式错误: ${error.message}`
139
+ };
140
+ }
141
+ }
142
+
143
+ replaceInPackage_1 = {
144
+ replaceInPackage,
145
+ replaceInMultiplePackages,
146
+ validatePackageJson
147
+ };
148
+ return replaceInPackage_1;
149
+ }
150
+
151
+ exports.__require = requireReplaceInPackage;
@@ -0,0 +1,132 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const require$$0 = require('fs-extra');
6
+ const require$$1 = require('node:path');
7
+
8
+ var resetPackageVersion_1;
9
+ var hasRequiredResetPackageVersion;
10
+
11
+ function requireResetPackageVersion () {
12
+ if (hasRequiredResetPackageVersion) return resetPackageVersion_1;
13
+ hasRequiredResetPackageVersion = 1;
14
+ const fs = require$$0;
15
+ const path = require$$1;
16
+
17
+ /**
18
+ * 重置 package.json 文件中的版本号到指定版本
19
+ * @param dir 项目目录
20
+ * @param version 目标版本号,默认为 '1.0.0'
21
+ * @returns 替换结果对象: { success: boolean, message: string, filePath?: string, oldVersion?: string, newVersion?: string }
22
+ */
23
+ function resetPackageVersion(dir, version = '1.0.0') {
24
+ try {
25
+ // 检查目录是否存在
26
+ if (!fs.existsSync(dir)) {
27
+ return {
28
+ success: false,
29
+ message: `目录不存在: ${dir}`
30
+ };
31
+ }
32
+
33
+ // 检查是否为目录
34
+ const stat = fs.statSync(dir);
35
+ if (!stat.isDirectory()) {
36
+ return {
37
+ success: false,
38
+ message: `指定路径不是目录: ${dir}`
39
+ };
40
+ }
41
+
42
+ // 构建package.json的完整路径
43
+ const packageJsonPath = path.join(dir, 'package.json');
44
+
45
+ // 检查package.json文件是否存在
46
+ if (!fs.existsSync(packageJsonPath)) {
47
+ return {
48
+ success: false,
49
+ message: `package.json文件不存在: ${packageJsonPath}`
50
+ };
51
+ }
52
+
53
+ // 读取并解析package.json文件
54
+ const content = fs.readFileSync(packageJsonPath, 'utf8');
55
+ let packageJson = {};
56
+
57
+ try {
58
+ packageJson = JSON.parse(content);
59
+ } catch (error) {
60
+ return {
61
+ success: false,
62
+ message: `package.json 文件解析失败: ${error.message}。`
63
+ };
64
+ }
65
+
66
+
67
+ // 保存旧版本号
68
+ const oldVersion = packageJson.version || '未定义';
69
+
70
+ // 检查版本号是否已经是目标版本
71
+ if (packageJson.version === version) {
72
+ return {
73
+ success: true,
74
+ message: `package.json 版本号已经是 ${version}`,
75
+ filePath: packageJsonPath,
76
+ oldVersion,
77
+ newVersion: version
78
+ };
79
+ }
80
+
81
+ // 更新版本号
82
+ packageJson.version = version;
83
+
84
+ // 写入package.json,保持格式化(2空格缩进)
85
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf8');
86
+
87
+ return {
88
+ success: true,
89
+ message: `已将 package.json 版本号从 ${oldVersion} 重置为 ${version}`,
90
+ filePath: packageJsonPath,
91
+ oldVersion,
92
+ newVersion: version
93
+ };
94
+ } catch (error) {
95
+ return {
96
+ success: false,
97
+ message: `resetPackageVersion 运行失败: ${error.message}`
98
+ };
99
+ }
100
+ }
101
+
102
+ /**
103
+ * 批量重置多个目录中 package.json 文件的版本号
104
+ * @param dirs 目录数组
105
+ * @param version 目标版本号,默认为 '1.0.0'
106
+ * @returns 批量重置结果
107
+ */
108
+ function resetVersionInMulPackages(dirs, version = '1.0.0') {
109
+ const results = dirs.map((dir) => ({
110
+ dir,
111
+ result: resetPackageVersion(dir, version)
112
+ }));
113
+
114
+ const successCount = results.filter((r) => r.result.success).length;
115
+ const failedCount = results.length - successCount;
116
+
117
+ return {
118
+ total: dirs.length,
119
+ success: successCount,
120
+ failed: failedCount,
121
+ results
122
+ };
123
+ }
124
+
125
+ resetPackageVersion_1 = {
126
+ resetPackageVersion,
127
+ resetVersionInMulPackages
128
+ };
129
+ return resetPackageVersion_1;
130
+ }
131
+
132
+ exports.__require = requireResetPackageVersion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo-cmp-cli",
3
- "version": "1.8.7",
3
+ "version": "1.8.9",
4
4
  "description": "Neo 自定义组件开发工具,支持react 和 vue2.0技术栈。",
5
5
  "keywords": [
6
6
  "neo-cli",
@@ -9,18 +9,16 @@
9
9
  "author": "wibetter",
10
10
  "license": "MIT",
11
11
  "bin": {
12
- "neo": "./bin/neo.js",
13
- "build2esm": "neo build2esm"
12
+ "neo": "./bin/neo.js"
14
13
  },
15
- "main": "src/main.js",
14
+ "main": "dist/main.js",
16
15
  "scripts": {
17
- "neo": "neo",
18
- "build2esm": "neo build2esm",
16
+ "build2node": "akfun build2node",
19
17
  "format": "prettier --write \"src/**/**/*.{js,jsx,vue,tsx,ts,scss,less,json}\""
20
18
  },
21
19
  "files": [
22
20
  "bin/*",
23
- "src/*",
21
+ "dist/*",
24
22
  "template/*",
25
23
  "test/*"
26
24
  ],
@@ -44,7 +42,7 @@
44
42
  },
45
43
  "dependencies": {
46
44
  "adm-zip": "^0.5.10",
47
- "akfun": "^5.1.21",
45
+ "akfun": "^5.2.2",
48
46
  "axios": "^0.27.2",
49
47
  "babel-plugin-import": "^1.13.8",
50
48
  "chalk": "^4.0.0",
package/test/demo.js CHANGED
@@ -1,6 +1,4 @@
1
1
  const {neoInit, neoConfigInit, inspect, preview, debug, build2lib, build2esm, neoInitByCopy, previewCmp } = require('../dist/main');
2
- const getEntries = require('../src/utils/projectUtils/getEntries');
3
- const getEntriesWithAutoRegister = require('../src/utils/projectUtils/getEntriesWithAutoRegister');
4
2
  inspect('dev');
5
3
  // neoInitByCopy('react-ts', 'test123');
6
4
 
@@ -1,7 +1,7 @@
1
1
  const { execSync } = require('child_process');
2
2
 
3
3
  // 所有需要废弃的版本
4
- const versionsToDeprecate = ["1.8.6-beta.1", "1.8.6-beta.2", "1.8.6-beta.3", "1.8.6-beta.5", "1.8.6-beta.6"];
4
+ const versionsToDeprecate = ["1.8.6", "1.8.7", "1.8.8"];
5
5
 
6
6
  const packageName = 'neo-cmp-cli';
7
7
  const deprecateMessage = '此版本为开发中版本(存在 bug),请升级到最新版本。';
@@ -1,27 +0,0 @@
1
- const curConfig = require('../config/index'); // 获取当前项目根目录下的配置文件
2
-
3
- const neoConfig = curConfig.neoConfig || {};
4
- // const authConfig = neoConfig.auth || {};
5
-
6
- // NeoCRM 跨 Pod 授权配置
7
- module.exports = {
8
- loginURL: neoConfig.loginURL || 'https://login-cd.xiaoshouyi.com/auc/oauth2/auth', // 登录 URL,从创建连接器的客户端信息中获取(Login_Url)
9
- tokenAPI: neoConfig.tokenAPI || 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
10
- redirectUri: neoConfig.redirectUri || 'http://localhost:1028', // 固定端口号,用于接收授权码
11
- // 重定向 URI,动态生成
12
- getRedirectURI: (port) => {
13
- return `http://localhost:${port}`;
14
- },
15
- // 获取 授权码 相关配置
16
- response_type: 'code', // 认证类型;此参数值必须为 code
17
- // client_id: authConfig.client_id || '04c8b45c4dbe36426a660bf70d3fe3e7', // 客户端 ID,跨 Pod 级链接器【内置】
18
- client_id: '04c8b45c4dbe36426a660bf70d3fe3e7', // 客户端 ID,跨 Pod 级链接器【内置】
19
- scope: 'all', // 固定值:all
20
- oauthType: 'standard', // 固定值:standard
21
- access_type: 'offline', // 此参数值为 online 时,不产生 refresh_token ;此参数值为 offline 时,返回refresh_token
22
-
23
- // 获取 令牌 相关配置
24
- // client_secret: authConfig.client_secret || '370817d1336a3737f95c671eea39a23b', // 客户端秘钥,跨 Pod 级链接器【内置】
25
- client_secret: '370817d1336a3737f95c671eea39a23b', // 客户端秘钥,跨 Pod 级链接器【内置】
26
- grant_type: 'authorization_code' // 授权类型;此参数值必须为 authorization_code
27
- };
@@ -1,176 +0,0 @@
1
- 'use strict';
2
- // 统一路径解析:
3
- const { resolve } = require('akfun');
4
- const path = require('path'); // 以命令执行目录为根目录
5
-
6
- // 当前neo的路径解析(用于获取neo-cmp-cli本身的文件地址)
7
- function resolveByDirname(dir) {
8
- return path.resolve(__dirname, dir);
9
- }
10
-
11
- /**
12
- * 脚手架赋予当前项目的默认配置
13
- */
14
- const defaultNEOConfig = {
15
- settings: {
16
- enableESLint: false, // 是否开启ESLint,默认开启ESLint检测代码格式
17
- enableESLintFix: false, // 是否ESLint自动修正代码格式
18
- enableStyleLint: false, // 是否开启StyleLint,默认开启ESLint检测代码格式
19
- enableStyleLintFix: false // 是否需要StyleLint自动修正代码格式
20
- },
21
- webpack: {
22
- resolve: {
23
- // webpack的resolve配置
24
- extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue', '.min.js', '.json'], // 用于配置webpack在尝试过程中用到的后缀列表
25
- alias: {
26
- '@': resolve('src')
27
- }
28
- },
29
- createDeclaration: false, // 打包时是否创建ts声明文件
30
- ignoreNodeModules: false, // 打包时是否忽略 node_modules
31
- allowList: [], // ignoreNodeModules为true时生效
32
- externals: {}, // 从输出的 bundle 中排除依赖
33
- projectDir: ['src'],
34
- template: resolveByDirname('../initData/defaultTemplate.html'), // 默认使用neo-widget提供的页面模板(会启动页面设计器)
35
- sassResources: [],
36
- babelPlugins: [
37
- ['import', { libraryName: 'antd', style: 'css' }] // 配置 antd 的样式按需引入
38
- ]
39
- },
40
- envParams: {
41
- // 项目系统环境变量
42
- common: {
43
- // 通用参数
44
- '#version#': '20221229.1'
45
- },
46
- local: {
47
- // 本地开发环境
48
- '#dataApiBase#': 'http://localhost:1024', // 数据接口根地址
49
- '#assetsPublicPath#': 'http://localhost:1024', // 静态资源根地址
50
- '#routeBasePath#': '/' // 路由根地址
51
- },
52
- online: {
53
- // 线上正式环境配置参数
54
- '#dataApiBase#': '/', // 数据接口根地址 "//xxx.cn/"格式
55
- '#assetsPublicPath#': '', // 静态资源根地址 "//xxx.cn/_spa/projectName"格式
56
- '#routeBasePath#': '/' // 路由根地址 "/_spa/projectName/"格式
57
- }
58
- },
59
- dev: {
60
- // 用于开启本地调试模式的相关配置信息
61
- NODE_ENV: 'development',
62
- port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
63
- autoOpenBrowser: true,
64
- assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
65
- assetsSubDirectory: '',
66
- hostname: 'localhost',
67
- proxyTable: {},
68
- /** CSS Sourcemaps off by default because relative paths are "buggy"
69
- * with this option, according to the CSS-Loader README
70
- * (https://github.com/webpack/css-loader#sourcemaps)
71
- * In our experience, they generally work as expected,
72
- * just be aware of this issue when enabling this option.
73
- */
74
- cssSourceMap: true
75
- },
76
- build: {
77
- // 用于构建生产环境代码的相关配置信息
78
- NODE_ENV: 'production', // production 模式,会启动UglifyJsPlugin服务
79
- assetsRoot: resolve('dist'), // 编译完成的文件存放路径
80
- assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
81
- assetsSubDirectory: '', // 资源引用二级路径
82
- productionSourceMap: false,
83
- // closeHtmlWebpackPlugin: true, // 可用于控制不生成html文件
84
- // Gzip off by default as many popular public hosts such as
85
- // Surge or Netlify already gzip all public assets for you.
86
- // Before setting to `true`, make sure to:
87
- // npm install --save-dev compression-webpack-plugin
88
- productionGzip: false,
89
- productionGzipExtensions: ['js', 'css', 'json'],
90
- // Run the build command with an extra argument to
91
- // View the bundle analyzer report after build finishes:
92
- // `npm run build --report`
93
- // Set to `true` or `false` to always turn it on or off
94
- bundleAnalyzerReport: false
95
- },
96
- build2lib: {
97
- // 用于构建第三方功能包的配置文件
98
- NODE_ENV: 'production',
99
- libraryName: '', // 构建第三方功能包时最后导出的引用变量名
100
- assetsRoot: resolve('dist'), // 编译完成的文件存放路径
101
- assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
102
- assetsSubDirectory: '', // 资源引用二级路径
103
- productionSourceMap: false,
104
- productionGzip: false,
105
- productionGzipExtensions: ['js', 'css', 'json'],
106
- bundleAnalyzerReport: false
107
- },
108
- linkDebug: {
109
- // 用于开启本地调试模式的相关配置信息
110
- NODE_ENV: 'development',
111
- closeHtmlWebpackPlugin: true,
112
- autoOpenBrowser: false,
113
- cssExtract: false,
114
- consoleInfo: '当前自定义组件可用外链地址'
115
- },
116
- publish2oss: {
117
- output: {
118
- filename: '[name].js',
119
- library: {
120
- type: 'var', // webpack 5 中生成 IIFE 格式的 type 配置
121
- export: 'default'
122
- },
123
- globalObject: 'this' // 定义全局变量,兼容node和浏览器运行,避免出现"window is not defined"的情况
124
- },
125
- cssExtract: false, // 不额外提取css文件
126
- ossType: 'ali', // oss类型:ali、baidu
127
- ossConfig: {
128
- endpoint: 'https://oss-cn-beijing.aliyuncs.com',
129
- // 个人阿里云子账户(neo-cmp-cli),有流量限制,请勿滥用
130
- AccessKeyId: 'LTAI5tS47y9L4fAPLXNoEzxS',
131
- AccessKeySecret: '8qz2GxxJJe44K5NRmLAAzIVJnbcYAU',
132
- bucket: 'neo-widgets' // 存储桶名称
133
- },
134
- assetsRoot: resolve('dist') // 上传指定目录下的脚本文件
135
- },
136
- // 授权码授权模式下的 NeoCRM 平台配置
137
- neoConfig: {
138
- authType: 'oauth2', // 授权类型,可选值:oauth2(默认)、password
139
- neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
140
- // 当 authType 为 oauth2 时,loginURL 配置项必填
141
- loginURL: 'https://login-cd.xiaoshouyi.com/auc/oauth2/auth', // 登录授权 URL(默认:https://login.xiaoshouyi.com/auc/oauth2/auth)
142
- tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token' // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
143
- },
144
- /*
145
- // 密码授权模式下的 NeoCRM 平台配置
146
- neoConfig: {
147
- authType: 'password', // 授权类型,可选值:oauth2(默认)、password
148
- neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
149
- tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
150
- // 当 authType 为 password 时,auth 配置项必填
151
- auth: {
152
- client_id: auth.client_id || 'xx', // 客户端 ID,从创建连接器的客户端信息中获取(Client_Id)
153
- client_secret: auth.client_secret || 'xxx', // 客户端秘钥,从创建连接器的客户端信息中获取(Client_Secret)
154
- username: auth.username || 'xx', // 用户在销售易系统中的用户名
155
- // password 为 用户在销售易系统中的账号密码加上 8 位安全令牌。
156
- // 例如,用户密码为 123456,安全令牌为 ABCDEFGH,则 password 的值应为 123456ABCDEFGH。
157
- password: auth.password || 'xx xx', // 用户账户密码 + 8 位安全令牌
158
- },
159
- },
160
- */
161
- pushCmp: {
162
- output: {
163
- filename: '[name].js',
164
- library: {
165
- type: 'var', // webpack 5 中生成 IIFE 格式的 type 配置
166
- export: 'default'
167
- },
168
- globalObject: 'this' // 定义全局变量,兼容node和浏览器运行,避免出现"window is not defined"的情况
169
- },
170
- cssExtract: false, // 不额外提取css文件
171
- assetsRoot: resolve('dist') // 上传指定目录下的脚本文件
172
- }
173
- };
174
-
175
- // 备注:数组类型则直接覆盖
176
- module.exports = defaultNEOConfig;
@@ -1,9 +0,0 @@
1
- // 统一路径解析:
2
- const { resolve, getConfigObj, deepMergeConfig } = require('akfun');
3
- const defaultNEOConfig = require('./default.config');
4
-
5
- // 从项目根目录获取当前项目的配置文件
6
- const curProjectConfig = getConfigObj(resolve('neo.config.js'));
7
-
8
- // 备注:数组类型则直接覆盖
9
- module.exports = deepMergeConfig(defaultNEOConfig, curProjectConfig);