scripts / build.mjs
import fs from "fs-extra";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Copy the bundled operations script next to the compiled plugin so it can be
// invoked by path relative to dist/.
try {
fs.ensureDirSync(path.join(__dirname, "..", "dist", "scripts"));
fs.copyFileSync(
path.join(__dirname, "..", "src", "scripts", "godot_operations.gd"),
path.join(__dirname, "..", "dist", "scripts", "godot_operations.gd")
);
console.log("Successfully copied godot_operations.gd to dist/scripts");
} catch (error) {
console.error("Error copying scripts:", error);
process.exit(1);
}
// Make the entry point executable.
try {
fs.chmodSync(path.join(__dirname, "..", "dist", "index.js"), "755");
} catch (error) {
console.warn("Could not chmod index.js:", error);
}
console.log("Build scripts completed successfully!");
scripts / build.mjs
import fs from "fs-extra";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Copy the bundled operations script next to the compiled plugin so it can be
// invoked by path relative to dist/.
try {
fs.ensureDirSync(path.join(__dirname, "..", "dist", "scripts"));
fs.copyFileSync(
path.join(__dirname, "..", "src", "scripts", "godot_operations.gd"),
path.join(__dirname, "..", "dist", "scripts", "godot_operations.gd")
);
console.log("Successfully copied godot_operations.gd to dist/scripts");
} catch (error) {
console.error("Error copying scripts:", error);
process.exit(1);
}
// Make the entry point executable.
try {
fs.chmodSync(path.join(__dirname, "..", "dist", "index.js"), "755");
} catch (error) {
console.warn("Could not chmod index.js:", error);
}
console.log("Build scripts completed successfully!");