neo-cmp-cli 1.8.7 → 1.8.8

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 (124) 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/src/config/auth.config.js +0 -27
  76. package/src/config/default.config.js +0 -176
  77. package/src/config/index.js +0 -9
  78. package/src/initData/defaultTemplate.html +0 -13
  79. package/src/initData/neo.config.js +0 -138
  80. package/src/main.js +0 -221
  81. package/src/module/inspect.js +0 -41
  82. package/src/module/neoInit.js +0 -55
  83. package/src/module/neoInitByCopy.js +0 -61
  84. package/src/neo/NeoUMDContent.js +0 -30
  85. package/src/neo/neoLogin.js +0 -565
  86. package/src/neo/neoRequire.js +0 -125
  87. package/src/neo/neoService.js +0 -874
  88. package/src/neo/webpack.mf.js +0 -60
  89. package/src/neo/wrapperContent.js +0 -16
  90. package/src/oss/publish2oss.js +0 -348
  91. package/src/plugins/AddNeoRequirePlugin-v1.js +0 -47
  92. package/src/plugins/AddNeoRequirePlugin.js +0 -179
  93. package/src/plugins/README.md +0 -109
  94. package/src/utils/autoEntryRootDir.js +0 -85
  95. package/src/utils/cmpUtils/createCmpByTemplate.js +0 -60
  96. package/src/utils/cmpUtils/createCmpByZip.js +0 -408
  97. package/src/utils/cmpUtils/createCommonModulesCode.js +0 -121
  98. package/src/utils/cmpUtils/deleteCmp.js +0 -63
  99. package/src/utils/cmpUtils/getCmpModelRegisterCode.js +0 -31
  100. package/src/utils/cmpUtils/getCmpPreviewCode.js +0 -43
  101. package/src/utils/cmpUtils/getCmpRegisterCode.js +0 -31
  102. package/src/utils/cmpUtils/getCmpTypeByDir.js +0 -41
  103. package/src/utils/cmpUtils/hasCmpTypeByDir.js +0 -11
  104. package/src/utils/cmpUtils/previewCmp.js +0 -55
  105. package/src/utils/cmpUtils/pullCmp.js +0 -104
  106. package/src/utils/cmpUtils/pushCmp.js +0 -230
  107. package/src/utils/common.js +0 -107
  108. package/src/utils/configureNeoBuild.js +0 -109
  109. package/src/utils/generateEntries.js +0 -63
  110. package/src/utils/neoConfigInit.js +0 -13
  111. package/src/utils/neoParams.js +0 -12
  112. package/src/utils/pathUtils.js +0 -23
  113. package/src/utils/projectNameValidator.js +0 -76
  114. package/src/utils/projectUtils/createCmpProjectByTemplate.js +0 -59
  115. package/src/utils/projectUtils/createCmpProjectZip.js +0 -120
  116. package/src/utils/projectUtils/getEntries.js +0 -80
  117. package/src/utils/projectUtils/getEntriesWithAutoRegister.js +0 -108
  118. package/src/utils/projectUtils/hasNeoProject.js +0 -17
  119. package/src/utils/projectUtils/openProject.js +0 -96
  120. package/src/utils/projectUtils/updatePublishLog.js +0 -30
  121. package/src/utils/replaceInFiles.js +0 -47
  122. package/src/utils/replaceInFilesByMap.js +0 -54
  123. package/src/utils/replaceInPackage.js +0 -134
  124. package/src/utils/resetPackageVersion.js +0 -115
package/bin/index.js CHANGED
@@ -16,8 +16,8 @@ const {
16
16
  consoleTag,
17
17
  errorLog,
18
18
  successLog
19
- } = require('../src/main.js');
20
- const mainAction = require('../src/main.js'); // 构建方法
19
+ } = require('../dist/main.js');
20
+ const mainAction = require('../dist/main.js'); // 构建方法
21
21
  // neo 的 package 文件
22
22
  const neoPackage = require('../package.json');
