Skip to content

Commit

Permalink
fix: add server script
Browse files Browse the repository at this point in the history
  • Loading branch information
filipesilva committed Nov 23, 2019
1 parent 85b8711 commit 015cf3c
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ See the ClojureScript [testing page](https://clojurescript.org/tools/testing) fo
Builds the app for production to the `public` folder.<br>
It correctly bundles all code and optimizes the build for the best performance.

### `npm run server` or `yarn server`

Starts a Shadow CLJS background server.<br>
This will speed up starting time for other commands that use Shadow CLJS.

## License

Create CLJS App is open source software [licensed as MIT](https://github.com/filipesilva/create-cljs-app/blob/master/LICENSE).
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"scripts": {
"sc": "shadow-cljs",
"server": "shadow-cljs stop && shadow-cljs start",
"start": "shadow-cljs watch lib",
"build": "yarn clean && shadow-cljs release lib",
"test": "shadow-cljs watch test --config-merge \"{:autorun true}\"",
Expand Down
5 changes: 3 additions & 2 deletions src/create_cljs_app/template.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Will likely need to be replaced with a proper templating library."
"public/index.html" [{:from "__NAME__" :to name}]
"src/app/core.cljs" [{:from "__NAME__" :to name}]
"README.md" [{:from "__START__" :to (:start commands)}
{:from "__SERVER__" :to (:server commands)}
{:from "__TEST__" :to (:test commands)}
{:from "__TEST:ONCE__" :to (:test:once commands)}
{:from "__E2E__" :to (:e2e commands)}
Expand Down Expand Up @@ -68,8 +69,8 @@ Will likely need to be replaced with a proper templating library."

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

(defn use-template
"Create an app from a template into."
Expand Down
2 changes: 2 additions & 0 deletions src/create_cljs_app/utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
[use-yarn]
(if use-yarn
{:start "yarn start"
:server "yarn server"
:build "yarn build"
:test "yarn test"
:test:once "yarn test:once"
:e2e "yarn e2e"
:lint "yarn lint"
:format "yarn format"}
{:start "npm start"
:server "npm run server"
:build "npm run build"
:test "npm test"
:test:once "npm run test:once"
Expand Down
1 change: 1 addition & 0 deletions src/e2e/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
(is (not (fileIncludes "./public/index.html" "__NAME__")))
(is (not (fileIncludes "./src/app/core.cljs" "__NAME__")))
(is (not (fileIncludes "./README.md" "__START__")))
(is (not (fileIncludes "./README.md" "__SERVER__")))
(is (not (fileIncludes "./README.md" "__TEST__")))
(is (not (fileIncludes "./README.md" "__TEST:ONCE__")))
(is (not (fileIncludes "./README.md" "__E2E__")))
Expand Down
5 changes: 5 additions & 0 deletions template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ It correctly bundles all code and optimizes the build for the best performance.

Your app is ready to be deployed!

### `__SERVER__`

Starts a Shadow CLJS background server.<br>
This will speed up starting time for other commands that use Shadow CLJS.

## Useful resources

Clojurians Slack http://clojurians.net/.
Expand Down
1 change: 1 addition & 0 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"scripts": {
"sc": "shadow-cljs",
"server": "shadow-cljs stop && shadow-cljs start",
"start": "shadow-cljs watch app",
"build": "yarn clean && shadow-cljs release app",
"test": "shadow-cljs watch test --config-merge \"{:autorun true}\"",
Expand Down

0 comments on commit 015cf3c

Please sign in to comment.