Initialize module

This commit is contained in:
Oliver 2026-01-04 18:07:33 -07:00
parent e82830e085
commit 94da140915
10 changed files with 4399 additions and 1 deletions

2
.env.template Normal file
View file

@ -0,0 +1,2 @@
# The absolute path to the Foundry installation to create symlinks to
FOUNDRY_ROOT=""

2
.gitignore vendored
View file

@ -3,6 +3,7 @@ dist/
*.link
*.txt
/foundry
/storage
# Dependencies
node_modules/
@ -14,4 +15,3 @@ node_modules/
/packs/**/*
!/packs/**/*/
!/packs/**/*.json

6
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,6 @@
{
"files.exclude": {
"foundry": true,
"storage": true
}
}

4
augments.d.ts vendored Normal file
View file

@ -0,0 +1,4 @@
declare global {
class Hooks extends foundry.helpers.Hooks {};
const fromUuid = foundry.utils.fromUuid;
};

20
jsconfig.json Normal file
View file

@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "es2022",
"target": "es2022",
"types": [
"./augments.d.ts"
],
"paths": {
"@client/*": ["./foundry/client/*"],
"@common/*": ["./foundry/common/*"],
}
},
"include": [
"module/**/*",
"dev/**/*",
"foundry/client/client.mjs",
"foundry/client/global.d.mts",
"foundry/common/primitives/global.d.mts"
]
}

26
module.json Normal file
View file

@ -0,0 +1,26 @@
{
"id": "token-browser",
"title": "Token Browser",
"description": "A module that helps you categorize tokens and",
"version": "0.0.0",
"compatibility": {
"minimum": 13,
"verified": 13
},
"url": "https://git.varify.ca/Foundry/token-browser",
"manifest": "",
"download": "",
"esmodules": [
"module/token-browser.mjs"
],
"styles": [
{
"src": "styles/main.css",
"layer": "modules.token-browser"
}
],
"flags": {
"inDev": true
},
"persistentStorage": true
}

4275
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

17
package.json Normal file
View file

@ -0,0 +1,17 @@
{
"devDependencies": {
"@aws-sdk/client-s3": "^3.946.0",
"@eslint/js": "^9.8.0",
"@foundryvtt/foundryvtt-cli": "^1.0.3",
"@stylistic/eslint-plugin": "^2.6.1",
"axios": "^1.13.2",
"dotenv": "^17.2.2",
"eslint": "^9.8.0",
"globals": "^15.9.0"
},
"scripts": {
"link": "node scripts/linkFoundry.mjs",
"lint": "eslint --fix",
"lint:nofix": "eslint"
}
}

47
scripts/linkFoundry.mjs Normal file
View 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);
};

1
token-browser.lock Normal file
View file

@ -0,0 +1 @@
🔒