Skip to content

Commit

Permalink
attempt updater fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Vap0r1ze committed Jan 10, 2023
1 parent a710417 commit bffdfec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions scripts/build/build.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import assert from "assert"
import { build } from "esbuild"
import { basename } from "path"
import { commonOptions, writeOutput } from "./common"
import { commonOptions, ScriptMeta, writeOutput } from "./common"

build({
...commonOptions,
}).then(({ outputFiles: [buildOutput] }) => {
const meta = {}
const meta: ScriptMeta = {}
const { GITHUB_JOB, GITHUB_REF_NAME, GITHUB_REPOSITORY } = process.env

if (GITHUB_JOB === "do_release") {
assert(GITHUB_REF_NAME && GITHUB_REPOSITORY)
meta["version"] = GITHUB_REF_NAME.slice(1)
meta[
"updateURL"
] = `https://github.com/${GITHUB_REPOSITORY}/releases/latest/download/${basename(
commonOptions.outfile!
)}`
Object.assign(meta, {
version: GITHUB_REF_NAME.slice(1),
updateURL: `https://github.com/${GITHUB_REPOSITORY}/releases/latest/download/${basename(
commonOptions.outfile!
)}`,
downloadURL: `https://github.com/${GITHUB_REPOSITORY}/releases/latest/download/${basename(
commonOptions.outfile!
)}`,
})
}

writeOutput(buildOutput, meta)
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { mkdirSync, readFileSync, writeFileSync } from "fs"
import { dirname } from "path"
import { wordsPlugin } from "./plugins/words"

type ScriptMeta = Record<string, string | string[]>
export type ScriptMeta = Record<string, string | string[]>

const { userscript: scriptMeta }: { userscript: ScriptMeta } = JSON.parse(
readFileSync("package.json", "utf-8")
Expand Down

0 comments on commit bffdfec

Please sign in to comment.