-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-task.js
More file actions
38 lines (31 loc) · 1.19 KB
/
Copy pathrun-task.js
File metadata and controls
38 lines (31 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* eslint-disable no-undef */
import { execSync } from "child_process";
import { argv, platform, exit } from "process";
import chalk from "chalk"; // Default import
const task = argv[2]; // 'bundle' or 'serve-rojo'
const isWindows = platform === "win32";
const commands = {
bundle: isWindows
? "npx rbxtsc && .\\bin\\wax.exe bundle input=.\\default.project.json output=.\\bundle\\out\\bundle.client.luau minify=true"
: "npx rbxtsc && wine ./bin/wax.exe bundle input=./default.project.json output=./bundle/out/bundle.client.luau minify=true",
"serve-rojo": isWindows
? ".\\bin\\rojo.exe serve .\\bundle --address 0.0.0.0"
: "wine ./bin/rojo.exe serve ./bundle --address 0.0.0.0",
};
if (!commands[task]) {
console.error(chalk.red.bold(`\n✖ Unknown task: "${task}". Use "bundle" or "serve-rojo".\n`));
exit(1);
}
try {
execSync(commands[task], { stdio: "inherit" });
if (task === "bundle") {
console.log(chalk.green.bold("\n✔ Project bundled successfully\n"));
}
} catch (err) {
if (task === "bundle") {
console.error(chalk.red.bold("\n✖ Error during the compiling/bundling process\n"));
} else {
console.error(chalk.red.bold(`\n✖ Failed to run task: ${task}\n`));
}
exit(1);
}