Spaces:
Running
Running
Create generate_html.js
Browse files- generate_html.js +25 -0
generate_html.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// generate_html.js
|
| 2 |
+
import { packProject } from "@turbowarp/packager";
|
| 3 |
+
import fs from "fs";
|
| 4 |
+
|
| 5 |
+
const projectId = process.argv[2];
|
| 6 |
+
const optionsFile = process.argv[3];
|
| 7 |
+
|
| 8 |
+
async function main() {
|
| 9 |
+
if (!projectId) {
|
| 10 |
+
console.error("Project ID is required.");
|
| 11 |
+
process.exit(1);
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
const options = optionsFile ? JSON.parse(fs.readFileSync(optionsFile, "utf8")) : {};
|
| 15 |
+
|
| 16 |
+
try {
|
| 17 |
+
const html = await packProject(projectId, options);
|
| 18 |
+
console.log(html);
|
| 19 |
+
} catch (err) {
|
| 20 |
+
console.error(err);
|
| 21 |
+
process.exit(1);
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
main();
|