This repository has been archived by the owner on Nov 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bao Zhiyuan
committed
Aug 29, 2024
1 parent
55966e6
commit db5b1b4
Showing
8 changed files
with
136 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/.dist | ||
/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v22.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import fs from 'node:fs' | ||
|
||
fs.rmSync('.dist', { recursive: true, force: true }) | ||
fs.mkdirSync('.dist') | ||
|
||
const games = fs | ||
.readdirSync('.', { withFileTypes: true }) | ||
.filter(d => d.isDirectory() && !d.name.startsWith('.')) | ||
.map(d => d.name) | ||
|
||
const lis = games.map(d => `<li><a href='/${d}'>${d}</a></li>`) | ||
|
||
const index = /*html*/ ` | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>MoonBit Code JAM 2024</title> | ||
</head> | ||
<body> | ||
<ul> | ||
${lis} | ||
</ul> | ||
</body> | ||
</html> | ||
` | ||
|
||
fs.writeFileSync('.dist/index.html', index) | ||
|
||
const wasm4Files = fs.readdirSync('.templates/wasm4') | ||
|
||
for (const game of games) { | ||
const gameIndex = /*html*/ ` | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>${game}</title> | ||
</head> | ||
<body> | ||
<iframe src="./game.html" frameborder="0" width="600" height="600"></iframe> | ||
</body> | ||
</html> | ||
` | ||
fs.mkdirSync(`.dist/${game}`) | ||
for (const file of wasm4Files) { | ||
fs.copyFileSync(`.templates/wasm4/${file}`, `.dist/${game}/${file}`) | ||
} | ||
fs.writeFileSync(`.dist/${game}/index.html`, gameIndex) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" | ||
/> | ||
<link rel="shortcut icon" href="https://wasm4.org/img/favicon.ico" /> | ||
<title>WASM-4 Cart</title> | ||
<link rel="stylesheet" href="wasm4.css" /> | ||
</head> | ||
<body> | ||
<div id="devtools"></div> | ||
<script src="wasm4.js"></script> | ||
<wasm4-app></wasm4-app> | ||
</body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.