Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ae1a9e3

Browse files
author
ChenYong
committed
minimal example
0 parents commit ae1a9e3

File tree

7 files changed

+124
-0
lines changed

7 files changed

+124
-0
lines changed

‎.gitattributes‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
yarn.lock -diff

‎.gitignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
node_modules/
3+
compiled/
4+
target/

‎README.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Node.js example for [shadow-cljs](https://github.com/thheller/shadow-cljs)
3+
----
4+
5+
### Develop
6+
7+
With hot code swapping support:
8+
9+
```bash
10+
yarn watch
11+
# another tty
12+
node compiled/main.js
13+
```
14+
15+
### Build
16+
17+
```bash
18+
yarn compile
19+
```
20+
21+
Compiles to `compiled/`.
22+
23+
### Steps
24+
25+
* add `shadow-cljs` field in `package.json` to specify `source-paths`
26+
* add `shadow-cljs.edn` to config compilation
27+
* run `node compiled/main.js` to start app and connect reload server
28+
29+
### License
30+
31+
MIT

‎package.json‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "minimal-shadow-cljs-nodejs",
3+
"version": "0.1.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"watch": "shadow-cljs --dev",
8+
"compile": "shadow-cljs --once"
9+
},
10+
"keywords": [],
11+
"shadow-cljs": {
12+
"source-paths": [
13+
"src"
14+
],
15+
"output-dir": "compiled",
16+
"dependencies": []
17+
},
18+
"author": "jiyinyiyong",
19+
"license": "MIT",
20+
"devDependencies": {
21+
"shadow-cljs": "^0.8.0",
22+
"source-map-support": "^0.4.15",
23+
"ws": "^3.0.0"
24+
}
25+
}

‎shadow-cljs.edn‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[{:id :npm
2+
:target :node-script
3+
:output-dir "compiled"
4+
:output-to "compiled/main.js"
5+
:main server.main/main
6+
:devtools {:after-load server.main/on-reload}}]

‎src/server/main.cljs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
(ns server.main)
3+
4+
(def value-a 1)
5+
6+
(defonce value-b 2)
7+
8+
(defn on-reload []
9+
(println "Code updated.")
10+
(println "Trying values:" value-a value-b))
11+
12+
(defn main []
13+
(println "App loaded!"))

‎yarn.lock‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+
# yarn lockfile v1
3+
4+
5+
bencode@^0.12.0:
6+
version "0.12.0"
7+
resolved "https://registry.yarnpkg.com/bencode/-/bencode-0.12.0.tgz#bc879c476d864453d2479519e44c64b347a59b3a"
8+
9+
safe-buffer@~5.0.1:
10+
version "5.0.1"
11+
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.0.1.tgz#d263ca54696cd8a306b5ca6551e92de57918fbe7"
12+
13+
shadow-cljs-jar@^0.4.0:
14+
version "0.4.0"
15+
resolved "https://registry.yarnpkg.com/shadow-cljs-jar/-/shadow-cljs-jar-0.4.0.tgz#88cd4d0af7199abfd85add1f06eba679512d6a17"
16+
17+
shadow-cljs@^0.8.0:
18+
version "0.8.0"
19+
resolved "https://registry.yarnpkg.com/shadow-cljs/-/shadow-cljs-0.8.0.tgz#cf82464a9605ff78b8200bd53f47d5cefac46c4c"
20+
dependencies:
21+
bencode "^0.12.0"
22+
shadow-cljs-jar "^0.4.0"
23+
24+
source-map-support@^0.4.15:
25+
version "0.4.15"
26+
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.15.tgz#03202df65c06d2bd8c7ec2362a193056fef8d3b1"
27+
dependencies:
28+
source-map "^0.5.6"
29+
30+
source-map@^0.5.6:
31+
version "0.5.6"
32+
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412"
33+
34+
ultron@~1.1.0:
35+
version "1.1.0"
36+
resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.0.tgz#b07a2e6a541a815fc6a34ccd4533baec307ca864"
37+
38+
ws@^3.0.0:
39+
version "3.0.0"
40+
resolved "https://registry.yarnpkg.com/ws/-/ws-3.0.0.tgz#98ddb00056c8390cb751e7788788497f99103b6c"
41+
dependencies:
42+
safe-buffer "~5.0.1"
43+
ultron "~1.1.0"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /