mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
* FEAT: add jsconfig.json file * 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 --------- Co-authored-by: Joaquin Pereyra <joaquinpereyra98@users.noreply.github.com>
This commit is contained in:
parent
d30ae91109
commit
879299b661
6 changed files with 92 additions and 2 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -2,4 +2,5 @@
|
|||
node_modules
|
||||
/packs
|
||||
Build
|
||||
/build
|
||||
/build
|
||||
foundry
|
||||
21
daggerheart.d.ts
vendored
Normal file
21
daggerheart.d.ts
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import './module/_types';
|
||||
import '@client/global.mjs';
|
||||
import Canvas from '@client/canvas/board.mjs';
|
||||
|
||||
// Foundry's use of `Object.assign(globalThis) means many globally available objects are not read as such
|
||||
// This declare global hopefully fixes that
|
||||
declare global {
|
||||
/**
|
||||
* A simple event framework used throughout Foundry Virtual Tabletop.
|
||||
* When key actions or events occur, a "hook" is defined where user-defined callback functions can execute.
|
||||
* This class manages the registration and execution of hooked callback functions.
|
||||
*/
|
||||
class Hooks extends foundry.helpers.Hooks {}
|
||||
const fromUuid = foundry.utils.fromUuid;
|
||||
const fromUuidSync = foundry.utils.fromUuidSync;
|
||||
|
||||
/**
|
||||
* The singleton game canvas
|
||||
*/
|
||||
const canvas: Canvas;
|
||||
}
|
||||
15
jsconfig.json
Normal file
15
jsconfig.json
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "ES6",
|
||||
"target": "ES6",
|
||||
"paths": {
|
||||
"@client/*": ["./foundry/client/*"],
|
||||
"@common/*": ["./foundry/common/*"]
|
||||
}
|
||||
},
|
||||
"exclude": ["node_modules", "**/node_modules/*"],
|
||||
"include": ["daggerheart.mjs", "foundry/client/client.mjs", "daggerheart.d.ts"],
|
||||
"typeAcquisition": {
|
||||
"include": ["jquery"]
|
||||
}
|
||||
}
|
||||
0
module/_types.d.ts
vendored
Normal file
0
module/_types.d.ts
vendored
Normal file
|
|
@ -9,7 +9,8 @@
|
|||
"start": "concurrently \"rollup -c --watch\" \"node ../../../../FoundryDev/main.js --dataPath=../../../ --noupnp\" \"gulp\"",
|
||||
"start-test": "node ./resources/app/main.js --dataPath=./ && rollup -c --watch && gulp",
|
||||
"pushLDBtoYML": "node ./tools/pushLDBtoYML.mjs",
|
||||
"pullYMLtoLDB": "node ./tools/pullYMLtoLDB.mjs"
|
||||
"pullYMLtoLDB": "node ./tools/pullYMLtoLDB.mjs",
|
||||
"createSymlink": "node ./tools/create-symlink.mjs"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@foundryvtt/foundryvtt-cli": "^1.0.2",
|
||||
|
|
|
|||
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