diff --git a/dev/hooks/getHeaderControlsActorSheetV2.mjs b/dev/hooks/getHeaderControlsActorSheetV2.mjs new file mode 100644 index 0000000..51725e8 --- /dev/null +++ b/dev/hooks/getHeaderControlsActorSheetV2.mjs @@ -0,0 +1,15 @@ +/* +This hook exists to be able to change all of the actor-sheets to allow +them to have dev-mode controls in their header that are useful for +testing purposes. (This is particularly useful for testing embedded +items that are only allowed to exist on specific actor types) +*/ +Hooks.on(`getHeaderControlsActorSheetV2`, (_app, controls) => { + if (!game.settings.get(`ripcrypt`, `devMode`)) { return } + + controls.push({ + icon: `fa-solid fa-terminal`, + label: `Embed New Item (DEV)`, + action: `createItem`, + }); +}); diff --git a/module/hooks/hotReload.mjs b/dev/hooks/hotReload.mjs similarity index 87% rename from module/hooks/hotReload.mjs rename to dev/hooks/hotReload.mjs index 7ef784f..99f6a55 100644 --- a/module/hooks/hotReload.mjs +++ b/dev/hooks/hotReload.mjs @@ -1,4 +1,4 @@ -import { Logger } from "../utils/Logger.mjs"; +import { Logger } from "../../module/utils/Logger.mjs"; const loaders = { svg(data) { diff --git a/dev/main.mjs b/dev/main.mjs new file mode 100644 index 0000000..35dfa4c --- /dev/null +++ b/dev/main.mjs @@ -0,0 +1,3 @@ +// Hooks +import "./hooks/hotReload.mjs"; +import "./hooks/getHeaderControlsActorSheetV2.mjs"; diff --git a/jsconfig.json b/jsconfig.json index 47b5b55..9841790 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -12,6 +12,7 @@ }, "include": [ "module/**/*", + "dev/**/*", "foundry/client/client.mjs", "foundry/client/global.d.mts", "foundry/common/primitives/global.d.mts" diff --git a/module/main.mjs b/module/main.mjs index 064d9f8..8c32f94 100644 --- a/module/main.mjs +++ b/module/main.mjs @@ -1,7 +1,6 @@ // Hooks import "./hooks/init.mjs"; import "./hooks/ready.mjs"; -import "./hooks/hotReload.mjs"; // Global API import "./api.mjs"; diff --git a/scripts/prepareManifest.mjs b/scripts/prepareManifest.mjs new file mode 100644 index 0000000..ec0ed06 --- /dev/null +++ b/scripts/prepareManifest.mjs @@ -0,0 +1,14 @@ +/* +The intent of this script is to do all of the modifications of the +manifest file that we need to do in order to release the system. This +can include removing dev-only fields/attributes that end users will +never, and should never, care about nor need. +*/ + +// TODO: load the manifest + +// TODO: remove all files that start with dev/ from the esmodules list + +// TODO: remove flags.hotReload + +// TODO: write the new manifest to disk diff --git a/system.json b/system.json index 55a2be4..6cf405f 100644 --- a/system.json +++ b/system.json @@ -12,7 +12,8 @@ { "name": "Oliver" } ], "esmodules": [ - "module/main.mjs" + "module/main.mjs", + "dev/main.mjs" ], "styles": [ { @@ -36,7 +37,7 @@ "flags": { "hotReload": { "extensions": ["css", "hbs", "json", "mjs", "svg"], - "paths": ["assets", "templates", "langs", "module"] + "paths": ["assets", "templates", "langs", "module", "dev"] } }, "documentTypes": {