diff --git a/build/assets/index-itch.html b/build/assets/index-itch.html
new file mode 100644
index 0000000..ca42d25
--- /dev/null
+++ b/build/assets/index-itch.html
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build/build.ts b/build/build.ts
index 93dc29e..f8e7a59 100644
--- a/build/build.ts
+++ b/build/build.ts
@@ -9,9 +9,12 @@ import { isGame, getGames } from './isGame';
const outDir = path.resolve(import.meta.dir, '..', 'dist');
await fs.mkdir(outDir, { recursive: true });
-let game = process.argv[2];
const publish = process.env.PUBLISH_LOCATION;
+const args = process.argv.slice(2);
+const itch = args.includes('--itch');
+let game = args.find(a => !a.startsWith('-')) ?? '';
+
while (!await isGame(game)) {
game = await select({
message: 'Game to build:',
@@ -19,7 +22,7 @@ while (!await isGame(game)) {
});
}
console.log(`Building ${game}...`);
-const html = await buildHTML(game, { production: true });
+const html = await buildHTML(game, { production: true, itch });
if (!html) {
process.exit(1);
@@ -27,7 +30,7 @@ if (!html) {
const filePath = path.resolve(outDir, `${game}.html`);
await Bun.write(filePath, html);
-if (publish) {
+if (publish && !itch) {
console.log(`Publishing ${game}...`);
const result = await $`scp "${filePath}" "${publish}${game}.html"`;
if (result.exitCode === 0) {
diff --git a/build/html.ts b/build/html.ts
index e595a40..b24b4b0 100644
--- a/build/html.ts
+++ b/build/html.ts
@@ -13,10 +13,11 @@ import { getGames } from './isGame';
interface Args {
production?: boolean;
portable?: boolean;
- mobile?: boolean
+ mobile?: boolean;
+ itch?: boolean;
}
-export async function buildHTML(game: string, { production = false, portable = false, mobile = false }: Args = {}) {
- const html = await Bun.file(path.resolve(import.meta.dir, 'assets', 'index.html')).text();
+export async function buildHTML(game: string, { production = false, portable = false, mobile = false, itch = false }: Args = {}) {
+ const html = await Bun.file(path.resolve(import.meta.dir, 'assets', itch ? 'index-itch.html' : 'index.html')).text();
const bundle = await Bun.build({
outdir: '/tmp',
entrypoints: [path.resolve(import.meta.dir, '..', 'src', 'index.ts')],
@@ -110,7 +111,7 @@ export async function buildHTML(game: string, { production = false, portable = f
.replace('', () => title)
.replace('', () => icon)
.replace('', () => manifest)
- .replace('/*$STYLE$*/', () => style);
+ .replace('/*$STYLE$*/', () => style);
return minify(resultHTML, {
collapseWhitespace: production,