engine7 7.1.9 → 7.1.10
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/cli.mjs +8 -24
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -208,16 +208,11 @@ async function doExport(opts) {
|
|
|
208
208
|
note
|
|
209
209
|
};
|
|
210
210
|
fs.writeFileSync(path.join(stagingDir, "manifest.json"), JSON.stringify(manifest, null, 2));
|
|
211
|
-
const archiveFile = path.join(tmpDir, `${agentName}-${version}.
|
|
211
|
+
const archiveFile = path.join(tmpDir, `${agentName}-${version}.tar.gz`);
|
|
212
212
|
console.log(`
|
|
213
213
|
\u{1F5DC}\uFE0F \u6253\u5305\u4E2D...`);
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
const childName = path.basename(stagingDir);
|
|
217
|
-
execSync(`powershell -Command "Compress-Archive -Path '${stagingParent}/${childName}' -DestinationPath '${archiveFile}' -Force"`, { stdio: "pipe" });
|
|
218
|
-
} else {
|
|
219
|
-
execSync(`cd "${tmpDir}" && zip -r -q "${archiveFile}" ${agentName}`, { stdio: "pipe" });
|
|
220
|
-
}
|
|
214
|
+
const tarExe = process.platform === "win32" ? "C:\\Windows\\System32\\tar.exe" : "tar";
|
|
215
|
+
execSync(`"${tarExe}" -czf "${archiveFile}" -C "${tmpDir}" ${agentName}`, { stdio: "pipe" });
|
|
221
216
|
const archiveSize = fs.statSync(archiveFile).size;
|
|
222
217
|
console.log(`\u2705 \u6253\u5305\u5B8C\u6210: ${archiveFile} (${(archiveSize / 1024 / 1024).toFixed(1)} MB, ${fileCount} \u6587\u4EF6)`);
|
|
223
218
|
const cfg = loadTravelConfig();
|
|
@@ -251,19 +246,8 @@ async function doImport(opts) {
|
|
|
251
246
|
return;
|
|
252
247
|
}
|
|
253
248
|
console.log(`\u{1F4C2} \u89E3\u5305\u4E2D...`);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
execSync(`tar -xzf "${archiveFile}" -C "${tmpDir}"`, { stdio: "pipe" });
|
|
257
|
-
} else {
|
|
258
|
-
execSync(`tar -xzf "${archiveFile}" -C "${tmpDir}"`, { stdio: "pipe" });
|
|
259
|
-
}
|
|
260
|
-
} else {
|
|
261
|
-
if (process.platform === "win32") {
|
|
262
|
-
execSync(`powershell -Command "Expand-Archive -Path '${archiveFile}' -DestinationPath '${tmpDir}' -Force"`, { stdio: "pipe" });
|
|
263
|
-
} else {
|
|
264
|
-
execSync(`unzip -q -o "${archiveFile}" -d "${tmpDir}"`, { stdio: "pipe" });
|
|
265
|
-
}
|
|
266
|
-
}
|
|
249
|
+
const tarExe = process.platform === "win32" ? "C:\\Windows\\System32\\tar.exe" : "tar";
|
|
250
|
+
execSync(`"${tarExe}" -xzf "${archiveFile}" -C "${tmpDir}"`, { stdio: "pipe" });
|
|
267
251
|
const stagingDir = path.join(tmpDir, agentName);
|
|
268
252
|
const manifestPath = path.join(stagingDir, "manifest.json");
|
|
269
253
|
if (!fs.existsSync(manifestPath)) {
|
|
@@ -345,7 +329,7 @@ async function uploadToGitHub(cfg, archiveFile, agentName, version, manifest) {
|
|
|
345
329
|
headers: {
|
|
346
330
|
"Authorization": `Bearer ${cfg.githubToken}`,
|
|
347
331
|
"Accept": "application/vnd.github+json",
|
|
348
|
-
"Content-Type": "application/
|
|
332
|
+
"Content-Type": "application/gzip",
|
|
349
333
|
"Content-Length": String(fileBuffer.length)
|
|
350
334
|
},
|
|
351
335
|
body: fileBuffer
|
|
@@ -380,9 +364,9 @@ async function downloadFromGitHub(cfg, agentName, version, destDir) {
|
|
|
380
364
|
throw new Error(`\u83B7\u53D6 release \u5931\u8D25: ${res.status}`);
|
|
381
365
|
}
|
|
382
366
|
const release = await res.json();
|
|
383
|
-
const asset = release.assets?.find((a) => a.name.endsWith(".
|
|
367
|
+
const asset = release.assets?.find((a) => a.name.endsWith(".tar.gz") || a.name.endsWith(".zip"));
|
|
384
368
|
if (!asset) {
|
|
385
|
-
throw new Error(`release ${tag} \u6CA1\u6709
|
|
369
|
+
throw new Error(`release ${tag} \u6CA1\u6709 tar.gz/zip asset`);
|
|
386
370
|
}
|
|
387
371
|
const downloadRes = await fetch(asset.url, {
|
|
388
372
|
headers: {
|