star-sdk-cli 0.1.20 → 0.1.21
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 +22 -12
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -1777,26 +1777,36 @@ async function deployCommand(dirPath) {
|
|
|
1777
1777
|
}
|
|
1778
1778
|
log(`Deploying ${colors.bright}${config.name}${colors.reset} from ${colors.dim}${deployDir}${colors.reset}`);
|
|
1779
1779
|
try {
|
|
1780
|
+
let addDir2 = function(dir, prefix) {
|
|
1781
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
1782
|
+
if (IGNORE.has(entry.name)) continue;
|
|
1783
|
+
const full = path.join(dir, entry.name);
|
|
1784
|
+
const zipPath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
1785
|
+
if (entry.isDirectory()) {
|
|
1786
|
+
addDir2(full, zipPath);
|
|
1787
|
+
} else if (entry.name !== "index.html") {
|
|
1788
|
+
zipfile.addFile(full, zipPath);
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
};
|
|
1792
|
+
var addDir = addDir2;
|
|
1780
1793
|
const originalHtml = fs.readFileSync(indexPath, "utf-8");
|
|
1781
1794
|
const processedHtml = injectImportMapIfNeeded(originalHtml, deployDir);
|
|
1782
1795
|
const htmlModified = processedHtml !== originalHtml;
|
|
1783
1796
|
if (htmlModified) {
|
|
1784
1797
|
info("Injected importmap for bare imports (star-sdk \u2192 esm.sh)");
|
|
1785
1798
|
}
|
|
1786
|
-
const
|
|
1799
|
+
const { ZipFile } = await import("yazl");
|
|
1800
|
+
const zipfile = new ZipFile();
|
|
1801
|
+
const IGNORE = /* @__PURE__ */ new Set(["node_modules", ".starrc", ".git", ".DS_Store"]);
|
|
1802
|
+
addDir2(deployDir, "");
|
|
1803
|
+
zipfile.addBuffer(Buffer.from(processedHtml, "utf-8"), "index.html");
|
|
1804
|
+
zipfile.end();
|
|
1787
1805
|
const zipBuffer = await new Promise((resolve2, reject) => {
|
|
1788
1806
|
const chunks = [];
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
archive.on("error", reject);
|
|
1793
|
-
archive.glob("**/*", {
|
|
1794
|
-
cwd: deployDir,
|
|
1795
|
-
ignore: ["node_modules/**", ".starrc", ".git/**", ".DS_Store", "index.html"],
|
|
1796
|
-
dot: false
|
|
1797
|
-
});
|
|
1798
|
-
archive.append(processedHtml, { name: "index.html" });
|
|
1799
|
-
archive.finalize();
|
|
1807
|
+
zipfile.outputStream.on("data", (chunk) => chunks.push(chunk));
|
|
1808
|
+
zipfile.outputStream.on("end", () => resolve2(Buffer.concat(chunks)));
|
|
1809
|
+
zipfile.outputStream.on("error", reject);
|
|
1800
1810
|
});
|
|
1801
1811
|
log(` ${colors.dim}Uploading ${(zipBuffer.length / 1024).toFixed(1)} KB...${colors.reset}`);
|
|
1802
1812
|
const response = await fetch(`${API_BASE}/api/sdk/games/${config.gameId}/deploy`, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "star-sdk-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "CLI for Star SDK — register games, install AI docs, and deploy to Star hosting",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"hosting"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"
|
|
41
|
+
"yazl": "^3.3.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@types/
|
|
44
|
+
"@types/yazl": "^3.3.0",
|
|
45
45
|
"tsup": "^8.0.0",
|
|
46
46
|
"tsx": "^4.7.0",
|
|
47
47
|
"typescript": "^5.4.5"
|