diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5c3b425 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +examples/*.rkt.js +/node_modules/ +/build diff --git a/Dockerfile b/Dockerfile index bfe5923..dcb13d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,8 @@ RUN apt-get update -y --allow-releaseinfo-change \ && apt-get install -y --no-install-recommends xz-utils make \ && apt-get clean +RUN apt-get -y install git + WORKDIR /app RUN curl -O https://nodejs.org/dist/v18.16.0/node-v18.16.0-linux-x64.tar.xz RUN tar xvf node-v18.16.0-linux-x64.tar.xz -C . @@ -12,9 +14,15 @@ ENV PATH="/app/node-v18.16.0-linux-x64/bin:${PATH}" RUN npm install -g js-beautify COPY . /app/racketscript-playground +RUN cd racketscript-playground && npm install + ENV PATH="/root/.local/share/racket/8.7/bin/:${PATH}" RUN raco pkg install --auto racketscript +RUN git clone https://github.com/leiDnedyA/rackt \ + && cd rackt && git checkout cdn-import \ + && raco pkg install + WORKDIR /app/racketscript-playground RUN make build || true CMD ["make", "run-forever"] diff --git a/examples/rackt-counter.rkt b/examples/rackt-counter.rkt new file mode 100644 index 0000000..8e4e5fd --- /dev/null +++ b/examples/rackt-counter.rkt @@ -0,0 +1,42 @@ +#lang racketscript/base + +(require rackt) + +;; +;; Uses a slightly modified version of the rackt module, a lightweight react wrapper +;; for racketscript. +;; Check it out @ https://github.com/rackt-org/rackt +;; + +(define root (#js*.document.createElement #js"div")) +($/:= #js.root.id #js"root") +(#js*.document.body.appendChild root) + +(define (header props ..) + (Tetris
  • Archery
  • Wordle
  • +
  • React Counter
  • diff --git a/static/modules/index.html b/static/modules/index.html index 7036bdf..7a8f983 100644 --- a/static/modules/index.html +++ b/static/modules/index.html @@ -10,6 +10,9 @@ window.parent.postMessage('run-iframe-init', window.location.origin); }); + + + diff --git a/static/rackt b/static/rackt new file mode 120000 index 0000000..2643024 --- /dev/null +++ b/static/rackt @@ -0,0 +1 @@ +../build/runtime/rackt \ No newline at end of file diff --git a/stub.rkt b/stub.rkt index 271be68..5e9de62 100644 --- a/stub.rkt +++ b/stub.rkt @@ -5,7 +5,8 @@ (require racketscript/interop racketscript/browser racketscript/htdp/image - racketscript/htdp/universe) + racketscript/htdp/universe + rackt) ;; interop assoc->object @@ -55,3 +56,7 @@ vector-member ;; string string-contains? + +;; rackt +