test
This commit is contained in:
parent
688a66c052
commit
de668a42a3
5 changed files with 29 additions and 16 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -3,3 +3,4 @@ dist
|
||||||
cache
|
cache
|
||||||
node_modules
|
node_modules
|
||||||
.tsbuildinfo
|
.tsbuildinfo
|
||||||
|
asajs.config.js
|
||||||
|
|
@ -6,3 +6,5 @@ test
|
||||||
.gitignore
|
.gitignore
|
||||||
.tsbuildinfo
|
.tsbuildinfo
|
||||||
tsconfig.json
|
tsconfig.json
|
||||||
|
asajs.config.js
|
||||||
|
build
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"dev": "tsc --watch",
|
"dev": "tsc --watch",
|
||||||
"test": "bun test/app.ts",
|
"test": "bun test/app.ts --test",
|
||||||
"prefetch": "bun scripts/prefetch",
|
"prefetch": "bun scripts/prefetch",
|
||||||
"vanilla:defs": "bun scripts/vanilladefs",
|
"vanilla:defs": "bun scripts/vanilladefs",
|
||||||
"gen:enums": "bun scripts/enum",
|
"gen:enums": "bun scripts/enum",
|
||||||
|
|
|
||||||
|
|
@ -4,22 +4,27 @@ import path from "path"
|
||||||
import { Config } from "../../config.js"
|
import { Config } from "../../config.js"
|
||||||
import { createRequire } from "module"
|
import { createRequire } from "module"
|
||||||
|
|
||||||
if (!fs.existsSync("asajs.config.js")) {
|
const options: Record<string, unknown> = {}
|
||||||
fs.copyFileSync("node_modules/asajs/resources/asajs.config.js", "asajs.config.js")
|
|
||||||
|
for (const arg of process.argv) {
|
||||||
|
if (arg.startsWith("--")) options[arg.slice(2)] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fs.existsSync(".gitignore")) {
|
export const isTestMode = options["test"] ?? false
|
||||||
fs.writeFileSync(".gitignore", `node_modules`, "utf-8")
|
|
||||||
|
if (!fs.existsSync("asajs.config.js")) {
|
||||||
|
fs.copyFileSync(
|
||||||
|
isTestMode ? "resources/asajs.config.js" : "node_modules/asajs/resources/asajs.config.js",
|
||||||
|
"asajs.config.js",
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const config: Config = createRequire(import.meta.url)(path.resolve(process.cwd(), "asajs.config.js")).config
|
export const config: Config = createRequire(import.meta.url)(path.resolve(process.cwd(), "asajs.config.js")).config
|
||||||
|
|
||||||
export let isBuildMode = config.compiler?.enabled ?? false
|
export const isBuildMode = options["build"] ?? config.compiler?.enabled ?? false
|
||||||
export let isLinkMode = config.compiler?.autoImport ?? false
|
export const isLinkMode = options["link"] ?? config.compiler?.autoImport ?? false
|
||||||
export let unLinked = !(config.compiler?.autoImport ?? true)
|
export const unLinked = options["unlink"] ?? !(config.compiler?.autoImport ?? true)
|
||||||
|
|
||||||
for (const arg of process.argv) {
|
if (!fs.existsSync(".gitignore")) {
|
||||||
if (arg === "--build") isBuildMode = true
|
fs.writeFileSync(".gitignore", `node_modules`, "utf-8")
|
||||||
if (arg === "--link") isLinkMode = true
|
|
||||||
else if (arg === "--unlink") unLinked = true
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { config, isBuildMode, isLinkMode, unLinked } from "../Configuration.js"
|
import { config, isBuildMode, isLinkMode, isTestMode, unLinked } from "../Configuration.js"
|
||||||
import { Memory } from "../Memory.js"
|
import { Memory } from "../Memory.js"
|
||||||
import { createBuildFolder, gamePath, getBuildFolderName, linkToGame, unlink } from "./linker.js"
|
import { createBuildFolder, gamePath, getBuildFolderName, linkToGame, unlink } from "./linker.js"
|
||||||
import { genManifest, version } from "./manifest.js"
|
import { genManifest, version } from "./manifest.js"
|
||||||
|
|
@ -56,7 +56,12 @@ async function buildUI() {
|
||||||
BuildCache.set("version", version).then(() => Log("INFO", "version set!")),
|
BuildCache.set("version", version).then(() => Log("INFO", "version set!")),
|
||||||
fs
|
fs
|
||||||
.stat("build/pack_icon.png")
|
.stat("build/pack_icon.png")
|
||||||
.catch(() => fs.copyFile("node_modules/asajs/resources/pack_icon.png", "build/pack_icon.png"))
|
.catch(() =>
|
||||||
|
fs.copyFile(
|
||||||
|
isTestMode ? "resources/pack_icon.png" : "node_modules/asajs/resources/pack_icon.png",
|
||||||
|
"build/pack_icon.png",
|
||||||
|
),
|
||||||
|
)
|
||||||
.then(() => Log("INFO", "build/pack_icon.png copied!")),
|
.then(() => Log("INFO", "build/pack_icon.png copied!")),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue