cocos2d-cli 1.6.5 → 2.0.0

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 (61) hide show
  1. package/dist/bin/cocos2d-cli.js +64 -0
  2. package/dist/src/commands/add-component.js +3 -0
  3. package/dist/src/commands/add.js +3 -0
  4. package/dist/src/commands/build.js +6 -0
  5. package/dist/src/commands/create-scene.js +3 -0
  6. package/dist/src/commands/get.js +3 -0
  7. package/dist/src/commands/prefab-create.js +109 -0
  8. package/dist/src/commands/remove-component.js +3 -0
  9. package/dist/src/commands/remove.js +3 -0
  10. package/dist/src/commands/screenshot.js +41 -0
  11. package/dist/src/commands/set-component.js +3 -0
  12. package/dist/src/commands/set.js +3 -0
  13. package/dist/src/commands/tree.js +24 -0
  14. package/{src → dist/src}/lib/cc/CCButton.js +115 -122
  15. package/{src → dist/src}/lib/cc/CCCamera.js +83 -93
  16. package/{src → dist/src}/lib/cc/CCCanvas.js +49 -54
  17. package/{src → dist/src}/lib/cc/CCColor.js +30 -32
  18. package/{src → dist/src}/lib/cc/CCComponent.js +39 -60
  19. package/{src → dist/src}/lib/cc/CCLabel.js +139 -146
  20. package/{src → dist/src}/lib/cc/CCNode.js +190 -256
  21. package/{src → dist/src}/lib/cc/CCObject.js +19 -23
  22. package/{src → dist/src}/lib/cc/CCPrefab.js +219 -242
  23. package/{src → dist/src}/lib/cc/CCRect.js +30 -32
  24. package/{src → dist/src}/lib/cc/CCRichText.js +38 -44
  25. package/{src → dist/src}/lib/cc/CCScene.js +32 -42
  26. package/dist/src/lib/cc/CCSceneAsset.js +242 -0
  27. package/{src → dist/src}/lib/cc/CCSize.js +22 -26
  28. package/{src → dist/src}/lib/cc/CCSprite.js +82 -94
  29. package/{src → dist/src}/lib/cc/CCTrs.js +49 -74
  30. package/{src → dist/src}/lib/cc/CCVec2.js +22 -26
  31. package/{src → dist/src}/lib/cc/CCVec3.js +26 -29
  32. package/{src → dist/src}/lib/cc/CCWidget.js +94 -98
  33. package/dist/src/lib/fire-utils.js +86 -0
  34. package/dist/src/lib/json-parser.js +114 -0
  35. package/dist/src/lib/node-utils.js +131 -0
  36. package/{src → dist/src}/lib/screenshot-core.js +221 -285
  37. package/dist/src/lib/templates.js +17 -0
  38. package/dist/src/lib/utils.js +81 -0
  39. package/package.json +13 -6
  40. package/bin/cocos2d-cli.js +0 -152
  41. package/src/commands/add-component.js +0 -112
  42. package/src/commands/add.js +0 -177
  43. package/src/commands/build.js +0 -78
  44. package/src/commands/create-scene.js +0 -181
  45. package/src/commands/get.js +0 -108
  46. package/src/commands/prefab-create.js +0 -111
  47. package/src/commands/remove-component.js +0 -111
  48. package/src/commands/remove.js +0 -99
  49. package/src/commands/screenshot.js +0 -108
  50. package/src/commands/set-component.js +0 -119
  51. package/src/commands/set.js +0 -107
  52. package/src/commands/tree.js +0 -29
  53. package/src/lib/cc/CCSceneAsset.js +0 -303
  54. package/src/lib/cc/index.js +0 -42
  55. package/src/lib/fire-utils.js +0 -374
  56. package/src/lib/json-parser.js +0 -185
  57. package/src/lib/node-utils.js +0 -395
  58. package/src/lib/screenshot/favicon.ico +0 -0
  59. package/src/lib/screenshot/index.html +0 -30
  60. package/src/lib/templates.js +0 -49
  61. package/src/lib/utils.js +0 -202
