@ttmg/cli 0.1.0-beta.11 → 0.1.0-beta.12
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/CHANGELOG.md +4 -0
- package/dist/index.js +35 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1119,6 +1119,39 @@ async function prepareResource() {
|
|
|
1119
1119
|
}
|
|
1120
1120
|
}
|
|
1121
1121
|
|
|
1122
|
+
// import { uploadGame } from './uploadGame';
|
|
1123
|
+
async function watchChange() {
|
|
1124
|
+
let debounceTimer = null;
|
|
1125
|
+
fs.watch(process.cwd(), (eventType, filename) => {
|
|
1126
|
+
console.log(chalk.yellow('game resource change, restart to upload'));
|
|
1127
|
+
// 清除之前的定时器
|
|
1128
|
+
if (debounceTimer)
|
|
1129
|
+
clearTimeout(debounceTimer);
|
|
1130
|
+
// 重新设置定时器
|
|
1131
|
+
debounceTimer = setTimeout(async () => {
|
|
1132
|
+
await prepareResource();
|
|
1133
|
+
wsServer.send({
|
|
1134
|
+
method: 'resourceChange',
|
|
1135
|
+
});
|
|
1136
|
+
// TODO:只做文件预准备,但不主动上传
|
|
1137
|
+
// uploadGame()
|
|
1138
|
+
// .then((res) => {
|
|
1139
|
+
// if (res.isSuccess) {
|
|
1140
|
+
// wsServer.sendUploadStatus('success');
|
|
1141
|
+
// } else {
|
|
1142
|
+
// wsServer.sendUploadStatus('error', {
|
|
1143
|
+
// errMsg: res.errorMsg,
|
|
1144
|
+
// });
|
|
1145
|
+
// }
|
|
1146
|
+
// })
|
|
1147
|
+
// .catch(() => {
|
|
1148
|
+
// wsServer.sendUploadStatus('error');
|
|
1149
|
+
// });
|
|
1150
|
+
debounceTimer = null;
|
|
1151
|
+
}, 500); // 500ms内只执行一次
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1122
1155
|
async function showSchema() {
|
|
1123
1156
|
const clientKey = getClientKey();
|
|
1124
1157
|
const outputDir = path.join(OUTPUT_DIR, clientKey);
|
|
@@ -1151,10 +1184,10 @@ async function dev() {
|
|
|
1151
1184
|
/**
|
|
1152
1185
|
* 4. 监听游戏资源变化
|
|
1153
1186
|
*/
|
|
1154
|
-
|
|
1187
|
+
await watchChange();
|
|
1155
1188
|
}
|
|
1156
1189
|
|
|
1157
|
-
var version = "0.1.0-beta.
|
|
1190
|
+
var version = "0.1.0-beta.12";
|
|
1158
1191
|
var pkg = {
|
|
1159
1192
|
version: version};
|
|
1160
1193
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttmg/cli",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.12",
|
|
4
4
|
"description": "TikTok Mini Game Command Line Tool",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"bin": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"open": "^10.2.0",
|
|
42
42
|
"prettier": "^3.6.2",
|
|
43
43
|
"qrcode-terminal": "^0.12.0",
|
|
44
|
-
"ttmg-pack": "0.0.
|
|
44
|
+
"ttmg-pack": "^0.0.19",
|
|
45
45
|
"ws": "^8.18.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|