stupid
This commit is contained in:
parent
58a193455a
commit
12dadcac2c
5 changed files with 29 additions and 10 deletions
|
|
@ -51,7 +51,7 @@ if (!fs.existsSync("asajs.config.js")) {
|
|||
"asajs.config.js",
|
||||
[
|
||||
'import { RandomBindingString } from "asajs"\n',
|
||||
fs.readFileSync("node_modules/asajs/resources/example-config.js", "utf-8"),
|
||||
fs.readFileSync(path.join(process.cwd(), "node_modules/asajs/resources/example-config.js"), "utf-8"),
|
||||
].join("\n"),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ export class Parser {
|
|||
output: Expression
|
||||
tokens: Token[]
|
||||
|
||||
static hasError = false
|
||||
|
||||
constructor(
|
||||
private input: string,
|
||||
private cache = new Map<string, unknown>(),
|
||||
|
|
@ -414,6 +416,7 @@ export class Parser {
|
|||
private expect(kind: TokenKind, err: string) {
|
||||
const prev = this.at() || this.last()
|
||||
if (!prev || prev.kind !== kind) {
|
||||
Parser.hasError = true
|
||||
throw new Error(
|
||||
`\x1b[31m${this.getPointer(prev)}\n` + `[ERROR]: ${err}\x1b[0m - Expected ${TokenKind[kind]}`,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import { disableRSP, enableRSP } from "./installer.js"
|
|||
import { Log } from "../PreCompile.js"
|
||||
import path from "path"
|
||||
import { API_events } from "../../components/API.js"
|
||||
import { Parser } from "../bindings/Parser.js"
|
||||
|
||||
async function buildUI() {
|
||||
const build = Memory.build()
|
||||
|
|
@ -40,7 +41,9 @@ async function buildUI() {
|
|||
),
|
||||
"utf-8",
|
||||
)
|
||||
.then(() => Log("INFO", `${outFile} with ${Object.keys(value).length} elements created!`))
|
||||
.then(() =>
|
||||
Log("INFO", `${outFile.replace(/\\/g, "/")} with ${Object.keys(value).length} elements created!`),
|
||||
)
|
||||
build.delete(file)
|
||||
return file
|
||||
}),
|
||||
|
|
@ -58,12 +61,15 @@ async function buildUI() {
|
|||
fs
|
||||
.stat(`${buildFolder}/pack_icon.png`)
|
||||
.catch(() =>
|
||||
fs.copyFile(
|
||||
isTestMode ? "resources/pack_icon.png" : "node_modules/asajs/resources/pack_icon.png",
|
||||
`${buildFolder}/pack_icon.png`,
|
||||
),
|
||||
fs
|
||||
.copyFile(
|
||||
isTestMode
|
||||
? "resources/pack_icon.png"
|
||||
: path.join(process.cwd(), "node_modules/asajs/resources/pack_icon.png"),
|
||||
`${buildFolder}/pack_icon.png`,
|
||||
)
|
||||
.then(() => Log("INFO", `${buildFolder}/pack_icon.png copied!`)),
|
||||
)
|
||||
.then(() => Log("INFO", `${buildFolder}/pack_icon.png copied!`))
|
||||
.catch(() => Log("WARN", `cannot copy ${buildFolder}/pack_icon.png!`)),
|
||||
]).catch(error => console.error(error))
|
||||
|
||||
|
|
@ -75,6 +81,10 @@ if (isBuildMode) {
|
|||
process.on("beforeExit", async () => {
|
||||
if (first) {
|
||||
first = false
|
||||
if (Parser.hasError) {
|
||||
console.error()
|
||||
return
|
||||
}
|
||||
await createBuildFolder()
|
||||
await buildUI()
|
||||
if (isLinkMode) await linkToGame()
|
||||
|
|
|
|||
Reference in a new issue