Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
enable sourcemap by default in create-kaboom
Browse files Browse the repository at this point in the history
  • Loading branch information
slmjkdbtl committed Mar 24, 2024
1 parent 1ec399e commit 452a200
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 37 deletions.
2 changes: 1 addition & 1 deletion pkgs/create/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ create(dir(dest, [
"name": dest,
"scripts": {
"build": `esbuild --bundle src/main.${ext} --outfile=www/main.js --minify`,
"dev": `esbuild --bundle src/main.${ext} --outfile=www/main.js --servedir=www`,
"dev": `esbuild --bundle --sourcemap --keep-names src/main.${ext} --outfile=www/main.js --servedir=www`,
"bundle": "npm run build && mkdir -p dist && zip -r dist/game.zip www -x \"**/.DS_Store\"",
...(ts ? {
"check": "tsc",
Expand Down
66 changes: 30 additions & 36 deletions scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,35 @@ await build()
const port = process.env.PORT || 8001
const server = serve({ port: port })

const run = async () => {

let failed = false
console.log("launching browser")
const browser = await puppeteer.launch()
console.log("getting examples list")
const examples = (await fs.readdir("examples"))
.filter((p) => !p.startsWith(".") && p.endsWith(".js"))
.map((d) => path.basename(d, ".js"))
// particle example crashes puppeteer in github action for some reason
.filter((e) => e !== "particle")

for (const example of examples) {
console.log(`testing example "${example}"`)
const page = await browser.newPage()
page.on("pageerror", (err) => {
failed = true
console.error(example, err)
})
page.on("error", (err) => {
failed = true
console.error(example, err)
})
await page.goto(`http://localhost:${port}/${example}`)
await page.addScriptTag({ path: "scripts/autoinput.js" })
await wait(1000)
await page.close()
}

browser.close()
server.close()

console.log(failed ? "fail" : "success")
process.exit(failed ? 1 : 0)

let failed = false
console.log("launching browser")
const browser = await puppeteer.launch()
console.log("getting examples list")
const examples = (await fs.readdir("examples"))
.filter((p) => !p.startsWith(".") && p.endsWith(".js"))
.map((d) => path.basename(d, ".js"))
// particle example crashes puppeteer in github action for some reason
.filter((e) => e !== "particle")

for (const example of examples) {
console.log(`testing example "${example}"`)
const page = await browser.newPage()
page.on("pageerror", (err) => {
failed = true
console.error(example, err)
})
page.on("error", (err) => {
failed = true
console.error(example, err)
})
await page.goto(`http://localhost:${port}/${example}`)
await page.addScriptTag({ path: "scripts/autoinput.js" })
await wait(1000)
await page.close()
}

run()
browser.close()
server.close()

console.log(failed ? "fail" : "success")
process.exit(failed ? 1 : 0)

0 comments on commit 452a200

Please sign in to comment.