ags
This commit is contained in:
parent
eddf7cecb8
commit
aea798d119
16631 changed files with 1480363 additions and 257 deletions
|
|
@ -1,10 +1,46 @@
|
|||
import {Bar} from './modules/bar.js'
|
||||
import GLib from "gi://GLib"
|
||||
|
||||
App.config({
|
||||
style: "./style.css",
|
||||
windows: [
|
||||
Bar(),
|
||||
],
|
||||
})
|
||||
const main = "/tmp/asztal/main.js"
|
||||
const entry = `${App.configDir}/main.ts`
|
||||
const bundler = GLib.getenv("AGS_BUNDLER") || "bun"
|
||||
|
||||
const v = {
|
||||
ags: pkg.version?.split(".").map(Number) || [],
|
||||
expect: [1, 8, 1],
|
||||
}
|
||||
|
||||
try {
|
||||
switch (bundler) {
|
||||
case "bun": await Utils.execAsync([
|
||||
"bun", "build", entry,
|
||||
"--outfile", main,
|
||||
"--external", "resource://*",
|
||||
"--external", "gi://*",
|
||||
"--external", "file://*",
|
||||
]); break
|
||||
|
||||
case "esbuild": await Utils.execAsync([
|
||||
"esbuild", "--bundle", entry,
|
||||
"--format=esm",
|
||||
`--outfile=${main}`,
|
||||
"--external:resource://*",
|
||||
"--external:gi://*",
|
||||
"--external:file://*",
|
||||
]); break
|
||||
|
||||
default:
|
||||
throw `"${bundler}" is not a valid bundler`
|
||||
}
|
||||
|
||||
if (v.ags[1] < v.expect[1] || v.ags[2] < v.expect[2]) {
|
||||
print(`my config needs at least v${v.expect.join(".")}, yours is v${v.ags.join(".")}`)
|
||||
App.quit()
|
||||
}
|
||||
|
||||
await import(`file://${main}`)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
App.quit()
|
||||
}
|
||||
|
||||
export { }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue