Skip to content

Commit

Permalink
Deploying to gh-pages from @ 74ab459 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
stasm committed Mar 3, 2024
1 parent c87f82e commit 7efa902
Show file tree
Hide file tree
Showing 3,100 changed files with 370,703 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
47 changes: 47 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
EXAMPLE ?= src
SOURCES := $(shell find .. -type f -name "*.ts")

all: index.html
@printf "Size gzipped: %s bytes\n" $(shell gzip index.html --stdout | wc -c)

game.esbuild.js: $(SOURCES)
# Remove --noEmit to emit *.js files next to the source *.ts files. index.ts
# will then import the emitted *.js files. This may produce a smaller build
# because the bundle will be ordered differently.
npx tsc --noEmit
npx esbuild ../$(EXAMPLE)/index.ts \
--preserve-symlinks \
--define:DEBUG=false \
--target=es2022 \
--bundle \
--analyze \
> $@

game.sed.js: game.esbuild.js sed.txt
sed -f sed.txt $< > $@

game.terser.js: game.sed.js terser_compress.txt node_modules
npx --quiet terser $< \
--ecma 2022 \
--mangle toplevel \
--mangle-props keep_quoted,regex=/^[A-Z]/ \
--compress $(shell paste -sd, terser_compress.txt) \
> $@

game.roadroller.js: game.terser.js node_modules
# Set -O2 for better (and longer) compression.
npx --quiet roadroller -O1 --dirty $< -o $@

index.html: game.html game.roadroller.js game.css debug.css posthtml.cjs node_modules
node posthtml.cjs $< > $@

# On Ubuntu, install p7zip-full. See https://www.7-zip.org/download.html.
index.zip: index.html
7z a -mx=9 -mfb=256 -mpass=15 $@ $^

.PHONY: clean
clean:
rm -f *.js index.html index.zip

node_modules:
npm install
23 changes: 23 additions & 0 deletions debug.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#debug {
display: flex;
flex-flow: column nowrap;
align-items: flex-end;
position: absolute;
top: 0;
right: 0;
color: #fff;
font-family: monospace;
}
#debug button {
cursor: pointer;
padding: 0;
background: none;
border: none;
font: inherit;
color: inherit;
}
#debug div {
width: max-content;
background: #000;
color: #fff;
}
24 changes: 24 additions & 0 deletions game.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
html,
body {
overflow: hidden;
margin: 0;
}
canvas,
main {
position: absolute;
width: 100vw;
height: 100vh;
overflow: hidden;
word-break: break-word;
user-select: none;
touch-action: none;
}
[hidden] {
display: none;
}
[onclick] {
cursor: pointer;
}
.grabbing {
cursor: grabbing;
}
Loading

0 comments on commit 7efa902

Please sign in to comment.