@ttmg/cli 0.3.1-unity.7 → 0.3.1-unity.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.
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/public/assets/index-B_lMekya.js +67 -0
- package/dist/public/assets/index-B_lMekya.js.br +0 -0
- package/dist/public/assets/index-D51pZ7N1.css +1 -0
- package/dist/public/assets/index-D51pZ7N1.css.br +0 -0
- package/dist/public/assets/index-O0TENe77.js +67 -0
- package/dist/public/assets/index-O0TENe77.js.br +0 -0
- package/dist/public/index.html +1 -1
- package/dist/scripts/worker.js +27 -7
- package/package.json +1 -1
|
Binary file
|
package/dist/public/index.html
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
rel="stylesheet"
|
|
13
13
|
/>
|
|
14
14
|
<title>TikTok Mini Games DevTool</title>
|
|
15
|
-
<script type="module" crossorigin src="/assets/index-
|
|
15
|
+
<script type="module" crossorigin src="/assets/index-O0TENe77.js"></script>
|
|
16
16
|
<link rel="stylesheet" crossorigin href="/assets/index-sCifET6h.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body>
|
package/dist/scripts/worker.js
CHANGED
|
@@ -83,12 +83,12 @@ async function compile(context = {}) {
|
|
|
83
83
|
chalk.yellow.underline(outputDir),
|
|
84
84
|
),
|
|
85
85
|
);
|
|
86
|
-
if (outputDir
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
86
|
+
// if (outputDir) {
|
|
87
|
+
// if (fs.existsSync(outputDir)) {
|
|
88
|
+
// fs.rmSync(outputDir, { recursive: true, force: true });
|
|
89
|
+
// }
|
|
90
|
+
// fs.mkdirSync(outputDir, { recursive: true });
|
|
91
|
+
// }
|
|
92
92
|
} catch (e) {
|
|
93
93
|
// 目录操作失败也上报
|
|
94
94
|
parentPort?.postMessage({
|
|
@@ -100,10 +100,21 @@ async function compile(context = {}) {
|
|
|
100
100
|
|
|
101
101
|
parentPort?.postMessage({ type: 'status', status: 'start' });
|
|
102
102
|
|
|
103
|
+
const outputTempDir = path.join(
|
|
104
|
+
entryDir,
|
|
105
|
+
'__TTMG_TEMP__',
|
|
106
|
+
clientKey + '_compile_' + Date.now().toString(),
|
|
107
|
+
);
|
|
108
|
+
console.log(
|
|
109
|
+
chalk(
|
|
110
|
+
`🔍 Game local debug assets temp directory`,
|
|
111
|
+
chalk.yellow.underline(outputTempDir),
|
|
112
|
+
),
|
|
113
|
+
);
|
|
103
114
|
// 调用打包
|
|
104
115
|
const { isSuccess, errorMsg, packages } = await debugPkgs({
|
|
105
116
|
entry: entryDir,
|
|
106
|
-
output:
|
|
117
|
+
output: outputTempDir,
|
|
107
118
|
dev: {
|
|
108
119
|
enable: true,
|
|
109
120
|
port: devPort,
|
|
@@ -122,6 +133,15 @@ async function compile(context = {}) {
|
|
|
122
133
|
// spawnOptions: { stdio: ['ignore', 'pipe', 'pipe'] },
|
|
123
134
|
// concurrency: 4,
|
|
124
135
|
});
|
|
136
|
+
if (fs.existsSync(outputDir)) {
|
|
137
|
+
// 删除旧输出目录
|
|
138
|
+
fs.rmSync(outputDir, { recursive: true, force: true });
|
|
139
|
+
// 复制临时目录到输出目录
|
|
140
|
+
// 直接替换 outputDir 内容,避免生成 __TTMG_TEMP__ 子目录
|
|
141
|
+
fs.cpSync(outputTempDir, outputDir, { recursive: true });
|
|
142
|
+
// 删除临时目录
|
|
143
|
+
fs.rmSync(outputTempDir, { recursive: true, force: true });
|
|
144
|
+
}
|
|
125
145
|
if (fs.existsSync(path.join(outputDir, '__TTMG_TEMP__'))) {
|
|
126
146
|
fs.rmSync(path.join(outputDir, '__TTMG_TEMP__'), {
|
|
127
147
|
recursive: true,
|