Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
NotNite committed Dec 7, 2023
0 parents commit 0a8b469
Show file tree
Hide file tree
Showing 7 changed files with 746 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Deploy extensions

on:
push:
branches:
- main

permissions:
contents: read
pages: write
id-token: write

jobs:
deploy:
name: Deploy extensions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build extensions
run: pnpm run build

- name: Setup GitHub Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./exts
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v2
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules
# Built by CI
/exts/repo.json
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 80,
"trailingComma": "none",
"tabWidth": 2,
"singleQuote": false
}
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import fs from "fs";
import path from "path";
import asar from "@electron/asar";

const exts = fs.readdirSync("./exts");
const repo = [];
for (const file of exts) {
if (!file.endsWith(".asar")) continue;
const filePath = path.join("./exts", file);

try {
const manifestBuffer = asar.extractFile(filePath, "manifest.json");
const manifest = JSON.parse(manifestBuffer.toString());
manifest.download = `https://moonlight-mod.github.io/extensions/${file}`;
repo.push(manifest);
} catch (e) {
console.error(e);
continue;
}
}

fs.writeFileSync(
path.join("./exts", "repo.json"),
JSON.stringify(repo, null, 2)
);
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "extensions-dist",
"devDependencies": {
"@electron/asar": "^3.2.8"
},
"scripts": {
"build": "node build.mjs"
}
}
1 change: 1 addition & 0 deletions state.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}

0 comments on commit 0a8b469

Please sign in to comment.