@@ -7,47 +7,78 @@ Node.js example with ClojureScript with [shadow-cljs](https://github.com/thhelle
7
7
8
8
### Develop
9
9
10
- Watch compile with with hot reloading:
10
+ Install all dependencies.
11
11
12
12
``` bash
13
13
npm run install
14
- npm run watch
14
+ ```
15
+
16
+ Watch compile with with hot reloading, using the ` browser ` target as example.
17
+
18
+ ```
19
+ npm run watch:browser
15
20
```
16
21
17
22
Start program and connect reload server:
18
23
19
24
``` bash
20
- npm start
25
+ npm run start:browser
21
26
```
22
27
23
- ### REPL
28
+ ### Production release
24
29
25
- Start a REPL connected to current running program, ` app ` for the ` :build-id ` :
30
+ Build production builds for each target.
26
31
27
32
``` bash
28
- npx shadow-cljs cljs-repl app
33
+ # Build all targets
34
+ npm run release
35
+ # or
36
+ npm run release:app
37
+ npm run release:library
38
+ npm run release:browser
29
39
```
30
40
31
- ### Build
41
+ #### Browser
42
+
43
+ ```
44
+ npm run release:browser
45
+ ```
46
+
47
+ This will generate a file inside ` build/browser/browser-main.js ` , and copy a static ` index.html ` which loads the script.
48
+
49
+ The ` browser-main.js ` file contains your JavaScript logic, so copy that into your server and load it into your main website HTML.
50
+
51
+ - [ Browser target] ( https://shadow-cljs.github.io/docs/UsersGuide.html#target-browser )
52
+
53
+ #### Node application
32
54
33
- ``` bash
34
- npm run build
55
+ ```
56
+ npm run release:app
35
57
```
36
58
37
- Compiles to ` build/main .js ` .
59
+ Compiles the Node app, ` :app ` target, to ` build/node-app .js ` .
38
60
39
- You may find more configurations on http ://doc. shadow-cljs.org/ .
61
+ - [ Node application target ] ( https ://shadow-cljs.github.io/docs/UsersGuide.html#target-node-script )
40
62
41
- ### Build the library
63
+ #### Library
42
64
43
- 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 projects, or as a handler in AWS Lambda.
65
+ 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.
44
66
45
67
```
46
- npm run build:lib
68
+ npm run release:library
47
69
```
48
70
71
+ - [ Node library target] ( https://shadow-cljs.github.io/docs/UsersGuide.html#target-node-library )
49
72
- [ Multiple named exports] ( https://shadow-cljs.github.io/docs/UsersGuide.html#_multiple_static_named_exports )
50
73
74
+ ### REPL
75
+
76
+ Start a REPL connected to current running program, ` app ` for the ` :build-id ` :
77
+
78
+ ``` bash
79
+ npx shadow-cljs cljs-repl app
80
+ ```
81
+
51
82
### Run a script on the command line before building
52
83
53
84
Using [ Lumo-cljs] ( https://github.com/anmonteiro/lumo ) allows us to run scripts before fully building with ` shadow-cljs ` to test things out.
0 commit comments