neo-cmp-cli 1.7.15-beta.1 → 1.7.16

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo-cmp-cli",
3
- "version": "1.7.15-beta.1",
3
+ "version": "1.7.16",
4
4
  "description": "前端脚手架:自定义组件开发工具,支持react 和 vue2.0技术栈。",
5
5
  "keywords": [
6
6
  "neo-cli",
@@ -16,8 +16,8 @@ const NeoCrmAPI = {
16
16
  tokenAPI: 'https://login.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址
17
17
  delete: '/rest/metadata/v3.0/ui/customComponents',
18
18
  saveAPI: '/rest/metadata/v3.0/ui/customComponents/actions/saveOrUpdateComponent', // 创建或者保存接口地址
19
- queryAll: '/rest/metadata/v3.0/ui/components/filter?custom=false', // 不带分页
20
- getCodeLibAPI: (cmpType) => `rest/metadata/v3.0/ui/customComponents/${cmpType}/CodeLib`, // 组件源码下载
19
+ queryAll: '/rest/metadata/v3.0/ui/components/filter?custom=true', // 不带分页
20
+ getCodeLibAPI: (cmpType) => `/rest/metadata/v3.0/ui/customComponents/${cmpType}/codeLib`, // 组件源码下载
21
21
 
22
22
  uploadAPI: '/rest/metadata/v3.0/ui/customComponents/actions/upload', // 文件上传接口地址(已废弃)
23
23
  query: '/rest/metadata/v3.0/ui/customComponents/actions/queryCustomComponents' // 带分页(暂未使用)
@@ -31,15 +31,15 @@ const cmpFields = [
31
31
  'description',
32
32
  'framework',
33
33
  'icon',
34
+ 'iconUrl',
34
35
  'orderNo',
35
36
  'version',
36
37
  'propsSchema',
37
38
  'defaultProps',
38
39
  'previewProps',
39
40
  'events',
40
- 'actions',
41
+ 'functions',
41
42
  'asset',
42
- 'plugin',
43
43
  'modelAsset',
44
44
  'cssAsset',
45
45
  'codeLib'
@@ -573,15 +573,20 @@ class NeoService {
573
573
  }
574
574
 
575
575
  const fileContent = fs.createReadStream(filePath);
576
+ const fileInfo = {
577
+ fileContent,
578
+ fileName: file,
579
+ fileSize: fileStat.size,
580
+ };
576
581
  if (file.indexOf('Model') > -1) {
577
582
  // 使用文件流而不是读取整个文件到内存(对大文件更友好)
578
- curCmpInfo.modelAssetFile = fileContent;
583
+ curCmpInfo.modelAssetFile = fileInfo;
579
584
  } else if (file.endsWith('.css')) {
580
- curCmpInfo.cssAssetFile = fileContent;
585
+ curCmpInfo.cssAssetFile = fileInfo;
581
586
  } else if (file.endsWith('.zip')) {
582
- curCmpInfo.codeLibFile = fileContent;
587
+ curCmpInfo.codeLibFile = fileInfo;
583
588
  } else {
584
- curCmpInfo.assetFile = fileContent;
589
+ curCmpInfo.assetFile = fileInfo;
585
590
  }
586
591
  }
587
592
  });
@@ -602,31 +607,56 @@ class NeoService {
602
607
  throw new Error('componentData 不能为空');
603
608
  }
604
609
 
605
- const spinner = ora('正在更新自定义组件...').start();
610
+ const spinner = ora('正在保存自定义组件信息...').start();
606
611
 
