diff --git a/.github/workflows/use-sdk.yml b/.github/workflows/use-sdk.yml index f3ac858a76b..46ca975effa 100644 --- a/.github/workflows/use-sdk.yml +++ b/.github/workflows/use-sdk.yml @@ -73,6 +73,7 @@ jobs: env: NPM_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} CDN_SHEETS_FOLDER: ${{ vars.CDN_SHEETS_FOLDER }} + DEST_DIR: /tmp steps: - uses: actions/checkout@v3 - id: 'auth' @@ -99,4 +100,4 @@ jobs: args: fd-find - run: make clean - run: make all - - run: bash force-update.sh + - run: bash force-update.sh "$DEST_DIR" diff --git a/Makefile b/Makefile index 6c60b003215..344d51c9670 100644 --- a/Makefile +++ b/Makefile @@ -14,4 +14,4 @@ clean: rm -rf **/*/dist all: - fd . --exclude contrib --exclude "Zelda BOTW" --type d --max-depth 1 --exec bun run contrib/sheet-pixie/index.ts "{}/sheet.json" \; + fd . --strip-cwd-prefix --exclude contrib --exclude "Zelda BOTW" --type d --max-depth 1 --exec bun run contrib/sheet-pixie/index.ts "{}/sheet.json" \; diff --git a/contrib/sheet-pixie/index.ts b/contrib/sheet-pixie/index.ts index ed2744e7bfe..ba9239d1c50 100644 --- a/contrib/sheet-pixie/index.ts +++ b/contrib/sheet-pixie/index.ts @@ -41,20 +41,9 @@ async function onSheetChange(sheetDir: string) { const cssRes = await tryCss(Bun.file(`${sheetDir}/${cssPath}`), advanced); const { css, rawCss } = cssRes; - const data = { - characterSheet: { - css, - rawCss, - html, - mancertemplates, - rolltemplates, - sheetworkers, - }, - }; - - const distDir = `${sheetDir}/dist`; + const distDir = `${process.env.DEST_DIR}/${sheetDir}/dist`; rmSync(distDir, { recursive: true, force: true }); - mkdirSync(distDir); + mkdirSync(distDir, { recursive: true }); await Promise.all([ saveToFile(`${distDir}/index.html`, html), saveToFile(`${distDir}/index.css`, css), @@ -75,14 +64,14 @@ async function main(args: string[]) { } let jobStatus = 0; +const args = Bun.argv.slice(2); -main(Bun.argv.slice(2)) +main(args) .then() .catch((err) => { - console.error(err); + console.error(Bun.stderr, `${err} (args=${args})`); jobStatus = 1; }) .finally(() => { - console.log({ jobStatus }); process.exit(jobStatus); }); diff --git a/contrib/sheet-pixie/save.ts b/contrib/sheet-pixie/save.ts index 26f18248b54..0eb503658d9 100644 --- a/contrib/sheet-pixie/save.ts +++ b/contrib/sheet-pixie/save.ts @@ -1,5 +1,4 @@ function saveToFile(path: string, content: string) { - console.log("Writing content to file: " + path); return Bun.write(path, content); } export { saveToFile }; diff --git a/force-update.sh b/force-update.sh index ed6b451a425..3c941a631c1 100755 --- a/force-update.sh +++ b/force-update.sh @@ -1,3 +1,3 @@ #!/bin/bash -gcloud storage rsync --project=roll20-actual gs://roll20-cdn/$CDN_SHEETS_FOLDER --delete-unmatched-destination-objects --cache-control='no-cache' +gcloud storage rsync --project=roll20-actual $1 gs://roll20-cdn/$CDN_SHEETS_FOLDER --delete-unmatched-destination-objects --cache-control='no-cache' --recursive