Node.js example with ClojureScript with shadow-cljs
Install all dependencies.
npm run install
Watch compile with with hot reloading, using the browser
target as example.
npm run watch:browser
Start program and connect reload server:
npm run start:browser
Build production builds for each target.
# Build all targets
npm run release
# or
npm run release:app
npm run release:library
npm run release:browser
npm run release:browser
This will generate a file inside build/browser/browser-main.js
, and copy a static index.html
which loads the script.
The browser-main.js
file contains your JavaScript logic, so copy that into your server and load it into your main website HTML.
npm run release:app
Compiles the Node app, :app
target, to build/node-app.js
.
Apart from the main Node script/app generated, we can also generate a library in the standard commonjs
format that can be used in other Node/JavaScript projects, or as a handler in AWS Lambda.
npm run release:library
Start a REPL connected to current running program, app
for the :build-id
:
npx shadow-cljs cljs-repl app
Using Lumo-cljs allows us to run scripts before fully building with shadow-cljs
to test things out.
The lumo -m <ns-namespace>
command tries to execute the -main
function inside the given <ns-namespace>
.
npx lumo -c "src" -m "server.main"
MIT