607
612
  try {
608
613
  const fullUpdateAPI = this.saveAPI();
609
- const response = await axios.post(fullUpdateAPI, componentData, {
614
+
615
+ // 创建 FormData
616
+ const formData = new FormData();
617
+ // 处理 componentData 中的 fileInfo 文件
618
+ if (componentData.assetFile) {
619
+ formData.append('assetFile', componentData.assetFile.fileContent, componentData.assetFile.fileName);
620
+ }
621
+ if (componentData.modelAssetFile) {
622
+ formData.append('modelAssetFile', componentData.modelAssetFile.fileContent, componentData.modelAssetFile.fileName);
623
+ }
624
+ if (componentData.cssAssetFile) {
625
+ formData.append('cssAssetFile', componentData.cssAssetFile.fileContent, componentData.cssAssetFile.fileName);
626
+ }
627
+ if (componentData.codeLibFile) {
628
+ formData.append('codeLibFile', componentData.codeLibFile.fileContent, componentData.codeLibFile.fileName);
629
+ }
630
+
631
+ // 将 componentData 中组件基本信息
632
+ formData.append('component', JSON.stringify(_.omit(componentData, ['assetFile', 'modelAssetFile', 'cssAssetFile', 'codeLibFile'])));
633
+
634
+ const response = await axios.post(fullUpdateAPI, formData, {
610
635
  headers: {
611
636
  Authorization: `Bearer ${token}`,
612
637
  'xsy-inner-source': 'bff',
613
- 'Content-Type': 'application/json'
614
- }
638
+ // 无需手动设置 Content-Type,formData.getHeaders() 会自动设置正确的 multipart/form-data 和 boundary
639
+ ...formData.getHeaders()
640
+ },
641
+ timeout: 120000, // 默认 60 秒
642
+ // 确保 axios 正确处理大文件和流
643
+ maxContentLength: Infinity, // 不限制响应内容长度
644
+ maxBodyLength: Infinity // 不限制请求体长度(适用于文件上传)
615
645
  });
616
646
  const { code, message } = response.data || {};
617
647
 
618
648
  if (code && code !== 200) {
619
- throw new Error(`更新组件失败: ${response.data.message || '未知错误'}`);
649
+ errorLog(`保存自定义组件信息失败: ${response.data.message || '未知错误'}`);
650
+ process.exit(1);
620
651
  }
621
652
 
622
653
  spinner.clear();
623
654
  spinner.stop();
624
655
  } catch (error) {
625
- errorLog('更新组件失败。', spinner);
626
656
  if (error.message) {
627
- errorLog(`更新组件失败: ${error.message}`);
657
+ errorLog(`保存自定义组件信息失败: ${error.message}`, spinner);
628
658
  } else {
629
- errorLog(`响应数据: ${JSON.stringify(error)}`);
659
+ errorLog(`保存自定义组件信息失败: ${JSON.stringify(error)}`, spinner);
630
660
  }
631
661
  process.exit(1);
632
662
  }
@@ -649,12 +679,9 @@ class NeoService {
649
679
 
650
680
  try {
651
681
  let queryAllAPI = this.buildFullUrl(NeoCrmAPI.queryAll);
652
- queryAllAPI += `?fields=${cmpFields.join(',')}`;
653
- const response = await axios.post(
682
+ queryAllAPI += `&fields=${cmpFields.join(',')}`;
683
+ const response = await axios.get(
654
684
  queryAllAPI,
655
- {
656
- data: {}
657
- },
658
685
  {
659
686
  headers: {
660
687
  Authorization: `Bearer ${token}`,
@@ -683,6 +710,20 @@ class NeoService {
683
710
  return this.cmpList || [];
684
711
  }
685
712
 
713
+ /**
714
+ * 获取自定义组件源码文件地址
715
+ * @param {string} cmpType 自定义组件名称
716
+ * @returns {string} 源码文件地址
717
+ */
718
+ getCodeLibByCmpType(cmpType) {
719
+ if (!cmpType) {
720
+ return null;
721
+ };
722
+ return this.buildFullUrl(NeoCrmAPI.getCodeLibAPI(cmpType));
723
+ }
724
+
725
+
726
+
686
727
  /**
687
728
  * 删除自定义组件
688
729
  * @param {*} cmpType 自定义组件类型
@@ -48,7 +48,7 @@
48
48
  "@commitlint/config-conventional": "^9.1.1",
49
49
  "@types/react": "^16.9.11",
50
50
  "@types/react-dom": "^16.9.15",
51
- "neo-cmp-cli": "^1.7.5",
51
+ "neo-cmp-cli": "^1.7.16",
52
52
  "husky": "^4.2.5",
53
53
  "lint-staged": "^10.2.9",
54
54
  "prettier": "^2.0.5"
@@ -46,7 +46,7 @@
46
46
  "@commitlint/config-conventional": "^9.1.1",
47
47
  "@types/react": "^16.9.11",
48
48
  "@types/react-dom": "^16.9.15",
49
- "neo-cmp-cli": "^1.7.5",
49
+ "neo-cmp-cli": "^1.7.16",
50
50
  "husky": "^4.2.5",
51
51
  "lint-staged": "^10.2.9",
52
52
  "prettier": "^2.0.5"
@@ -7,12 +7,6 @@ function resolve(dir) {
7
7
  return path.resolve(__dirname, dir);
8
8
  }
9
9
 
10
- let auth = {}; // NeoCRM 授权配置
11
- if (fs.existsSync('./auth.config.js')) {
12
- // 加载 NeoCRM 授权配置
13
- auth = require('./auth.config');
14
- }
15
-
16
10
  // 包括生产和开发的环境配置信息
17
11
  module.exports = {
18
12
  settings: {
@@ -121,12 +115,12 @@ module.exports = {
121
115
  tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
122
116
  // 当 authType 为 password 时,auth 配置项必填
123
117
  auth: {
124
- client_id: auth.client_id || 'xx', // 客户端 ID,从创建连接器的客户端信息中获取(Client_Id)
125
- client_secret: auth.client_secret || 'xxx', // 客户端秘钥,从创建连接器的客户端信息中获取(Client_Secret)
126
- username: auth.username || 'xx', // 用户在销售易系统中的用户名
118
+ client_id: 'xx', // 客户端 ID,从创建连接器的客户端信息中获取(Client_Id)
119
+ client_secret: 'xxx', // 客户端秘钥,从创建连接器的客户端信息中获取(Client_Secret)
120
+ username: 'xx', // 用户在销售易系统中的用户名
127
121
  // password 为 用户在销售易系统中的账号密码加上 8 位安全令牌。
128
122
  // 例如,用户密码为 123456,安全令牌为 ABCDEFGH,则 password 的值应为 123456ABCDEFGH。
129
- password: auth.password || 'xx xx', // 用户账户密码 + 8 位安全令牌
123
+ password: 'xx xx', // 用户账户密码 + 8 位安全令牌
130
124
  },
131
125
  },
132
126
  */
@@ -14,6 +14,8 @@
14
14
  "preview": "neo preview",
15
15
  "linkDebug": "neo linkDebug",
16
16
  "pushCmp": "neo push cmp",
17
+ "pullCmp": "neo pull cmp",
18
+ "deleteCmp": "neo delete cmp",
17
19
  "format": "prettier --write \"src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}\""
18
20
  },
19
21
  "files": [
@@ -38,7 +40,7 @@
38
40
  "url": "https://github.com/wibetter/neo-custom-cmp-template/issues"
39
41
  },
40
42
  "dependencies": {
41
- "neo-register": "^1.0.7",
43
+ "neo-register": "^1.0.8",
42
44
  "react": "^16.9.0",
43
45
  "react-dom": "^16.9.0",
44
46
  "axios": "^0.27.2",
@@ -52,7 +54,7 @@
52
54
  "@types/react": "^16.9.11",
53
55
  "@types/react-dom": "^16.9.15",
54
56
  "@types/axios": "^0.14.0",
55
- "neo-cmp-cli": "^1.7.15",
57
+ "neo-cmp-cli": "^1.7.16",
56
58
  "husky": "^4.2.5",
57
59
  "lint-staged": "^10.2.9",
58
60
  "prettier": "^2.0.5"
@@ -1,71 +1,49 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "experimentalDecorators": true,
4
- /* Basic Options */
5
4
  "target": "esnext",
6
- /* 指定编译之后的版本: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
7
- "module": "esnext" /* 指定要使用的模板标准: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
8
- // "lib": [], /* Specify library files to be included in the compilation. */
9
- "allowJs": false /* 指定是否允许编译JS文件,默认false,即不编译JS文件. */,
10
- // "checkJs": true, /* 指定是否检查和报告JS文件中的错误,默认false */
11
- "jsx": "react" /* 指定jsx代码用于的开发环境:'preserve','react-native', or 'react'. */,
12
- "declaration": false /* 指定是否在编译的时候生成相的d.ts声明文件 */,
13
- // "declarationMap": true, /* 指定编译时是否生成.map文件 */
14
- // "sourceMap": true, /* 指定编译时是否生成.map文件 */
15
- // "outFile": "./", /* 指定输出文件合并为一个文件 */
16
- // "outDir": "dist", /* 指定输出文件夹,值为一个文件夹路径字符串,输出的文件都将放置在这个文件夹*/
17
- // "rootDir": "src", /* 指定编译文件的根目录,编译器会在根目录查找入口文件 */
18
- // "composite": true, /* 是否编译构建引用项目 */
19
- // "removeComments": true, /* 指定是否将编译后的文件注释删掉,设为true的话即删除注释,默认为false */
20
- "noEmit": false /* 不生成编译文件 */,
21
- "importHelpers": true /* 指定是否引入tslib里的复制工具函数,默认为false */,
22
- // "downlevelIteration": true, /* 当target为"ES5"或"ES3"时,为"for-of" "spread"和"destructuring"中的迭代器提供完全支持 */
23
- "isolatedModules": false /* 指定是否将每个文件作为单独的模块,默认为true */,
24
-
25
- /* Strict Type-Checking Options */
26
- "strict": false /* 指定是否启动所有类型检查 */,
27
- "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
28
- "strictNullChecks": true /* Enable strict null checks. */,
29
- // "strictFunctionTypes": true, /* Enable strict checking of function types. */
30
- // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
31
- "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
32
- // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
33
-
34
- /* Additional Checks */
35
- "noUnusedLocals": false /* Report errors on unused locals. */,
36
- // "noUnusedParameters": true, /* Report errors on unused parameters. */
37
- "noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
38
- // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
39
-
40
- /* Module Resolution Options */
41
- "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
42
- "baseUrl": "./" /* Base directory to resolve non-absolute module names. */,
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": "./",
43
20
  "paths": {
44
- "@": ["./src"],
45
- "@assets/*": ["src/assets/*"],
46
- "@components/*": ["src/components/*"],
47
- "$utils/*": ["src/utils/*"]
48
- } /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
49
- // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
50
- /* 指定声明文件或文件夹的路径列表,如果指定了此项,则只有在这里列出的声明文件才会被加载 */
51
- "typeRoots": ["./@types", "./node_modules/@types"],
52
- // "types": [], /* 指定需要包含的模块,只有在这里列出的模块的声明文件才会被加载 */
53
- "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
54
- "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
55
- // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
56
-
57
- /* Source Map Options */
58
- // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
59
- // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
60
- // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
61
- // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
62
-
63
- /* Experimental Options */
64
- // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
65
- // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
66
- "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
67
- // "suppressImplicitAnyIndexErrors": true /* Suppress --noImplicitAny errors for indexing objects lacking index signatures. See issue #1232 for more details. */
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
68
41
  },
69
- "include": ["src", "test"],
70
- "exclude": ["node_modules"]
42
+ "include": [
43
+ "src",
44
+ "test"
45
+ ],
46
+ "exclude": [
47
+ "node_modules"
48
+ ]
71
49
  }
@@ -45,7 +45,7 @@
45
45
  "devDependencies": {
46
46
  "@commitlint/cli": "^8.3.5",
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
- "neo-cmp-cli": "^1.7.5",
48
+ "neo-cmp-cli": "^1.7.16",
49
49
  "husky": "^4.2.5",
50
50
  "lint-staged": "^10.2.9",
51
51
  "prettier": "^2.0.5"
@@ -47,7 +47,7 @@
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
48
  "@types/react": "^16.9.11",
49
49
  "@types/react-dom": "^16.9.15",
50
- "neo-cmp-cli": "^1.7.5",
50
+ "neo-cmp-cli": "^1.7.16",
51
51
  "husky": "^4.2.5",
52
52
  "lint-staged": "^10.2.9",
53
53
  "prettier": "^2.0.5"
@@ -45,7 +45,7 @@
45
45
  "devDependencies": {
46
46
  "@commitlint/cli": "^8.3.5",
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
- "neo-cmp-cli": "^1.7.5",
48
+ "neo-cmp-cli": "^1.7.16",
49
49
  "husky": "^4.2.5",
50
50
  "lint-staged": "^10.2.9",
51
51
  "prettier": "^2.0.5",
@@ -120,7 +120,8 @@ function formatConfigObject(obj, indent = 0, fileDir = '') {
120
120
  * 3、对于 组件源码中的 tsconfig.json 文件内容 和 当前项目 tsconfig  进行 非覆盖式 merge 处理;
121
121
  * 4、对于 组件源码中的 package.json 文件内容 和 当前项目 package.json  进行 非覆盖式 merge 处理,并识别新增 依赖,提示用户 重新安装依赖
122
122
  */
123
- module.exports = async function (cmpZipUrl, cmpName, componentBaseDir = './src/components') {
123
+ module.exports = async function (cmpZipUrl, option = {}) {
124
+ const { token, cmpName, componentBaseDir = './src/components' } = option || {};
124
125
  const finalCmpName = cmpName;
125
126
 
126
127
  if (!hasNeoProject()) {
@@ -154,16 +155,26 @@ module.exports = async function (cmpZipUrl, cmpName, componentBaseDir = './src/c
154
155
  // 下载 zip 文件
155
156
  let response;
156
157
  try {
157
- response = await axios({
158
- url: cmpZipUrl,
159
- method: 'GET',
158
+ response = await axios.get(cmpZipUrl, {
159
+ headers: {
160
+ Authorization: `Bearer ${token}`,
161
+ 'xsy-inner-source': 'bff',
162
+ },
160
163
  responseType: 'arraybuffer',
161
164
  timeout: 60000, // 60秒超时
162
165
  maxContentLength: Infinity,
163
- maxBodyLength: Infinity
166
+ maxBodyLength: Infinity,
167
+ maxRedirects: 5, // 支持重定向
168
+ validateStatus: function (status) {
169
+ // 接受 2xx 和 3xx 状态码(重定向)
170
+ return status >= 200 && status < 400;
171
+ }
164
172
  });
165
173
  } catch (axiosError) {
166
- errorLog(`下载文件失败: ${axiosError.message}`, spinner);
174
+ const errorMessage = axiosError.response
175
+ ? `下载文件失败: HTTP ${axiosError.response.status} - ${axiosError.message}`
176
+ : `下载文件失败: ${axiosError.message}`;
177
+ errorLog(errorMessage, spinner);
167
178
  throw axiosError;
168
179
  }
169
180
 
@@ -72,22 +72,23 @@ const pullCmp = async (cmpType, authConfig, _neoService) => {
72
72
  }
73
73
 
74
74
  // 判断拉取的组件和当前项目是否为同一技术栈
75
- if (cmpInfo.framework !== framework) {
75
+ if (cmpInfo.framework && cmpInfo.framework !== framework) {
76
76
  errorLog(`拉取失败,${cmpType}自定义组件与当前项目技术栈不一致。`, spinner);
77
77
  process.exit(1);
78
78
  }
79
79
 
80
- // 获取当前源码
81
- if (!cmpInfo.codeLib) {
82
- errorLog(`拉取失败,${cmpType}自定义组件未记录对应的源码文件。`, spinner);
83
- process.exit(1);
84
- }
85
-
86
80
  // 下载源码文件并解析到 src/components 目录下
87
- const codeLib = cmpInfo.codeLib; // 源码文件地址(zip包地址)
81
+ const codeLib = neoService.getCodeLibByCmpType(cmpType); // 源码文件地址(zip包地址)
82
+
83
+ // 确保 token 有效
84
+ const token = await neoService.ensureValidToken();
88
85
 
89
86
  // 将zip 包里面的自定义组件源码解析到 src/components 目录下
90
- const cmpResult = await createCmpByZip(codeLib, cmpType, './src/components');
87
+ const cmpResult = await createCmpByZip(codeLib, {
88
+ token,
89
+ cmpName: cmpType,
90
+ componentBaseDir: './src/components'
91
+ });
91
92
  if (!cmpResult) {
92
93
  errorLog(`拉取失败,${cmpType}自定义组件源码解析失败,请检查源码文件是否正确。`, spinner);
93
94
  process.exit(1);
@@ -19,7 +19,7 @@ const getPropsSchema = (propsSchema = []) => {
19
19
  return {
20
20
  label: item.label,
21
21
  description: item.description,
22
- propSchema: item
22
+ propSchema: JSON.stringify(item)
23
23
  };
24
24
  });
25
25
  };
@@ -66,32 +66,31 @@ const buildComponentData = async (assetsRoot, cmpInfo) => {
66
66
  // const CatchCustomCmpModelClass = modelModule.default || modelModule;
67
67
  } else {
68
68
  errorLog(`未找到自定义组件模型文件,请检查以下路径是否存在:${modelFile}`);
69
- return null;
69
+ process.exit(1);
70
70
  }
71
71
  if (!globalThis.window || !globalThis.window.NEOEditorCustomModels) {
72
72
  errorLog(
73
73
  `模型文件未导出有效模型方法(CatchCustomCmpModelClass),模型文件地址: ${modelFile} `
74
74
  );
75
- return null;
75
+ process.exit(1);
76
76
  }
77
77
 
78
78
  const ModelClass = globalThis.window.NEOEditorCustomModels[cmpType];
79
79
  if (!ModelClass) {
80
80
  errorLog(`未找到自定义组件模型类(${cmpType}),模型文件地址: ${modelFile} `);
81
- return null;
81
+ process.exit(1);
82
82
  }
83
83
  // 实例化模型类
84
84
  const modelInstance = new ModelClass();
85
85
 
86
86
  if (!modelInstance) {
87
87
  errorLog(`未找到自定义组件模型信息(${cmpType}),模型文件地址: ${modelFile} `);
88
- return null;
88
+ process.exit(1);
89
89
  }
90
90
 
91
91
  // 构建组件数据,合并模型实例的信息
92
92
  const curCmpInfo = {
93
93
  ...cmpInfo,
94
- plugin: cmpInfo.modelAsset,
95
94
  version: currentPackageJson.version || '1.0.0',
96
95
  // 技术栈标识: 从 package.json / framework 字段获取,没有则默认 为 react ts 技术栈
97
96
  framework: currentPackageJson.framework ? getFramework(currentPackageJson.framework) : 0, // 0: React, 1: vue2, 2: jQuery, 3: vue3
@@ -100,10 +99,12 @@ const buildComponentData = async (assetsRoot, cmpInfo) => {
100
99
  description: modelInstance.description || '',
101
100
  componentCategory: (modelInstance.tags || ['自定义组件']).join(','),
102
101
  targetPage: (modelInstance.targetPage || ['customPage']).join(','),
102
+ targetDevice: (modelInstance.targetDevice || ['all']).join(','),
103
+ targetApplication: (modelInstance.targetApplication || ['all']).join(','),
103
104
  iconUrl: modelInstance.iconSrc,
104
105
  defaultProps: JSON.stringify(modelInstance.defaultComProps || {}),
105
106
  previewProps: JSON.stringify(modelInstance.previewComProps || {}),
106
- props: JSON.stringify(getPropsSchema(modelInstance.propsSchema || [])),
107
+ props: getPropsSchema(modelInstance.propsSchema || []),
107
108
  events: modelInstance.events || [],
108
109
  functions: modelInstance.functions || modelInstance.actions || [],
109
110
  // 如果模型实例中有其他属性,也可以添加
@@ -114,7 +115,7 @@ const buildComponentData = async (assetsRoot, cmpInfo) => {
114
115
  modelInstance.enableDuplicate !== undefined ? modelInstance.enableDuplicate : true
115
116
  };
116
117
 
117
- console.log(`自定义组件模型信息(${cmpType}):`, curCmpInfo);
118
+ console.log(`自定义组件模型信息(${cmpType}):`, _.omit(curCmpInfo, ['assetFile', 'modelAssetFile', 'cssAssetFile', 'codeLibFile']));
118
119
  return curCmpInfo;
119
120
  } catch (error) {
120
121
  errorLog(`自定义组件模型文件解析失败 (${modelFile || '未知路径'}): ${error.message}`);
@@ -1,7 +1,7 @@
1
1
  const { execSync } = require('child_process');
2
2
 
3
- // 所有需要废弃的版本(1.6.2 之前的所有版本)
4
- const versionsToDeprecate = ["1.7.10", "1.7.11", "1.7.12", "1.7.13"];
3
+ // 所有需要废弃的版本
4
+ const versionsToDeprecate = ["1.7.15-beta.1", "1.7.15", "1.7.12", "1.7.13"];
5
5
 
6
6
  const packageName = 'neo-cmp-cli';
7
7
  const deprecateMessage = '此版本为开发中版本(存在 bug),请升级到最新版本。';