From 478d0347f28a75b558239d6f60023250a3532a50 Mon Sep 17 00:00:00 2001 From: Scott Richmond Date: Fri, 1 Dec 2023 19:56:22 -0500 Subject: [PATCH] Stand up stub of npm export --- package.json | 24 ++++++++---------------- shadow-cljs.edn | 5 ++--- src/ludus/node.cljs | 17 +++++++++++++++++ 3 files changed, 27 insertions(+), 19 deletions(-) create mode 100644 src/ludus/node.cljs diff --git a/package.json b/package.json index 86a99d1..2f08378 100644 --- a/package.json +++ b/package.json @@ -1,22 +1,14 @@ { - "name": "ludus", - "version": "1.0.0", - "description": "![Ludus logo](logo.png) ## Ludus: A friendly, dynamic, functional language", - "main": "index.js", - "directories": { - "doc": "doc", - "test": "test" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, + "name": "@ludus/ludus", + "version": "0.1.0-ALPHA", + "description": "Ludus: A friendly, dynamic, functional language", + "main": "target/js/ludus.js", + "directories": {}, "keywords": [], - "author": "", - "license": "ISC", + "author": "Scott Richmond", + "license": "GPL-3.0", "devDependencies": { "shadow-cljs": "^2.26.0" }, - "dependencies": { - "p5": "^1.8.0" - } + "dependencies": {} } diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 557d28a..82e7eeb 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -6,9 +6,8 @@ :builds {:node {:target :node-library :output-to "target/js/ludus.js" - :exports-fn ludus.core/run - :asset-path "/js" - :modules {:main {:entries [ludus.core]}}} + :exports {:run ludus.node/run} + :modules {:main {:entries [ludus.node]}}} :browser {:target :browser :output-dir "target/js" :asset-path "target" diff --git a/src/ludus/node.cljs b/src/ludus/node.cljs new file mode 100644 index 0000000..0b2c337 --- /dev/null +++ b/src/ludus/node.cljs @@ -0,0 +1,17 @@ +(ns ludus.node + ; (:require [ludus.interpreter :as i] + ; [ludus.grammar :as g] + ; [ludus.parser :as p] + ; [ludus.scanner :as s]) + ) + +(defn run [source] + (println "Running source!") + (println "(This is a stub.)") + (clj->js { + :result "Hello, world!" + :errors [{:msg "An error"}, {:msg "Another error"}] + :console ["Here's a log.", "Here's another log."] + :draw [[:background 0] + [:fill 255] + [:rect 10 10 50 50]]})) \ No newline at end of file