diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ec91b80 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +name: Release +on: + release: + types: [published] + +permissions: + contents: write + +jobs: + release: + timeout-minutes: 5 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + + - name: Install dependencies + run: bun install + + - name: Install Playwright Browsers + run: npx playwright install --with-deps chromium + + - name: Generate PDF's + run: bun generate + + - name: Upload PDF's + run: | + for file in ./storage/*.pdf; do + echo "$file" + gh release upload ${{github.event.release.tag_name}} "$file" + done + + env: + GITHUB_TOKEN: ${{ github.TOKEN }} diff --git a/.gitignore b/.gitignore index 66c2997..eff56ea 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules/ +storage/ diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000..f24b41e Binary files /dev/null and b/bun.lockb differ diff --git a/generate-pdf.ts b/generate-pdf.ts new file mode 100644 index 0000000..47a207b --- /dev/null +++ b/generate-pdf.ts @@ -0,0 +1,43 @@ +import { readdir } from 'node:fs/promises'; +import { chromium } from "playwright-core"; + +const dir = import.meta.dirname; + +async function generate() { + const browser = await chromium.launch({ headless: true, args: ["--disable-web-security"] }) + const page = await browser.newPage({ bypassCSP: true }) + page.addInitScript((dir) => { + window.addEventListener('DOMContentLoaded', () => { + const html = document.querySelector("html") as HTMLHtmlElement + html.innerHTML = html?.innerHTML.replace("/style.css", `file:///${dir}/style.css`).replaceAll("/images/", `file:///${dir}/images/`) + }); + }, dir); + + const files = (await readdir("./sets")).filter((f) => f !== "template.html") + + for(const file of files) { + page.goto(`file:///${dir}/sets/${file}`) + await page.waitForLoadState() + // console.info("waitForLoadState") + await page.waitForSelector("page") + // console.log("waitForSelector") + await page.waitForLoadState("domcontentloaded") + await page.waitForLoadState("networkidle") + + const title = (await page.title()).replaceAll(":", " ") + + await page.pdf({ + path: `./storage/${title}.pdf`, + printBackground: false, + scale: 1, + width: "21cm", + height: "29.7cm" + }) + console.info(`Generated "${title}.pdf" PDF`) + } + await page.close() + + process.exit(0) +} + +void generate() diff --git a/package.json b/package.json index a8fe71d..95c121a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,8 @@ { "scripts": { + "generate": "bun ./generate-pdf.ts", "dev:mkm": "browser-sync start --server --no-inject-changes --files './' --startPath '/sets/mkm.html'", - "dev:lotr": "browser-sync start --server --no-inject-changes --files './' --startPath '/sets/lotr.html'", + "dev:ltr": "browser-sync start --server --no-inject-changes --files './' --startPath '/sets/ltr.html'", "dev:vow": "browser-sync start --server --no-inject-changes --files './' --startPath '/sets/vow.html'", "dev:otj": "browser-sync start --server --no-inject-changes --files './' --startPath '/sets/otj.html'", "dev:mh3": "browser-sync start --server --no-inject-changes --files './' --startPath '/sets/mh3.html'", @@ -11,6 +12,10 @@ "dev:dsk": "browser-sync start --server --no-inject-changes --files './' --startPath '/sets/dsk.html'" }, "devDependencies": { + "@types/bun": "^1.1.10", "browser-sync": "^3.0.2" + }, + "dependencies": { + "playwright": "^1.47.2" } } diff --git a/sets/dsk.html b/sets/dsk.html index 0608403..98e2879 100644 --- a/sets/dsk.html +++ b/sets/dsk.html @@ -1,114 +1,135 @@ + + - - - - - - - - - Archetypes - - - -
Duskmourn: House of Horrors
-

Archetypes

-
-
-

Eerie Midrange

- Gremlin Tamer - Search the House! Play lots of enchantments and unlock Rooms to power up your creatures and get around all the horrifying blockers your opponent might throw your way. -
- -
-

Eerie Control

- Fear of Infinity - Live out your worst nightmares and share them with your opponent, unlocking Rooms and playing enchantments to kill off their creatures and seize control of the game. -
- -
-

Sacrifice

- Sawblade Skinripper - Want to slash through opposing creatures and your opponent with ease? Pay the price for strength by sacrificing your own creatures and old Rooms. -
- -
-

Delirium Midrange

- Wildfire Wickerfolk - Fill your deck with artifact and enchantment creatures (along with other card types), and attack early and often. Once you get four different card types into your graveyard, your cards power up. Then go for the jugular! -
- -
-

Survival

- Shrewd Storyteller - Utilize all of Duskmourn's tricks to power up your creatures and help them smash their way to safety. Find other ways to tap them and hide until the danger's past. -
-
-
-
-

Reanimator

- Shroudstomper - All hail Valgavoth! Slow your opponent down while you get enormous monsters into your graveyard and then perform the rituals to return them to life. -
- -
-

Rooms

- Intruding Soulrager - The House never ends! Trap your opponent going in circles as you unlock Rooms to build up control of more and more territory, then unleash the ghosts held within for a frightening finish. -
- -
-

Graveyard

- Broodspinner - Prioritize getting a wide variety of card types, then gum up the board as you fill your graveyard with them. Once you've got at least four, grind your opponent to dust by recycling what you've thrown away. -
- -
-

Power Aggro

- Arabella, Abandoned Doll - Fill your deck with Toys, Clowns, and other creatures that have 2 or less power and start attacking! Smash your opponents swiftly by clearing out their blockers and buffing your little creatures. -
- -
-

Manifest Dread

- Oblivious Bookworm - Something's lurking in the shadows. Manifest face-down creatures and get them into combat, then surprise your opponent with their true forms to outsize the competition. -
-
+ + + + + + + Duskmourn: House of Horrors [Draft] + -

Mechanics

+ + +
Duskmourn: House of Horrors
+ +

Archetypes

+
+
+

Eerie Midrange

+ Gremlin Tamer + Search the House! Play lots of enchantments and unlock Rooms to power up your creatures and get + around all the horrifying blockers your opponent might throw your way. +
+ +
+

Eerie Control

+ Fear of Infinity + Live out your worst nightmares and share them with your opponent, unlocking Rooms and playing + enchantments to kill off their creatures and seize control of the game. +
+ +
+

Sacrifice

+ Sawblade Skinripper + Want to slash through opposing creatures and your opponent with ease? Pay the price for strength + by sacrificing your own creatures and old Rooms. +
+ +
+

Delirium Midrange

+ Wildfire Wickerfolk + Fill your deck with artifact and enchantment creatures (along with other card types), and attack + early and often. Once you get four different card types into your graveyard, your cards power up. + Then go for the jugular! +
+ +
+

Survival

+ Shrewd Storyteller + Utilize all of Duskmourn's tricks to power up your creatures and help them smash their way to + safety. Find other ways to tap them and hide until the danger's past. +
+
+
+
+

Reanimator

+ Shroudstomper + All hail Valgavoth! Slow your opponent down while you get enormous monsters into your graveyard + and then perform the rituals to return them to life. +
+ +
+

Rooms

+ Intruding Soulrager + The House never ends! Trap your opponent going in circles as you unlock Rooms to build up control + of more and more territory, then unleash the ghosts held within for a frightening finish. +
+ +
+

Graveyard

+ Broodspinner + Prioritize getting a wide variety of card types, then gum up the board as you fill your graveyard + with them. Once you've got at least four, grind your opponent to dust by recycling what you've + thrown away. +
+ +
+

Power Aggro

+ Arabella, Abandoned Doll + Fill your deck with Toys, Clowns, and other creatures that have 2 or less power and start + attacking! Smash your opponents swiftly by clearing out their blockers and buffing your little + creatures. +
+ +
+

Manifest Dread

+ Oblivious Bookworm + Something's lurking in the shadows. Manifest face-down creatures and get them into combat, then + surprise your opponent with their true forms to outsize the competition. +
+
+ +

Mechanics

Rooms

- Enchantment - Room (You may cast either half. That door unlocks on the battlefield. As a sorcery, you may pay the mana cost of a locked door to unlock it.) + Enchantment - Room (You may cast either half. That door unlocks on the battlefield. As a sorcery, + you may pay the mana cost of a locked door to unlock it.)

Umbra Armor

- Former: "Totem Armor". Umbra armor appears on Aura cards. If a - creature enchanted by an Aura with umbra armor would be destroyed, - instead that Aura is destroyed and all damage dealt to the creature + Former: "Totem Armor". Umbra armor appears on Aura cards. If a creature enchanted by an Aura with + umbra armor would be destroyed, instead that Aura is destroyed and all damage dealt to the creature is removed.

Impending

- Impending [X] — (If you cast this spell for its impending cost, it enters with [X] time counters and isn't a creature until the last is removed. At the beginning of your end step, remove a time counter from it.) + Impending [X] — (If you cast this spell for its impending cost, it enters with [X] time counters + and isn't a creature until the last is removed. At the beginning of your end step, remove a time + counter from it.)

Manifest Dread

- (Look at the top two cards of your library. Put one onto the battlefield face down as a 2/2 creature and the other into your graveyard. Turn it face up any time for its mana cost if it's a creature card.) + (Look at the top two cards of your library. Put one onto the battlefield face down as a 2/2 + creature and the other into your graveyard. Turn it face up any time for its mana cost if it's a + creature card.)

Survival

- Survival — At the beginning of your second main phase, if [CARNDAME] is tapped, you gain 2 life. + Survival — At the beginning of your second main phase, if [CARNDAME] is tapped, you gain 2 + life.
-
+

Eerie

- Eerie — Whenever an enchantment you control enters and whenever you fully unlock a Room, put a +1/+1 counter on target creature. + Eerie — Whenever an enchantment you control enters and whenever you fully unlock a Room, put a + +1/+1 counter on target creature.
- - - - \ No newline at end of file + + + + diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..c6e65e0 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + // Enable latest features + "lib": ["ESNext", "DOM"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + + // Some stricter flags + "noUnusedLocals": true, + "noUnusedParameters": true, + "noPropertyAccessFromIndexSignature": true, + }, +}