Skip to content

Commit

Permalink
[js] work-in-progress JS version
Browse files Browse the repository at this point in the history
  • Loading branch information
shish committed Dec 11, 2022
1 parent 6a799e0 commit 4dcf5ac
Show file tree
Hide file tree
Showing 24 changed files with 7,394 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ jobs:
/nix
key: ${{ inputs.workdir }}-nix-${{ hashFiles(format('{0}/shell.nix', inputs.workdir)) }}
restore-keys: ${{ inputs.workdir }}-nix-
- name: Install Pkgs
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libc-bin
version: nix-apt
- name: Install Deps
uses: cachix/install-nix-action@v15
with:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Javascript

on:
push:
branches:
- master
paths:
- 'js/**'
- '.github/workflows/js.yml'
pull_request:
paths:
- 'js/**'
- '.github/workflows/js.yml'
workflow_dispatch:

jobs:
common:
name: Common
uses: ./.github/workflows/common.yml
with:
workdir: js
format-pkgs: nodejs libsdl2-dev
build-pkgs: nodejs libsdl2-dev libc-bin
cache-paths: |
js/node_modules
cache-file: '**/package-lock.json'
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ $ ./utils/bench.py
cpp / debug : Emulated 5693 frames in 10.00s (569fps)
go / release: Emulated 5040 frames in 10.00s (504fps)
pxd / release: Emulated 3792 frames in 10.00s (379fps)
js / release: Emulated 2436 frames in 10.00s (243fps) # missing GPU
nim / debug : Emulated 1968 frames in 10.00s (196fps)
rs / debug : Emulated 1676 frames in 10.00s (168fps)
py / mypyc : Emulated 887 frames in 10.01s (89fps)
Expand Down
3 changes: 3 additions & 0 deletions js/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.parcel-cache
dist
15 changes: 15 additions & 0 deletions js/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -eu

cd $(dirname $0)
if [ ! -d node_modules ] ; then
npm install
fi
npm run build

cat >rosettaboy-release <<EOD
#!/usr/bin/env bash
set -eu
/usr/bin/catchsegv node "\$(dirname \$0)/dist/index.js" \$*
EOD
chmod +x rosettaboy-release
7 changes: 7 additions & 0 deletions js/format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -eu

if [ ! -d node_modules ] ; then
npm install
fi
npm run format
Loading

0 comments on commit 4dcf5ac

Please sign in to comment.