From 02074f3c2d8053b0f8c8017c85496854d2e5d753 Mon Sep 17 00:00:00 2001 From: Daniel <790119+DanTheMan827@users.noreply.github.com> Date: Tue, 23 Jul 2024 17:14:04 +0000 Subject: [PATCH] Use deno instead for qmod generation --- .github/workflows/qmods.yml | 83 ++++------------------------ .gitignore | 1 + .vscode/extensions.json | 5 ++ .vscode/settings.json | 7 +++ build_coremods.ts | 104 ++++++++++++++++++++++++++++++++++++ 5 files changed, 126 insertions(+), 74 deletions(-) create mode 100644 .gitignore create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json create mode 100755 build_coremods.ts diff --git a/.github/workflows/qmods.yml b/.github/workflows/qmods.yml index 4d79940..dc95151 100644 --- a/.github/workflows/qmods.yml +++ b/.github/workflows/qmods.yml @@ -31,89 +31,24 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - + - name: Setup Pages uses: actions/configure-pages@v5 - - name: Build Core Qmods - env: - CORE_JSON: "core_mods.json" - DEPLOY_PATH: "qmods" - run: | - mkdir -p "$DEPLOY_PATH" - echo "Beat Saber Core Mods" >> "$DEPLOY_PATH/index.html" - - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: # Upload entire repository path: 'qmods' - + - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ae25cc8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +qmod/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..3bfc872 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "denoland.vscode-deno" + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..bed5519 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "deno.enable": true, + "editor.formatOnSave": true, + "files.trimTrailingWhitespace": true, + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true +} diff --git a/build_coremods.ts b/build_coremods.ts new file mode 100755 index 0000000..528592b --- /dev/null +++ b/build_coremods.ts @@ -0,0 +1,104 @@ +#!/bin/env -S deno run --allow-read --allow-write --allow-run + +// Import required modules +import { join } from "https://deno.land/std@0.224.0/path/mod.ts"; +import { compress } from "https://deno.land/x/zip@v1.2.5/mod.ts"; +const { + mkdirSync, + readTextFileSync, + utimeSync, + writeTextFileSync, + removeSync, +} = Deno; + +// Define constants +const deployPath = "./qmod"; +const coreJsonPath = "./core_mods.json"; +const indexPath = join(deployPath, "index.html"); + +// Create the deployment directory +mkdirSync(deployPath, { recursive: true }); + +// Write the starting HTML tags to index.html +writeTextFileSync( + indexPath, + "Beat Saber Core Mods", { + append: true, +});