From 703212d34b7b6f372c013d0aa30199cc3411fd3b Mon Sep 17 00:00:00 2001 From: WBHarry Date: Fri, 8 Aug 2025 00:41:01 +0200 Subject: [PATCH] Updated deploy script with build specific ymlLdb script --- .github/workflows/deploy.yml | 2 +- package.json | 1 + system.json | 2 +- tools/pullYMLtoLDBBuild.mjs | 31 +++++++++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 tools/pullYMLtoLDBBuild.mjs diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ca744ed5..aef0ddd1 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -15,7 +15,7 @@ jobs: - name: Build Packs run: | - npm run pullYMLtoLDB + npm run pullYMLtoLDBBuild mv --force src/packs/LICENSE packs/LICENSE - name: Build daggerheart.js diff --git a/package.json b/package.json index af5adfd6..023ccff2 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "readline": "^1.3.0", "pushLDBtoYML": "node ./tools/pushLDBtoYML.mjs", "pullYMLtoLDB": "node ./tools/pullYMLtoLDB.mjs", + "pullYMLtoLDBBuild": "node ./tools/pullYMLtoLDBBuild.mjs", "createSymlink": "node ./tools/create-symlink.mjs" }, "devDependencies": { diff --git a/system.json b/system.json index b6472122..7501cfa7 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "daggerheart", "title": "Daggerheart", "description": "An unofficial implementation of the Daggerheart system", - "version": "0.0.1", + "version": "1.0.0", "compatibility": { "minimum": "13", "verified": "13.347", diff --git a/tools/pullYMLtoLDBBuild.mjs b/tools/pullYMLtoLDBBuild.mjs new file mode 100644 index 00000000..6c2b8c79 --- /dev/null +++ b/tools/pullYMLtoLDBBuild.mjs @@ -0,0 +1,31 @@ +import { compilePack } from '@foundryvtt/foundryvtt-cli'; +import { promises as fs } from 'fs'; + +const MODULE_ID = process.cwd(); +const yaml = false; + +const packs = await deepGetDirectories('./packs'); +console.log(packs); +for (const pack of packs) { + if (pack === '.gitattributes') continue; + console.log('Packing ' + pack); + await compilePack(`${MODULE_ID}/src/${pack}`, `${MODULE_ID}/${pack}`, { yaml }); +} + +async function deepGetDirectories(distPath) { + const dirr = await fs.readdir('src/' + distPath); + const dirrsWithSub = []; + for (let file of dirr) { + const stat = await fs.stat('src/' + distPath + '/' + file); + if (stat.isDirectory()) { + const deeper = await deepGetDirectories(distPath + '/' + file); + if (deeper.length > 0) { + dirrsWithSub.push(...deeper); + } else { + dirrsWithSub.push(distPath + '/' + file); + } + } + } + + return dirrsWithSub; +}