Add scripts and infra required to get Foundry intellisense working
This commit is contained in:
parent
2cb4268400
commit
e84e921bec
5 changed files with 79 additions and 2 deletions
2
.env.template
Normal file
2
.env.template
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
# The absolute path to the Foundry installation to create symlinks to
|
||||||
|
FOUNDRY_ROOT=""
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -17,6 +17,8 @@ lerna-debug.log*
|
||||||
node_modules
|
node_modules
|
||||||
/*.dist
|
/*.dist
|
||||||
*.local
|
*.local
|
||||||
|
.env
|
||||||
|
/foundry
|
||||||
|
|
||||||
# Editor directories and files
|
# Editor directories and files
|
||||||
.vscode/*
|
.vscode/*
|
||||||
|
|
|
||||||
14
augments.d.ts
vendored
Normal file
14
augments.d.ts
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
declare global {
|
||||||
|
class Hooks extends foundry.helpers.Hooks {};
|
||||||
|
const fromUuid = foundry.utils.fromUuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Actor {
|
||||||
|
/** The system-specific data */
|
||||||
|
system: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
interface Item {
|
||||||
|
/** The system-specific data */
|
||||||
|
system: any;
|
||||||
|
};
|
||||||
|
|
@ -1,10 +1,22 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "ES2020",
|
"module": "ES2020",
|
||||||
"target": "ES2020"
|
"target": "ES2020",
|
||||||
|
"types": [
|
||||||
|
"./augments.d.ts"
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"@client/*": ["./foundry/client/*"],
|
||||||
|
"@common/*": ["./foundry/common/*"],
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "**/node_modules/*"],
|
"exclude": ["node_modules", "**/node_modules/*"],
|
||||||
"include": ["module/**/*"],
|
"include": [
|
||||||
|
"module/**/*",
|
||||||
|
"foundry/client/client.mjs",
|
||||||
|
"foundry/client/global.d.mts",
|
||||||
|
"foundry/common/primitives/global.d.mts"
|
||||||
|
],
|
||||||
"typeAcquisition": {
|
"typeAcquisition": {
|
||||||
"include": ["joi"]
|
"include": ["joi"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
47
scripts/linkFoundry.mjs
Normal file
47
scripts/linkFoundry.mjs
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
import { existsSync } from "fs";
|
||||||
|
import { symlink, unlink } from "fs/promises";
|
||||||
|
import { join } from "path";
|
||||||
|
import { config } from "dotenv";
|
||||||
|
|
||||||
|
config({ quiet: true });
|
||||||
|
|
||||||
|
const root = process.env.FOUNDRY_ROOT;
|
||||||
|
|
||||||
|
// Early exit
|
||||||
|
if (!root) {
|
||||||
|
console.error(`Must provide a FOUNDRY_ROOT environment variable`);
|
||||||
|
process.exit(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 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