-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e1ef75d
commit 008da38
Showing
13 changed files
with
656 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Deploy to GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy to GitHub Pages | ||
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 | ||
env: | ||
NODE_ENV: production | ||
run: pnpm run build | ||
- name: Pack extensions | ||
env: | ||
REPO_URL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }} | ||
run: pnpm run repo | ||
|
||
- name: Setup GitHub Pages | ||
uses: actions/configure-pages@v3 | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: ./repo | ||
|
||
- name: Deploy to GitHub Pages | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/dist | ||
/repo | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "moonlight"] | ||
path = moonlight | ||
url = https://github.com/moonlight-mod/moonlight.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"printWidth": 80, | ||
"trailingComma": "none", | ||
"tabWidth": 2, | ||
"singleQuote": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# goonlight | ||
|
||
> when is goonlight releasing | ||
> | ||
> need to make cumcord plugin for moonlight called goonlight | ||
> | ||
> ~ [Nat Sepruko](https://github.com/sepruko), 2024 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import * as esbuild from "esbuild"; | ||
import copyStaticFiles from "esbuild-copy-static-files"; | ||
import fs from "fs"; | ||
|
||
const prod = process.env.NODE_ENV === "production"; | ||
const watch = process.argv.includes("--watch"); | ||
|
||
function makeConfig(ext, name) { | ||
const entryPoints = []; | ||
const fileExts = ["js", "jsx", "ts", "tsx"]; | ||
for (const fileExt of fileExts) { | ||
const path = `./src/${name}.${fileExt}`; | ||
if (fs.existsSync(path)) entryPoints.push(path); | ||
} | ||
|
||
const wpModulesDir = `./src/webpackModules`; | ||
if (fs.existsSync(wpModulesDir) && name === "index") { | ||
const wpModules = fs.readdirSync(wpModulesDir); | ||
for (const wpModule of wpModules) { | ||
entryPoints.push(`./src/webpackModules/${wpModule}`); | ||
} | ||
} | ||
|
||
if (entryPoints.length === 0) return null; | ||
|
||
const wpImportPlugin = { | ||
name: "webpackImports", | ||
setup(build) { | ||
build.onResolve({ filter: /^@moonlight-mod\/wp\// }, (args) => { | ||
const wpModule = args.path.replace(/^@moonlight-mod\/wp\//, ""); | ||
return { | ||
path: wpModule, | ||
external: true | ||
}; | ||
}); | ||
} | ||
}; | ||
|
||
const timeFormatter = new Intl.DateTimeFormat(undefined, { | ||
hour: "numeric", | ||
minute: "numeric", | ||
second: "numeric", | ||
hour12: false | ||
}); | ||
const buildLogPlugin = { | ||
name: "buildLog", | ||
setup(build) { | ||
build.onEnd(() => { | ||
console.log( | ||
`[${timeFormatter.format( | ||
new Date() | ||
)}] [${ext}/${name}] build finished` | ||
); | ||
}); | ||
} | ||
}; | ||
|
||
return { | ||
entryPoints, | ||
outdir: `./dist/${ext}`, | ||
|
||
format: "cjs", | ||
platform: "node", | ||
|
||
treeShaking: true, | ||
bundle: true, | ||
minify: prod, | ||
sourcemap: "inline", | ||
|
||
external: ["electron", "fs", "path", "module", "events", "original-fs"], | ||
|
||
plugins: [ | ||
copyStaticFiles({ | ||
src: `./src/manifest.json`, | ||
dest: `./dist/${ext}/manifest.json` | ||
}), | ||
wpImportPlugin, | ||
buildLogPlugin | ||
] | ||
}; | ||
} | ||
|
||
const EXT_NAME = "goonlight"; | ||
const config = [ | ||
makeConfig(EXT_NAME, "index"), | ||
makeConfig(EXT_NAME, "node"), | ||
makeConfig(EXT_NAME, "host") | ||
] | ||
.flat() | ||
.filter((c) => c !== null); | ||
|
||
if (watch) { | ||
await Promise.all( | ||
config.map(async (c) => { | ||
const ctx = await esbuild.context(c); | ||
await ctx.watch(); | ||
}) | ||
); | ||
} else { | ||
for (const c of config) { | ||
await esbuild.build(c); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="@moonlight-mod/types" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "@cynosphere/moonlight-extensions", | ||
"version": "1.0.0", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"build": "node build.mjs", | ||
"dev": "node build.mjs --watch", | ||
"repo": "node repo.mjs" | ||
}, | ||
"devDependencies": { | ||
"@electron/asar": "^3.2.8", | ||
"esbuild": "^0.19.3", | ||
"esbuild-copy-static-files": "^0.1.0" | ||
}, | ||
"dependencies": { | ||
"@moonlight-mod/types": "^1.0.0" | ||
} | ||
} |
Oops, something went wrong.