Update scripts to allow auto-linking of Foundry source for intellisense
This commit is contained in:
parent
65cc95c35c
commit
6866bea131
7 changed files with 66 additions and 8 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,3 +1,4 @@
|
|||
node_modules/
|
||||
deprecated
|
||||
.env
|
||||
/foundry
|
||||
|
|
|
|||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
|
@ -11,7 +11,7 @@
|
|||
".styles": false,
|
||||
"node_modules": true,
|
||||
"packs": true,
|
||||
"foundry": false
|
||||
"foundry": true
|
||||
},
|
||||
"html.customData": [
|
||||
"./.vscode/components.html-data.json"
|
||||
|
|
|
|||
5
augments.d.ts
vendored
5
augments.d.ts
vendored
|
|
@ -1,3 +1,8 @@
|
|||
declare global {
|
||||
class Hooks extends foundry.helpers.Hooks {};
|
||||
const fromUuid = foundry.utils.fromUuid;
|
||||
}
|
||||
|
||||
interface Actor {
|
||||
/** The system-specific data */
|
||||
system: any;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import stylistic from "@stylistic/eslint-plugin";
|
|||
|
||||
export default [
|
||||
// Tell eslint to ignore files that I don't mind being formatted slightly differently
|
||||
{ ignores: [ `scripts/` ] },
|
||||
{ ignores: [ `scripts/`, `foundry/*` ] },
|
||||
{
|
||||
languageOptions: {
|
||||
globals: globals.browser,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,19 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "es2022",
|
||||
"target": "es2022",
|
||||
"types": [
|
||||
"./augments.d.ts"
|
||||
]
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"@client/*": ["./foundry/client/*"],
|
||||
"@common/*": ["./foundry/common/*"],
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"module/main.mjs",
|
||||
"foundry/client/client.mjs",
|
||||
"foundry/client/global.d.mts",
|
||||
"foundry/common/primitives/global.d.mts"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
"globals": "^15.9.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/buildCompendia.mjs",
|
||||
"extract": "node scripts/extractCompendia.mjs",
|
||||
"link": "node scripts/linkFoundry.mjs",
|
||||
"lint": "eslint --fix",
|
||||
"lint:nofix": "eslint"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,47 @@
|
|||
import { existsSync } from "fs";
|
||||
import { symlink, unlink } from "fs/promises";
|
||||
import { join } from "path";
|
||||
import { config } from "dotenv";
|
||||
config();
|
||||
|
||||
console.log(process.env)
|
||||
config({ quiet: true });
|
||||
|
||||
const root = process.env.FOUNDRY_ROOT;
|
||||
|
||||
// Early exit
|
||||
if (!root) { process.exit(1) };
|
||||
if (!root) {
|
||||
console.error(`Must provide a FOUNDRY_ROOT environment variable`);
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
// Assert root exists
|
||||
// Assert Foundry exists
|
||||
if (!existsSync(root)) {
|
||||
console.error(`Foundry root not found.`);
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
// Removing existing symlink
|
||||
if (existsSync(`foundry`)) {
|
||||
console.log(`Attempting to unlink foundry instance`);
|
||||
try {
|
||||
await unlink(`foundry`);
|
||||
} catch {
|
||||
console.error(`Failed to unlink foundry folder.`);
|
||||
process.exit(1);
|
||||
};
|
||||
};
|
||||
|
||||
// Account for if the root is pointing at an Electron install
|
||||
let targetRoot = root;
|
||||
if (existsSync(join(root, `resources`, `app`))) {
|
||||
console.log(`Switching to use the "${root}/resources/app" directory`);
|
||||
targetRoot = join(root, `resources`, `app`);
|
||||
};
|
||||
|
||||
// Create symlink
|
||||
console.log(`Linking foundry source into folder`)
|
||||
try {
|
||||
await symlink(targetRoot, `foundry`);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue