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

Commit

Permalink
fix copy dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Bao Zhiyuan committed Oct 29, 2024
1 parent d21cf25 commit b9c340c
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/build.mts
Original file line number Diff line number Diff line change
Expand Up @@ -536,11 +536,25 @@ for (const [teamName, metaInfo] of metaInfos) {
const gameIndex = gameIndexHtml(teamName, metaInfo)
fs.mkdirSync(`dist/${teamName}`)
copyWasm4(teamName)
for (const file of fs.readdirSync(`teams/${teamName}`)) {
fs.copyFileSync(
`teams/${teamName}/${file}`,
`dist/${teamName}/${file === 'game.wasm' ? 'cart.wasm' : file}`,
)
for (const dirent of fs.readdirSync(`teams/${teamName}`, {
withFileTypes: true,
})) {
if (dirent.isDirectory()) {
fs.cpSync(
`teams/${teamName}/${dirent.name}`,
`dist/${teamName}/${dirent.name}`,
{
recursive: true,
},
)
} else {
fs.copyFileSync(
`teams/${teamName}/${dirent.name}`,
`dist/${teamName}/${
dirent.name === 'game.wasm' ? 'cart.wasm' : dirent.name
}`,
)
}
}
fs.writeFileSync(`dist/${teamName}/index.html`, gameIndex)
}

0 comments on commit b9c340c

Please sign in to comment.