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

Commit

Permalink
change folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Bao Zhiyuan committed Aug 29, 2024
1 parent dd40a85 commit ac754be
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/.dist
/index.html
/dist
18 changes: 9 additions & 9 deletions .src/build.mjs → src/build.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import fs from 'node:fs'

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

const games = fs
.readdirSync('.', { withFileTypes: true })
.filter(d => d.isDirectory() && !d.name.startsWith('.'))
.readdirSync('teams', { withFileTypes: true })
.filter(d => d.isDirectory())
.map(d => d.name)

const gameCards = games
Expand Down Expand Up @@ -46,9 +46,9 @@ const index = /*html*/ `
</html>
`

fs.writeFileSync('.dist/index.html', index)
fs.writeFileSync('dist/index.html', index)

const wasm4Files = fs.readdirSync('.templates/wasm4')
const wasm4Files = fs.readdirSync('templates/wasm4')

for (const game of games) {
const gameIndex = /*html*/ `
Expand All @@ -66,8 +66,8 @@ for (const game of games) {
`
fs.mkdirSync(`.dist/${game}`)
for (const file of wasm4Files) {
fs.copyFileSync(`.templates/wasm4/${file}`, `.dist/${game}/${file}`)
fs.copyFileSync(`templates/wasm4/${file}`, `dist/${game}/${file}`)
}
fs.copyFileSync(`${game}/game.wasm`, `.dist/${game}/cart.wasm`)
fs.writeFileSync(`.dist/${game}/index.html`, gameIndex)
fs.copyFileSync(`${game}/game.wasm`, `dist/${game}/cart.wasm`)
fs.writeFileSync(`dist/${game}/index.html`, gameIndex)
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ac754be

Please sign in to comment.