mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-14 20:51:07 +01:00
FEAT: add new script createSymlink
FEAT: add new file tools/create-symlink.mjs FEAT: add d.ts files FIX: add new foundry symlink to .gitignore
This commit is contained in:
parent
eaef0767d3
commit
b1be109400
5 changed files with 77 additions and 2 deletions
52
tools/create-symlink.mjs
Normal file
52
tools/create-symlink.mjs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
import readline from "readline";
|
||||
|
||||
console.log("Reforging Symlinks");
|
||||
|
||||
const askQuestion = (question) => {
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
});
|
||||
|
||||
return new Promise((resolve) =>
|
||||
rl.question(question, (answer) => {
|
||||
rl.close();
|
||||
resolve(answer);
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
const installPath = await askQuestion("Enter your Foundry install path: ");
|
||||
|
||||
// Determine if it's an Electron install (nested structure)
|
||||
const nested = fs.existsSync(path.join(installPath, "resources", "app"));
|
||||
const fileRoot = nested
|
||||
? path.join(installPath, "resources", "app")
|
||||
: installPath;
|
||||
|
||||
try {
|
||||
await fs.promises.mkdir("foundry");
|
||||
} catch (e) {
|
||||
if (e.code !== "EEXIST") throw e;
|
||||
}
|
||||
|
||||
// JavaScript files
|
||||
for (const p of ["client", "common", "tsconfig.json"]) {
|
||||
try {
|
||||
await fs.promises.symlink(path.join(fileRoot, p), path.join("foundry", p));
|
||||
} catch (e) {
|
||||
if (e.code !== "EEXIST") throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// Language files
|
||||
try {
|
||||
await fs.promises.symlink(
|
||||
path.join(fileRoot, "public", "lang"),
|
||||
path.join("foundry", "lang")
|
||||
);
|
||||
} catch (e) {
|
||||
if (e.code !== "EEXIST") throw e;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue