2024-01-02 16:31:30 +00:00
|
|
|
"use strict";
|
|
|
|
|
2024-10-01 23:55:24 +00:00
|
|
|
import { promisify } from "util";
|
|
|
|
import fs from "fs";
|
|
|
|
import path from "path";
|
|
|
|
import child_process from "child_process";
|
|
|
|
|
|
|
|
// HACK: Make sure __dirname is defined when using es6 modules. I forget where I found this - a PR with a source URL would be great!
|
|
|
|
const __dirname = import.meta.url.slice(7, import.meta.url.lastIndexOf("/"));
|
2024-01-02 16:31:30 +00:00
|
|
|
|
|
|
|
const filepath_moondoc = path.resolve(__dirname, `../node_modules/.bin/moondoc`);
|
|
|
|
const dirpath_root = path.resolve(__dirname, `../..`);
|
|
|
|
|
2024-10-01 23:55:24 +00:00
|
|
|
export default function moondoc_runner(filepath_output) {
|
2024-01-02 16:31:30 +00:00
|
|
|
const dirpath = path.dirname(filepath_output);
|
|
|
|
if(!fs.existsSync(dirpath)) {
|
|
|
|
fs.mkdirSync(dirpath, { recursive: true });
|
|
|
|
}
|
|
|
|
|
|
|
|
child_process.execFileSync(filepath_moondoc, [
|
|
|
|
"build",
|
|
|
|
"--input", dirpath_root,
|
2024-01-02 17:05:06 +00:00
|
|
|
"--output", filepath_output,
|
2024-10-16 00:22:01 +00:00
|
|
|
"--branch", "dev",
|
|
|
|
"--name", "WorldEditAditions"
|
2024-01-02 16:31:30 +00:00
|
|
|
]);
|
|
|
|
}
|