@@ -1,108 +0,0 @@
1
- /**
2
- * get 命令 - 获取节点或组件属性
3
- */
4
-
5
- const path = require('path');
6
- const fs = require('fs');
7
- const { CCSceneAsset, CCPrefab } = require('../lib/cc');
8
-
9
- /**
10
- * 查找节点
11
- */
12
- function findNode(root, nodePath) {
13
- if (!nodePath) return root;
14
-
15
- const parts = nodePath.split('/').filter(p => p);
16
- if (parts.length === 0) return root;
17
-
18
- let current = root;
19
-
20
- if (parts[0] === root._name) {
21
- parts.shift();
22
- }
23
-
24
- for (const part of parts) {
25
- if (!current._children || current._children.length === 0) return null;
26
- const found = current._children.find(c => c._name === part);
27
- if (!found) return null;
28
- current = found;
29
- }
30
-
31
- return current;
32
- }
33
-
34
- /**
35
- * 查找组件
36
- */
37
- function findComponent(node, compType) {
38
- if (!node._components) return null;
39
-
40
- const type = compType.toLowerCase();
41
- const typeName = 'cc.' + type.charAt(0).toUpperCase() + type.slice(1);
42
-
43
- return node._components.find(c => c.__type__ === typeName);
44
- }
45
-
46
- function run(args) {
47
- if (args.length < 2) {
48
- console.log(JSON.stringify({ error: '用法: cocos2d-cli get <场景.fire|预制体.prefab> <节点路径> [属性名|组件类型]' }));
49
- return;
50
- }
51
-
52
- const filePath = args[0];
53
- const nodePath = args[1];
54
- const propOrComp = args[2];
55
-
56
- const ext = path.extname(filePath).toLowerCase();
57
-
58
- try {
59
- let root;
60
- const json = JSON.parse(fs.readFileSync(filePath, 'utf8'));
61
-
62
- if (ext === '.fire') {
63
- const asset = CCSceneAsset.fromJSON(json);
64
- root = asset._scene;
65
- } else if (ext === '.prefab') {
66
- const asset = CCPrefab.fromJSON(json);
67
- root = asset._root;
68
- } else {
69
- console.log(JSON.stringify({ error: '不支持的文件类型,仅支持 .fire 和 .prefab' }));
70
- return;
71
- }
72
-
73
- const node = findNode(root, nodePath);
74
-
75
- if (!node) {
76
- console.log(JSON.stringify({ error: `节点不存在: ${nodePath}` }));
77
- return;
78
- }
79
-
80
- // 没有指定属性或组件,返回节点所有属性
81
- if (!propOrComp) {
82
- const props = node.getProp ? node.getProp() : {};
83
- console.log(JSON.stringify(props, null, 2));
84
- return;
85
- }
86
-
87
- // 检查是否是组件类型
88
- const comp = findComponent(node, propOrComp);
89
- if (comp) {
90
- const props = comp.getProp ? comp.getProp() : {};
91
- console.log(JSON.stringify(props, null, 2));
92
- return;
93
- }
94
-
95
- // 返回节点的单个属性
96
- const nodeProps = node.getProp ? node.getProp() : {};
97
- if (nodeProps[propOrComp] !== undefined) {
98
- console.log(JSON.stringify({ [propOrComp]: nodeProps[propOrComp] }, null, 2));
99
- } else {
100
- console.log(JSON.stringify({ error: `属性不存在: ${propOrComp}` }));
101
- }
102
-
103
- } catch (err) {
104
- console.log(JSON.stringify({ error: err.message }));
105
- }
106
- }
107
-
108
- module.exports = { run };
@@ -1,111 +0,0 @@
1
- /**
2
- * prefab-create 命令 - 从 JSON 结构创建预制体文件
3
- */
4
-
5
- const fs = require('fs');
6
- const path = require('path');
7
- const { outputError } = require('../lib/utils');
8
- const { buildTree } = require('../lib/node-utils');
9
- const { createPrefab } = require('../lib/templates');
10
- const { CCPrefab, CCPrefabInfo } = require('../lib/cc');
11
- const { loadScriptMap, createPrefabMeta, saveMetaFile } = require('../lib/fire-utils');
12
- const { fromJSON } = require('../lib/json-parser');
13
-
14
- /**
15
- * 为节点树添加 PrefabInfo
16
- */
17
- function addPrefabInfo(node, isRoot = false) {
18
- node._prefab = new CCPrefabInfo();
19
-
20
- if (node._children) {
21
- node._children.forEach(child => addPrefabInfo(child, false));
22
- }
23
- }
24
-
25
- function run(args) {
26
- if (args.length < 1) {
27
- outputError({
28
- message: '用法: cocos2d-cli create-prefab [JSON文件路径] <输出路径.prefab>',
29
- hint: '不传 JSON 则创建默认预制体'
30
- });
31
- return;
32
- }
33
-
34
- let jsonPath = null;
35
- let outputPath;
36
-
37
- if (args.length === 1) {
38
- outputPath = args[0];
39
- } else {
40
- jsonPath = args[0];
41
- outputPath = args[1];
42
- }
43
-
44
- const prefabName = path.basename(outputPath, '.prefab');
45
-
46
- try {
47
- // 没有传 JSON,创建默认预制体
48
- if (!jsonPath) {
49
- if (fs.existsSync(outputPath)) {
50
- outputError(`文件已存在: ${outputPath}`);
51
- return;
52
- }
53
-
54
- const dir = path.dirname(outputPath);
55
- if (!fs.existsSync(dir)) {
56
- fs.mkdirSync(dir, { recursive: true });
57
- }
58
-
59
- const prefab = createPrefab(prefabName);
60
- const data = prefab.toJSON();
61
- fs.writeFileSync(outputPath, JSON.stringify(data, null, 2), 'utf8');
62
-
63
- // 生成并保存 meta 文件
64
- saveMetaFile(outputPath, createPrefabMeta());
65
-
66
- const scriptMap = loadScriptMap(outputPath);
67
- console.log(buildTree(data, scriptMap, 1).trim());
68
- return;
69
- }
70
-
71
- // 从 JSON 文件创建
72
- if (!fs.existsSync(jsonPath)) {
73
- outputError(`JSON 文件不存在: ${jsonPath}`);
74
- return;
75
- }
76
-
77
- const input = fs.readFileSync(jsonPath, 'utf8');
78
- const rootNode = fromJSON(input);
79
-
80
- // 确保根节点名称
81
- if (!rootNode._name || rootNode._name === 'Node') {
82
- rootNode._name = prefabName;
83
- }
84
-
85
- // 为所有节点添加 PrefabInfo
86
- addPrefabInfo(rootNode, true);
87
-
88
- // 创建预制体
89
- const prefab = new CCPrefab();
90
- prefab._root = rootNode;
91
-
92
- const outputDir = path.dirname(outputPath);
93
- if (!fs.existsSync(outputDir)) {
94
- fs.mkdirSync(outputDir, { recursive: true });
95
- }
96
-
97
- const data = prefab.toJSON();
98
- fs.writeFileSync(outputPath, JSON.stringify(data, null, 2), 'utf8');
99
-
100
- // 生成并保存 meta 文件
101
- saveMetaFile(outputPath, createPrefabMeta());
102
-
103
- const scriptMap = loadScriptMap(outputPath);
104
- console.log(buildTree(data, scriptMap, 1).trim());
105
-
106
- } catch (err) {
107
- outputError(err.message);
108
- }
109
- }
110
-
111
- module.exports = { run };
@@ -1,111 +0,0 @@
1
- /**
2
- * remove-component 命令 - 移除组件
3
- */
4
-
5
- const path = require('path');
6
- const fs = require('fs');
7
- const { CCSceneAsset, CCPrefab } = require('../lib/cc');
8
- const { buildTree } = require('../lib/node-utils');
9
- const { loadScriptMap, isPrefab } = require('../lib/fire-utils');
10
-
11
- /**
12
- * 查找节点
13
- */
14
- function findNode(root, path) {
15
- if (!path) return root;
16
-
17
- const parts = path.split('/').filter(p => p);
18
- if (parts.length === 0) return root;
19
-
20
- let current = root;
21
-
22
- if (parts[0] === root._name) {
23
- parts.shift();
24
- }
25
-
26
- for (const part of parts) {
27
- if (!current._children || current._children.length === 0) return null;
28
- const found = current._children.find(c => c._name === part);
29
- if (!found) return null;
30
- current = found;
31
- }
32
-
33
- return current;
34
- }
35
-
36
- /**
37
- * 查找组件
38
- */
39
- function findComponent(node, compType) {
40
- if (!node._components) return null;
41
-
42
- const type = compType.toLowerCase();
43
- const typeName = 'cc.' + type.charAt(0).toUpperCase() + type.slice(1);
44
-
45
- return node._components.find(c => c.__type__ === typeName);
46
- }
47
-
48
- function run(args) {
49
- if (args.length < 3) {
50
- console.log(JSON.stringify({ error: '用法: cocos2d-cli remove-component <场景.fire|预制体.prefab> <节点路径> <组件类型>' }));
51
- return;
52
- }
53
-
54
- const filePath = args[0];
55
- const nodePath = args[1];
56
- const compType = args[2];
57
-
58
- const ext = path.extname(filePath).toLowerCase();
59
-
60
- try {
61
- let root;
62
- let asset;
63
- const json = JSON.parse(fs.readFileSync(filePath, 'utf8'));
64
-
65
- if (ext === '.fire') {
66
- asset = CCSceneAsset.fromJSON(json);
67
- root = asset._scene;
68
- } else if (ext === '.prefab') {
69
- asset = CCPrefab.fromJSON(json);
70
- root = asset._root;
71
- } else {
72
- console.log(JSON.stringify({ error: '不支持的文件类型,仅支持 .fire 和 .prefab' }));
73
- return;
74
- }
75
-
76
- const node = findNode(root, nodePath);
77
-
78
- if (!node) {
79
- console.log(JSON.stringify({ error: `节点不存在: ${nodePath}` }));
80
- return;
81
- }
82
-
83
- const comp = findComponent(node, compType);
84
-
85
- if (!comp) {
86
- console.log(JSON.stringify({ error: `组件不存在: ${compType}` }));
87
- return;
88
- }
89
-
90
- // 移除组件
91
- const idx = node._components.indexOf(comp);
92
- if (idx > -1) {
93
- node._components.splice(idx, 1);
94
- }
95
-
96
- // 保存
97
- const data = asset.toJSON();
98
- fs.writeFileSync(filePath, JSON.stringify(data, null, 2), 'utf8');
99
-
100
- // 输出节点树
101
- const scriptMap = loadScriptMap(filePath);
102
- const prefab = isPrefab(data);
103
- const startIndex = prefab ? 0 : 1;
104
- console.log(buildTree(data, scriptMap, startIndex).trim());
105
-
106
- } catch (err) {
107
- console.log(JSON.stringify({ error: err.message }));
108
- }
109
- }
110
-
111
- module.exports = { run };
@@ -1,99 +0,0 @@
1
- /**
2
- * remove 命令 - 删除节点
3
- */
4
-
5
- const path = require('path');
6
- const fs = require('fs');
7
- const { CCSceneAsset, CCPrefab } = require('../lib/cc');
8
- const { buildTree } = require('../lib/node-utils');
9
- const { loadScriptMap, isPrefab } = require('../lib/fire-utils');
10
-
11
- /**
12
- * 查找节点
13
- */
14
- function findNode(root, path) {
15
- if (!path) return root;
16
-
17
- const parts = path.split('/').filter(p => p);
18
- if (parts.length === 0) return root;
19
-
20
- let current = root;
21
-
22
- if (parts[0] === root._name) {
23
- parts.shift();
24
- }
25
-
26
- for (const part of parts) {
27
- if (!current._children || current._children.length === 0) return null;
28
- const found = current._children.find(c => c._name === part);
29
- if (!found) return null;
30
- current = found;
31
- }
32
-
33
- return current;
34
- }
35
-
36
- function run(args) {
37
- if (args.length < 2) {
38
- console.log(JSON.stringify({ error: '用法: cocos2d-cli remove <场景.fire|预制体.prefab> <节点路径>' }));
39
- return;
40
- }
41
-
42
- const filePath = args[0];
43
- const nodePath = args[1];
44
-
45
- const ext = path.extname(filePath).toLowerCase();
46
-
47
- try {
48
- let root;
49
- let asset;
50
- const json = JSON.parse(fs.readFileSync(filePath, 'utf8'));
51
-
52
- if (ext === '.fire') {
53
- asset = CCSceneAsset.fromJSON(json);
54
- root = asset._scene;
55
- } else if (ext === '.prefab') {
56
- asset = CCPrefab.fromJSON(json);
57
- root = asset._root;
58
- } else {
59
- console.log(JSON.stringify({ error: '不支持的文件类型,仅支持 .fire 和 .prefab' }));
60
- return;
61
- }
62
-
63
- const node = findNode(root, nodePath);
64
-
65
- if (!node) {
66
- console.log(JSON.stringify({ error: `节点不存在: ${nodePath}` }));
67
- return;
68
- }
69
-
70
- // 不能删除根节点
71
- if (node === root) {
72
- console.log(JSON.stringify({ error: '不能删除根节点' }));
73
- return;
74
- }
75
-
76
- // 从父节点移除
77
- if (node._parent) {
78
- const idx = node._parent._children.indexOf(node);
79
- if (idx > -1) {
80
- node._parent._children.splice(idx, 1);
81
- }
82
- }
83
-
84
- // 保存
85
- const data = asset.toJSON();
86
- fs.writeFileSync(filePath, JSON.stringify(data, null, 2), 'utf8');
87
-
88
- // 输出节点树
89
- const scriptMap = loadScriptMap(filePath);
90
- const prefab = isPrefab(data);
91
- const startIndex = prefab ? 0 : 1;
92
- console.log(buildTree(data, scriptMap, startIndex).trim());
93
-
94
- } catch (err) {
95
- console.log(JSON.stringify({ error: err.message }));
96
- }
97
- }
98
-
99
- module.exports = { run };
@@ -1,108 +0,0 @@
1
- /**
2
- * screenshot 命令
3
- * 渲染 JSON 数据并截图
4
- */
5
-
6
- const path = require('path');
7
- const { takeScreenshot } = require('../lib/screenshot-core');
8
-
9
- function showHelp() {
10
- console.log(`
11
- 用法:
12
- cocos2d-cli screenshot <json文件> [选项]
13
-
14
- 选项:
15
- -o, --output <目录> 输出目录,默认当前目录
16
- --width <数值> 视口宽度,默认 750(不支持简写)
17
- --height <数值> 视口高度,默认 1334(不支持简写)
18
- --full-page 全页截图(默认)
19
- --no-full-page 仅视口截图
20
- --debug-bounds 叠加节点边界框和名称,方便定位布局问题
21
- --timeout <毫秒> 页面加载超时,默认 30000
22
- --wait <毫秒> 截图前等待时间,默认 1000
23
-
24
- 示例:
25
- cocos2d-cli screenshot data.json
26
- cocos2d-cli screenshot data.json -o ./screenshots
27
- cocos2d-cli screenshot data.json --width 1080 --height 1920
28
- cocos2d-cli screenshot data.json --debug-bounds
29
- cocos2d-cli screenshot data.json --no-full-page
30
- `);
31
- }
32
-
33
- function parseArgs(args) {
34
- const options = {
35
- jsonPath: null,
36
- outputDir: '.',
37
- viewport: { width: 750, height: 1334 },
38
- fullPage: true,
39
- debugBounds: false,
40
- timeout: 30000,
41
- waitTime: 1000
42
- };
43
-
44
- let i = 0;
45
- while (i < args.length) {
46
- const arg = args[i];
47
-
48
- if (arg === '--help' || arg === '-h') {
49
- showHelp();
50
- process.exit(0);
51
- }
52
-
53
- if (arg === '-o' || arg === '--output') {
54
- options.outputDir = args[++i];
55
- } else if (arg === '--width') {
56
- options.viewport.width = parseInt(args[++i], 10);
57
- } else if (arg === '--height') {
58
- options.viewport.height = parseInt(args[++i], 10);
59
- } else if (arg === '--full-page') {
60
- options.fullPage = true;
61
- } else if (arg === '--no-full-page') {
62
- options.fullPage = false;
63
- } else if (arg === '--debug-bounds') {
64
- options.debugBounds = true;
65
- } else if (arg === '--timeout') {
66
- options.timeout = parseInt(args[++i], 10);
67
- } else if (arg === '--wait') {
68
- options.waitTime = parseInt(args[++i], 10);
69
- } else if (!arg.startsWith('-')) {
70
- options.jsonPath = arg;
71
- }
72
-
73
- i++;
74
- }
75
-
76
- return options;
77
- }
78
-
79
- async function run(args) {
80
- const options = parseArgs(args);
81
-
82
- if (!options.jsonPath) {
83
- console.error('错误: 请指定 JSON 文件路径');
84
- showHelp();
85
- process.exit(1);
86
- }
87
-
88
- options.jsonPath = path.resolve(options.jsonPath);
89
- options.outputDir = path.resolve(options.outputDir);
90
-
91
- try {
92
- const result = await takeScreenshot(options);
93
- const filename = path.basename(result.screenshotPath);
94
- console.log(JSON.stringify({
95
- success: true,
96
- filename: filename
97
- }));
98
- } catch (error) {
99
- console.log(JSON.stringify({
100
- success: false,
101
- error: error.message,
102
- logDir: error.logDir || null
103
- }));
104
- process.exit(1);
105
- }
106
- }
107
-
108
- module.exports = { run };
@@ -1,119 +0,0 @@
1
- /**
2
- * set-component 命令 - 设置组件属性
3
- */
4
-
5
- const path = require('path');
6
- const fs = require('fs');
7
- const { CCSceneAsset, CCPrefab } = require('../lib/cc');
8
- const { buildTree } = require('../lib/node-utils');
9
- const { loadScriptMap, isPrefab } = require('../lib/fire-utils');
10
-
11
- /**
12
- * 查找节点
13
- */
14
- function findNode(root, nodePath) {
15
- if (!nodePath) return root;
16
-
17
- const parts = nodePath.split('/').filter(p => p);
18
- if (parts.length === 0) return root;
19
-
20
- let current = root;
21
-
22
- if (parts[0] === root._name) {
23
- parts.shift();
24
- }
25
-
26
- for (const part of parts) {
27
- if (!current._children || current._children.length === 0) return null;
28
- const found = current._children.find(c => c._name === part);
29
- if (!found) return null;
30
- current = found;
31
- }
32
-
33
- return current;
34
- }
35
-
36
- /**
37
- * 查找组件
38
- */
39
- function findComponent(node, compType) {
40
- if (!node._components) return null;
41
-
42
- const type = compType.toLowerCase();
43
- const typeName = 'cc.' + type.charAt(0).toUpperCase() + type.slice(1);
44
-
45
- return node._components.find(c => c.__type__ === typeName);
46
- }
47
-
48
- function run(args) {
49
- if (args.length < 4) {
50
- console.log(JSON.stringify({
51
- error: '用法: cocos2d-cli set-component <场景.fire|预制体.prefab> <节点路径> <组件类型> <属性名> <值>'
52
- }));
53
- return;
54
- }
55
-
56
- const filePath = args[0];
57
- const nodePath = args[1];
58
- const compType = args[2];
59
- const prop = args[3];
60
- const value = args[4];
61
-
62
- const ext = path.extname(filePath).toLowerCase();
63
-
64
- try {
65
- let root;
66
- let asset;
67
- const json = JSON.parse(fs.readFileSync(filePath, 'utf8'));
68
-
69
- if (ext === '.fire') {
70
- asset = CCSceneAsset.fromJSON(json);
71
- root = asset._scene;
72
- } else if (ext === '.prefab') {
73
- asset = CCPrefab.fromJSON(json);
74
- root = asset._root;
75
- } else {
76
- console.log(JSON.stringify({ error: '不支持的文件类型,仅支持 .fire 和 .prefab' }));
77
- return;
78
- }
79
-
80
- const node = findNode(root, nodePath);
81
-
82
- if (!node) {
83
- console.log(JSON.stringify({ error: `节点不存在: ${nodePath}` }));
84
- return;
85
- }
86
-
87
- const comp = findComponent(node, compType);
88
-
89
- if (!comp) {
90
- console.log(JSON.stringify({ error: `组件不存在: ${compType}` }));
91
- return;
92
- }
93
-
94
- // 调用组件的 setProp 方法
95
- if (typeof comp.setProp !== 'function') {
96
- console.log(JSON.stringify({ error: '组件不支持 setProp 方法' }));
97
- return;
98
- }
99
-
100
- // 构造属性对象并调用 setProp
101
- const props = { [prop]: value };
102
- comp.setProp(props);
103
-
104
- // 保存
105
- const data = asset.toJSON();
106
- fs.writeFileSync(filePath, JSON.stringify(data, null, 2), 'utf8');
107
-
108
- // 输出节点树
109
- const scriptMap = loadScriptMap(filePath);
110
- const prefab = isPrefab(data);
111
- const startIndex = prefab ? 0 : 1;
112
- console.log(buildTree(data, scriptMap, startIndex).trim());
113
-
114
- } catch (err) {
115
- console.log(JSON.stringify({ error: err.message }));
116
- }
117
- }
118
-
119
- module.exports = { run };