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

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Bao Zhiyuan committed Aug 29, 2024
1 parent db5b1b4 commit 24b4b47
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .src/build.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import fs from 'node:fs'

const PREFIX = 'MoonBit-Code-JAM-2024'

fs.rmSync('.dist', { recursive: true, force: true })
fs.mkdirSync('.dist')

Expand All @@ -8,7 +10,7 @@ const games = fs
.filter(d => d.isDirectory() && !d.name.startsWith('.'))
.map(d => d.name)

const lis = games.map(d => `<li><a href='/${d}'>${d}</a></li>`)
const lis = games.map(d => `<li><a href='${PREFIX}/${d}'>${d}</a></li>`)

const index = /*html*/ `
<!DOCTYPE html>
Expand Down Expand Up @@ -48,5 +50,6 @@ for (const game of games) {
for (const file of wasm4Files) {
fs.copyFileSync(`.templates/wasm4/${file}`, `.dist/${game}/${file}`)
}
fs.copyFileSync(`${game}/game.wasm`, `.dist/${game}/cart.wasm`)
fs.writeFileSync(`.dist/${game}/index.html`, gameIndex)
}

0 comments on commit 24b4b47

Please sign in to comment.