23
23
 
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
6
+
7
+ function getDefaultExportFromCjs (x) {
8
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
9
+ }
10
+
11
+ exports.commonjsGlobal = commonjsGlobal;
12
+ exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ var arraySet = {};
6
+
7
+ exports.__exports = arraySet;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ var base64Vlq = {};
6
+
7
+ exports.__exports = base64Vlq;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ var base64 = {};
6
+
7
+ exports.__exports = base64;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ var binarySearch = {};
6
+
7
+ exports.__exports = binarySearch;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ var mappingList = {};
6
+
7
+ exports.__exports = mappingList;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ var quickSort = {};
6
+
7
+ exports.__exports = quickSort;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ var sourceMapConsumer = {};
6
+
7
+ exports.__exports = sourceMapConsumer;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ var sourceMapGenerator = {};
6
+
7
+ exports.__exports = sourceMapGenerator;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ var sourceMapSupport = {exports: {}};
6
+
7
+ exports.__module = sourceMapSupport;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ var sourceMap = {};
6
+
7
+ exports.__exports = sourceMap;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ var sourceNode = {};
6
+
7
+ exports.__exports = sourceNode;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ var typescript = {exports: {}};
6
+
7
+ exports.__module = typescript;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ var util = {};
6
+
7
+ exports.__exports = util;
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const index = require('./index.js');
6
+
7
+ var auth_config;
8
+ var hasRequiredAuth_config;
9
+
10
+ function requireAuth_config () {
11
+ if (hasRequiredAuth_config) return auth_config;
12
+ hasRequiredAuth_config = 1;
13
+ const curConfig = index.__require(); // 获取当前项目根目录下的配置文件
14
+
15
+ const neoConfig = curConfig.neoConfig || {};
16
+ // const authConfig = neoConfig.auth || {};
17
+
18
+ // NeoCRM 跨 Pod 授权配置
19
+ auth_config = {
20
+ loginURL: neoConfig.loginURL || 'https://login-cd.xiaoshouyi.com/auc/oauth2/auth', // 登录 URL,从创建连接器的客户端信息中获取(Login_Url)
21
+ tokenAPI: neoConfig.tokenAPI || 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
22
+ redirectUri: neoConfig.redirectUri || 'http://localhost:1028', // 固定端口号,用于接收授权码
23
+ // 重定向 URI,动态生成
24
+ getRedirectURI: (port) => {
25
+ return `http://localhost:${port}`;
26
+ },
27
+ // 获取 授权码 相关配置
28
+ response_type: 'code', // 认证类型;此参数值必须为 code
29
+ // client_id: authConfig.client_id || '04c8b45c4dbe36426a660bf70d3fe3e7', // 客户端 ID,跨 Pod 级链接器【内置】
30
+ client_id: '04c8b45c4dbe36426a660bf70d3fe3e7', // 客户端 ID,跨 Pod 级链接器【内置】
31
+ scope: 'all', // 固定值:all
32
+ oauthType: 'standard', // 固定值:standard
33
+ access_type: 'offline', // 此参数值为 online 时,不产生 refresh_token ;此参数值为 offline 时,返回refresh_token
34
+
35
+ // 获取 令牌 相关配置
36
+ // client_secret: authConfig.client_secret || '370817d1336a3737f95c671eea39a23b', // 客户端秘钥,跨 Pod 级链接器【内置】
37
+ client_secret: '370817d1336a3737f95c671eea39a23b', // 客户端秘钥,跨 Pod 级链接器【内置】
38
+ grant_type: 'authorization_code' // 授权类型;此参数值必须为 authorization_code
39
+ };
40
+ return auth_config;
41
+ }
42
+
43
+ exports.__require = requireAuth_config;
@@ -0,0 +1,192 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const require$$0 = require('akfun');
6
+ const require$$1 = require('node:path');
7
+
8
+ var default_config;
9
+ var hasRequiredDefault_config;
10
+
11
+ function requireDefault_config () {
12
+ if (hasRequiredDefault_config) return default_config;
13
+ hasRequiredDefault_config = 1;
14
+ // 统一路径解析:
15
+ const { resolve } = require$$0;
16
+ const path = require$$1; // 以命令执行目录为根目录
17
+
18
+ // 当前neo的路径解析(用于获取neo-cmp-cli本身的文件地址)
19
+ function resolveByDirname(dir) {
20
+ return path.resolve(__dirname, dir);
21
+ }
22
+
23
+ /**
24
+ * 脚手架赋予当前项目的默认配置
25
+ */
26
+ const defaultNEOConfig = {
27
+ settings: {
28
+ enableESLint: false, // 是否开启ESLint,默认开启ESLint检测代码格式
29
+ enableESLintFix: false, // 是否ESLint自动修正代码格式
30
+ enableStyleLint: false, // 是否开启StyleLint,默认开启ESLint检测代码格式
31
+ enableStyleLintFix: false // 是否需要StyleLint自动修正代码格式
32
+ },
33
+ webpack: {
34
+ resolve: {
35
+ // webpack的resolve配置
36
+ extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue', '.min.js', '.json'], // 用于配置webpack在尝试过程中用到的后缀列表
37
+ alias: {
38
+ '@': resolve('src')
39
+ }
40
+ },
41
+ createDeclaration: false, // 打包时是否创建ts声明文件
42
+ ignoreNodeModules: false, // 打包时是否忽略 node_modules
43
+ allowList: [], // ignoreNodeModules为true时生效
44
+ externals: {}, // 从输出的 bundle 中排除依赖
45
+ projectDir: ['src'],
46
+ template: resolveByDirname('../initData/defaultTemplate.html'), // 默认使用neo-widget提供的页面模板(会启动页面设计器)
47
+ sassResources: [],
48
+ babelPlugins: [
49
+ ['import', { libraryName: 'antd', style: 'css' }] // 配置 antd 的样式按需引入
50
+ ]
51
+ },
52
+ envParams: {
53
+ // 项目系统环境变量
54
+ common: {
55
+ // 通用参数
56
+ '#version#': '20221229.1'
57
+ },
58
+ local: {
59
+ // 本地开发环境
60
+ '#dataApiBase#': 'http://localhost:1024', // 数据接口根地址
61
+ '#assetsPublicPath#': 'http://localhost:1024', // 静态资源根地址
62
+ '#routeBasePath#': '/' // 路由根地址
63
+ },
64
+ online: {
65
+ // 线上正式环境配置参数
66
+ '#dataApiBase#': '/', // 数据接口根地址 "//xxx.cn/"格式
67
+ '#assetsPublicPath#': '', // 静态资源根地址 "//xxx.cn/_spa/projectName"格式
68
+ '#routeBasePath#': '/' // 路由根地址 "/_spa/projectName/"格式
69
+ }
70
+ },
71
+ dev: {
72
+ // 用于开启本地调试模式的相关配置信息
73
+ NODE_ENV: 'development',
74
+ port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
75
+ autoOpenBrowser: true,
76
+ assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
77
+ assetsSubDirectory: '',
78
+ hostname: 'localhost',
79
+ proxyTable: {},
80
+ /** CSS Sourcemaps off by default because relative paths are "buggy"
81
+ * with this option, according to the CSS-Loader README
82
+ * (https://github.com/webpack/css-loader#sourcemaps)
83
+ * In our experience, they generally work as expected,
84
+ * just be aware of this issue when enabling this option.
85
+ */
86
+ cssSourceMap: true
87
+ },
88
+ build: {
89
+ // 用于构建生产环境代码的相关配置信息
90
+ NODE_ENV: 'production', // production 模式,会启动UglifyJsPlugin服务
91
+ assetsRoot: resolve('dist'), // 编译完成的文件存放路径
92
+ assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
93
+ assetsSubDirectory: '', // 资源引用二级路径
94
+ productionSourceMap: false,
95
+ // closeHtmlWebpackPlugin: true, // 可用于控制不生成html文件
96
+ // Gzip off by default as many popular public hosts such as
97
+ // Surge or Netlify already gzip all public assets for you.
98
+ // Before setting to `true`, make sure to:
99
+ // npm install --save-dev compression-webpack-plugin
100
+ productionGzip: false,
101
+ productionGzipExtensions: ['js', 'css', 'json'],
102
+ // Run the build command with an extra argument to
103
+ // View the bundle analyzer report after build finishes:
104
+ // `npm run build --report`
105
+ // Set to `true` or `false` to always turn it on or off
106
+ bundleAnalyzerReport: false
107
+ },
108
+ build2lib: {
109
+ // 用于构建第三方功能包的配置文件
110
+ NODE_ENV: 'production',
111
+ libraryName: '', // 构建第三方功能包时最后导出的引用变量名
112
+ assetsRoot: resolve('dist'), // 编译完成的文件存放路径
113
+ assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
114
+ assetsSubDirectory: '', // 资源引用二级路径
115
+ productionSourceMap: false,
116
+ productionGzip: false,
117
+ productionGzipExtensions: ['js', 'css', 'json'],
118
+ bundleAnalyzerReport: false
119
+ },
120
+ linkDebug: {
121
+ // 用于开启本地调试模式的相关配置信息
122
+ NODE_ENV: 'development',
123
+ closeHtmlWebpackPlugin: true,
124
+ autoOpenBrowser: false,
125
+ cssExtract: false,
126
+ consoleInfo: '当前自定义组件可用外链地址'
127
+ },
128
+ publish2oss: {
129
+ output: {
130
+ filename: '[name].js',
131
+ library: {
132
+ type: 'var', // webpack 5 中生成 IIFE 格式的 type 配置
133
+ export: 'default'
134
+ },
135
+ globalObject: 'this' // 定义全局变量,兼容node和浏览器运行,避免出现"window is not defined"的情况
136
+ },
137
+ cssExtract: false, // 不额外提取css文件
138
+ ossType: 'ali', // oss类型:ali、baidu
139
+ ossConfig: {
140
+ endpoint: 'https://oss-cn-beijing.aliyuncs.com',
141
+ // 个人阿里云子账户(neo-cmp-cli),有流量限制,请勿滥用
142
+ AccessKeyId: 'LTAI5tS47y9L4fAPLXNoEzxS',
143
+ AccessKeySecret: '8qz2GxxJJe44K5NRmLAAzIVJnbcYAU',
144
+ bucket: 'neo-widgets' // 存储桶名称
145
+ },
146
+ assetsRoot: resolve('dist') // 上传指定目录下的脚本文件
147
+ },
148
+ // 授权码授权模式下的 NeoCRM 平台配置
149
+ neoConfig: {
150
+ authType: 'oauth2', // 授权类型,可选值:oauth2(默认)、password
151
+ neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
152
+ // 当 authType 为 oauth2 时,loginURL 配置项必填
153
+ loginURL: 'https://login-cd.xiaoshouyi.com/auc/oauth2/auth', // 登录授权 URL(默认:https://login.xiaoshouyi.com/auc/oauth2/auth)
154
+ tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token' // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
155
+ },
156
+ /*
157
+ // 密码授权模式下的 NeoCRM 平台配置
158
+ neoConfig: {
159
+ authType: 'password', // 授权类型,可选值:oauth2(默认)、password
160
+ neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
161
+ tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
162
+ // 当 authType 为 password 时,auth 配置项必填
163
+ auth: {
164
+ client_id: auth.client_id || 'xx', // 客户端 ID,从创建连接器的客户端信息中获取(Client_Id)
165
+ client_secret: auth.client_secret || 'xxx', // 客户端秘钥,从创建连接器的客户端信息中获取(Client_Secret)
166
+ username: auth.username || 'xx', // 用户在销售易系统中的用户名
167
+ // password 为 用户在销售易系统中的账号密码加上 8 位安全令牌。
168
+ // 例如,用户密码为 123456,安全令牌为 ABCDEFGH,则 password 的值应为 123456ABCDEFGH。
169
+ password: auth.password || 'xx xx', // 用户账户密码 + 8 位安全令牌
170
+ },
171
+ },
172
+ */
173
+ pushCmp: {
174
+ output: {
175
+ filename: '[name].js',
176
+ library: {
177
+ type: 'var', // webpack 5 中生成 IIFE 格式的 type 配置
178
+ export: 'default'
179
+ },
180
+ globalObject: 'this' // 定义全局变量,兼容node和浏览器运行,避免出现"window is not defined"的情况
181
+ },
182
+ cssExtract: false, // 不额外提取css文件
183
+ assetsRoot: resolve('dist') // 上传指定目录下的脚本文件
184
+ }
185
+ };
186
+
187
+ // 备注:数组类型则直接覆盖
188
+ default_config = defaultNEOConfig;
189
+ return default_config;
190
+ }
191
+
192
+ exports.__require = requireDefault_config;
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const require$$0 = require('akfun');
6
+ const default_config = require('./default.config.js');
7
+
8
+ var config;
9
+ var hasRequiredConfig;
10
+
11
+ function requireConfig () {
12
+ if (hasRequiredConfig) return config;
13
+ hasRequiredConfig = 1;
14
+ // 统一路径解析:
15
+ const { resolve, getConfigObj, deepMergeConfig } = require$$0;
16
+ const defaultNEOConfig = default_config.__require();
17
+
18
+ // 从项目根目录获取当前项目的配置文件
19
+ const curProjectConfig = getConfigObj(resolve('neo.config.js'));
20
+
21
+ // 备注:数组类型则直接覆盖
22
+ config = deepMergeConfig(defaultNEOConfig, curProjectConfig);
23
+ return config;
24
+ }
25
+
26
+ exports.__require = requireConfig;
package/dist/main.js ADDED
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ const _commonjsHelpers = require('./_virtual/_commonjsHelpers.js');
4
+ const main$1 = require('./main2.js');
5
+
6
+ var mainExports = main$1.__require();
7
+ const main = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(mainExports);
8
+
9
+ module.exports = main;
package/dist/main2.js ADDED
@@ -0,0 +1,259 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const require$$0 = require('akfun');
6
+ require('lodash');
7
+ const neoInit = require('./module/neoInit.js');
8
+ const neoInitByCopy = require('./module/neoInitByCopy.js');
9
+ const inspect = require('./module/inspect.js');
10
+ const neoConfigInit = require('./utils/neoConfigInit.js');
11
+ const neoParams = require('./utils/neoParams.js');
12
+ const index = require('./config/index.js');
13
+ const publish2oss = require('./oss/publish2oss.js');
14
+ const pushCmp = require('./utils/cmpUtils/pushCmp.js');
15
+ const previewCmp = require('./utils/cmpUtils/previewCmp.js');
16
+ const generateEntries = require('./utils/generateEntries.js');
17
+ const createCmpByTemplate = require('./utils/cmpUtils/createCmpByTemplate.js');
18
+ const createCmpProjectByTemplate = require('./utils/projectUtils/createCmpProjectByTemplate.js');
19
+ const pullCmp = require('./utils/cmpUtils/pullCmp.js');
20
+ const deleteCmp = require('./utils/cmpUtils/deleteCmp.js');
21
+ const openProject = require('./utils/projectUtils/openProject.js');
22
+ const configureNeoBuild = require('./utils/configureNeoBuild.js');
23
+ const common = require('./utils/common.js');
24
+ const projectNameValidator = require('./utils/projectNameValidator.js');
25
+ const getCmpTypeByDir = require('./utils/cmpUtils/getCmpTypeByDir.js');
26
+ const neoService = require('./neo/neoService.js');
27
+ const neoLogin = require('./neo/neoLogin.js');
28
+ const hasNeoProject = require('./utils/projectUtils/hasNeoProject.js');
29
+
30
+ var main;
31
+ var hasRequiredMain;
32
+
33
+ function requireMain () {
34
+ if (hasRequiredMain) return main;
35
+ hasRequiredMain = 1;
36
+ const akfun = require$$0;
37
+ const neoInit$1 = neoInit.__require();
38
+ const neoInitByCopy$1 = neoInitByCopy.__require();
39
+ const inspect$1 = inspect.__require();
40
+ const neoConfigInit$1 = neoConfigInit.__require();
41
+ const { consoleTag } = neoParams.__require();
42
+ const curConfig = index.__require(); // 获取当前项目根目录下的配置文件
43
+ const publish2oss$1 = publish2oss.__require();
44
+ const pushCmp$1 = pushCmp.__require();
45
+ const previewCmp$1 = previewCmp.__require();
46
+ const generateEntries$1 = generateEntries.__require();
47
+ // const { MFPlugins } = require('./neo/webpack.mf');
48
+ const createCmpByTemplate$1 = createCmpByTemplate.__require();
49
+ const createCmpProjectByTemplate$1 = createCmpProjectByTemplate.__require();
50
+ const pullCmp$1 = pullCmp.__require();
51
+ const deleteCmp$1 = deleteCmp.__require();
52
+ const openProject$1 = openProject.__require();
53
+ const { configureNeoBuild: configureNeoBuild$1 } = configureNeoBuild.__require();
54
+ const { errorLog, successLog } = common.__require();
55
+ // 导出工具函数
56
+ const { validateProjectName } = projectNameValidator.__require();
57
+ const getCmpTypeByDir$1 = getCmpTypeByDir.__require();
58
+ const NeoService = neoService.__require();
59
+ const NeoLoginService = neoLogin.__require();
60
+ const hasNeoProject$1 = hasNeoProject.__require();
61
+
62
+ /**
63
+ * 生成并设置 entry 配置
64
+ * @param {object} config 配置对象(dev 或 build2lib)
65
+ * @param {object} options 生成选项
66
+ * @param {string} options.entryType entry 类型:'widget' | 'linkDebug'
67
+ * @param {string} [options.cmpType] 可选的组件类型
68
+ * @returns {array} cmpTypes 组件类型列表
69
+ */
70
+ function setupEntries(config, options) {
71
+ const { entryType, cmpType } = options;
72
+
73
+ let cmpTypes = [];
74
+ let defaultExports = {};
75
+ try {
76
+ const {
77
+ entries,
78
+ cmpTypes: generatedCmpTypes,
79
+ defaultExports: generatedDefaultExports
80
+ } = generateEntries$1({
81
+ configEntry: config.entry,
82
+ disableAutoRegister: config.disableAutoRegister,
83
+ componentsDir: curConfig.componentsDir,
84
+ entryType,
85
+ cmpType
86
+ });
87
+
88
+ if (entries && Object.keys(entries).length > 0) {
89
+ config.entry = entries;
90
+ cmpTypes = generatedCmpTypes;
91
+ console.info('已自动生成 entry 入口配置:', entries);
92
+ }
93
+
94
+ defaultExports = generatedDefaultExports;
95
+ } catch (error) {
96
+ errorLog(error.message);
97
+ process.exit(1);
98
+ }
99
+
100
+ return {
101
+ cmpTypes,
102
+ defaultExports
103
+ };
104
+ }
105
+
106
+ /**
107
+ * 准备 build2lib 配置(用于 publish2oss 和 pushCmp)
108
+ * @param {object} sourceConfig 源配置对象
109
+ * @returns {object} 合并后的配置对象
110
+ */
111
+ function prepareBuild2LibConfig(sourceConfig) {
112
+ return Object.assign(curConfig.build2lib, sourceConfig);
113
+ }
114
+
115
+ main = {
116
+ neoInit: neoInit$1,
117
+ neoInitByCopy: neoInitByCopy$1,
118
+ inspect: inspect$1,
119
+ neoConfigInit: neoConfigInit$1,
120
+ projectConfig: curConfig,
121
+ consoleTag,
122
+ errorLog,
123
+ successLog,
124
+ validateProjectName,
125
+ getCmpTypeByDir: getCmpTypeByDir$1,
126
+ NeoService,
127
+ NeoLoginService,
128
+ hasNeoProject: hasNeoProject$1,
129
+ createCmpProjectByTemplate: createCmpProjectByTemplate$1,
130
+ createCmpByTemplate: createCmpByTemplate$1,
131
+ dev: () => {
132
+ if (!curConfig.dev) {
133
+ errorLog('未找到 dev 相关配置。');
134
+ process.exit(1);
135
+ }
136
+ akfun.dev(curConfig, consoleTag);
137
+ },
138
+ previewCmp: (cmpName) => {
139
+ // 预览组件本身内容
140
+ if (!cmpName) {
141
+ errorLog('请输入要预览的组件名称。');
142
+ process.exit(1);
143
+ }
144
+ if (!curConfig.preview) {
145
+ errorLog('未找到 preview 相关配置。');
146
+ process.exit(1);
147
+ }
148
+ curConfig.dev = Object.assign(curConfig.dev, curConfig.preview); // 将 preview 设置给 dev
149
+ delete curConfig.preview;
150
+
151
+ previewCmp$1(curConfig, cmpName);
152
+ },
153
+ linkDebug: () => {
154
+ // 外链调试模式
155
+ if (!curConfig.linkDebug) {
156
+ errorLog('未找到 debug 相关配置。');
157
+ process.exit(1);
158
+ }
159
+ // 将 linkDebug 设置给 dev
160
+ curConfig.dev = Object.assign(curConfig.dev, curConfig.linkDebug);
161
+ delete curConfig.linkDebug;
162
+
163
+ delete curConfig.dev.ignoreNodeModules; // 需要注入依赖
164
+ curConfig.webpack.ignoreNodeModules = false;
165
+
166
+ // 生成并设置 entry 配置
167
+ const { cmpTypes: curCmpTypes, defaultExports } = setupEntries(curConfig.dev, {
168
+ entryType: 'linkDebug'
169
+ });
170
+
171
+ // 配置 webpack 插件、externals 和 commonModulesCode
172
+ configureNeoBuild$1(curConfig.dev, {
173
+ cmpTypes: curCmpTypes,
174
+ defaultExports,
175
+ verbose: true,
176
+ excludeModel: false // linkDebug 不排除 Model
177
+ });
178
+
179
+ akfun.dev(curConfig, consoleTag);
180
+ },
181
+ build: () => akfun.build('build', curConfig, consoleTag), // 构建脚本:生产环境
182
+ build2lib: () => {
183
+ // 生成并设置 entry 配置
184
+ setupEntries(curConfig.build2lib, {
185
+ entryType: 'widget'
186
+ });
187
+
188
+ akfun.build('lib', curConfig, consoleTag);
189
+ }, // 构建脚本:生产环境
190
+ publish2oss: (cmpType) => {
191
+ // 将 publish2oss 相关配置设置给 build2lib
192
+ const publish2ossConfig = curConfig.publish2oss;
193
+ curConfig.build2lib = prepareBuild2LibConfig(publish2ossConfig);
194
+
195
+ // 生成并设置 entry 配置
196
+ const { cmpTypes: curCmpTypes, defaultExports } = setupEntries(curConfig.build2lib, {
197
+ entryType: 'widget',
198
+ cmpType
199
+ });
200
+
201
+ // 配置 webpack 插件、externals 和 commonModulesCode
202
+ configureNeoBuild$1(curConfig.build2lib, {
203
+ cmpTypes: curCmpTypes,
204
+ defaultExports,
205
+ verbose: true,
206
+ excludeModel: true // publish2oss 排除 Model 结尾的文件
207
+ });
208
+
209
+ akfun.build('lib', curConfig, consoleTag, () => {
210
+ // 构建完成后,执行 publish2oss
211
+ publish2oss$1(
212
+ publish2ossConfig.ossType,
213
+ publish2ossConfig.ossConfig,
214
+ publish2ossConfig.assetsRoot
215
+ );
216
+ });
217
+ },
218
+ // 发布组件到 NeoCRM 平台
219
+ pushCmp: (cmpType) => {
220
+ const { neoConfig, pushCmp: _pushCmpConfig } = curConfig;
221
+ const pushCmpConfig = Object.assign({}, _pushCmpConfig, neoConfig);
222
+ // 将 pushCmp 相关配置设置给 build2lib
223
+ curConfig.build2lib = prepareBuild2LibConfig(pushCmpConfig);
224
+
225
+ // 生成并设置 entry 配置
226
+ const { cmpTypes: curCmpTypes, defaultExports } = setupEntries(curConfig.build2lib, {
227
+ entryType: 'widget',
228
+ cmpType
229
+ });
230
+
231
+ // 配置 webpack 插件、externals 和 commonModulesCode
232
+ configureNeoBuild$1(curConfig.build2lib, {
233
+ cmpTypes: curCmpTypes,
234
+ defaultExports,
235
+ verbose: false,
236
+ excludeModel: true // pushCmp 排除 Model 结尾的文件
237
+ });
238
+
239
+ akfun.build('lib', curConfig, consoleTag, () => {
240
+ // 构建完成后,执行 pushCmp
241
+ pushCmp$1(pushCmpConfig, cmpType);
242
+ });
243
+ },
244
+ // 从 NeoCRM 平台拉取组件
245
+ pullCmp: (cmpType, neoService) => {
246
+ pullCmp$1(cmpType, curConfig.neoConfig, neoService);
247
+ },
248
+ // 从 NeoCRM 平台删除组件
249
+ deleteCmp: (cmpType, neoService) => {
250
+ deleteCmp$1(cmpType, curConfig.neoConfig, neoService);
251
+ },
252
+ build2esm: (fileName) => akfun.build2esm(fileName, curConfig, consoleTag), // 构建esm输出模块
253
+ // 打开编辑器(Cursor 或 VSCode)
254
+ openEditor: openProject$1
255
+ };
256
+ return main;
257
+ }
258
+
259
+ exports.__require = requireMain;