Skip to content

Commit 015cf3c

Browse files
committed
fix: add server script
1 parent 85b8711 commit 015cf3c

File tree

7 files changed

+18
-2
lines changed

7 files changed

+18
-2
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ See the ClojureScript [testing page](https://clojurescript.org/tools/testing) fo
112112
Builds the app for production to the `public` folder.<br>
113113
It correctly bundles all code and optimizes the build for the best performance.
114114

115+
### `npm run server` or `yarn server`
116+
117+
Starts a Shadow CLJS background server.<br>
118+
This will speed up starting time for other commands that use Shadow CLJS.
119+
115120
## License
116121

117122
Create CLJS App is open source software [licensed as MIT](https://github.com/filipesilva/create-cljs-app/blob/master/LICENSE).

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
},
1212
"scripts": {
1313
"sc": "shadow-cljs",
14+
"server": "shadow-cljs stop && shadow-cljs start",
1415
"start": "shadow-cljs watch lib",
1516
"build": "yarn clean && shadow-cljs release lib",
1617
"test": "shadow-cljs watch test --config-merge \"{:autorun true}\"",

src/create_cljs_app/template.cljs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Will likely need to be replaced with a proper templating library."
2020
"public/index.html" [{:from "__NAME__" :to name}]
2121
"src/app/core.cljs" [{:from "__NAME__" :to name}]
2222
"README.md" [{:from "__START__" :to (:start commands)}
23+
{:from "__SERVER__" :to (:server commands)}
2324
{:from "__TEST__" :to (:test commands)}
2425
{:from "__TEST:ONCE__" :to (:test:once commands)}
2526
{:from "__E2E__" :to (:e2e commands)}
@@ -68,8 +69,8 @@ Will likely need to be replaced with a proper templating library."
6869

6970
(defn copy-files
7071
"Copy files from one directory to another, preserving folder structure."
71-
[files from to get-template-values-map]
72-
(doall (map #(copy-file from to % (get get-template-values-map %)) files)))
72+
[files from to template-values-map]
73+
(doall (map #(copy-file from to % (get template-values-map %)) files)))
7374

7475
(defn use-template
7576
"Create an app from a template into."

src/create_cljs_app/utils.cljs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
[use-yarn]
1414
(if use-yarn
1515
{:start "yarn start"
16+
:server "yarn server"
1617
:build "yarn build"
1718
:test "yarn test"
1819
:test:once "yarn test:once"
1920
:e2e "yarn e2e"
2021
:lint "yarn lint"
2122
:format "yarn format"}
2223
{:start "npm start"
24+
:server "npm run server"
2325
:build "npm run build"
2426
:test "npm test"
2527
:test:once "npm run test:once"

src/e2e/core.cljs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
(is (not (fileIncludes "./public/index.html" "__NAME__")))
4040
(is (not (fileIncludes "./src/app/core.cljs" "__NAME__")))
4141
(is (not (fileIncludes "./README.md" "__START__")))
42+
(is (not (fileIncludes "./README.md" "__SERVER__")))
4243
(is (not (fileIncludes "./README.md" "__TEST__")))
4344
(is (not (fileIncludes "./README.md" "__TEST:ONCE__")))
4445
(is (not (fileIncludes "./README.md" "__E2E__")))

template/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ It correctly bundles all code and optimizes the build for the best performance.
3636

3737
Your app is ready to be deployed!
3838

39+
### `__SERVER__`
40+
41+
Starts a Shadow CLJS background server.<br>
42+
This will speed up starting time for other commands that use Shadow CLJS.
43+
3944
## Useful resources
4045

4146
Clojurians Slack http://clojurians.net/.

template/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"private": true,
55
"scripts": {
66
"sc": "shadow-cljs",
7+
"server": "shadow-cljs stop && shadow-cljs start",
78
"start": "shadow-cljs watch app",
89
"build": "yarn clean && shadow-cljs release app",
910
"test": "shadow-cljs watch test --config-merge \"{:autorun true}\"",

0 commit comments

Comments
 (0)