1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,223 @@ |
1 |
+## Getting Started |
|
2 |
+ |
|
3 |
+### Project Overview |
|
4 |
+ |
|
5 |
+* Architecture: |
|
6 |
+[Single Page Application (SPA)](https://en.wikipedia.org/wiki/Single-page_application) |
|
7 |
+* Languages |
|
8 |
+ - Front end is [ClojureScript](https://clojurescript.org/) with ([re-frame](https://github.com/day8/re-frame)) |
|
9 |
+ - CSS compilation is [Garden](https://github.com/noprompt/garden) with [Spade](https://github.com/dhleong/spade) |
|
10 |
+* Dependencies |
|
11 |
+ - UI framework: [re-frame](https://github.com/day8/re-frame) |
|
12 |
+ ([docs](https://github.com/day8/re-frame/blob/master/docs/README.md), |
|
13 |
+ [FAQs](https://github.com/day8/re-frame/blob/master/docs/FAQs/README.md)) -> |
|
14 |
+ [Reagent](https://github.com/reagent-project/reagent) -> |
|
15 |
+ [React](https://github.com/facebook/react) |
|
16 |
+ - CSS rendering: [Garden](https://github.com/noprompt/garden) |
|
17 |
+* Build tools |
|
18 |
+ - CLJS compilation, dependency management, REPL, & hot reload: [`shadow-cljs`](https://github.com/thheller/shadow-cljs) |
|
19 |
+* Development tools |
|
20 |
+ - Debugging: [CLJS DevTools](https://github.com/binaryage/cljs-devtools), |
|
21 |
+ [`re-frame-10x`](https://github.com/day8/re-frame-10x) |
|
22 |
+ - Emacs integration: [CIDER](https://github.com/clojure-emacs/cider) |
|
23 |
+ - Linter: [clj-kondo](https://github.com/borkdude/clj-kondo) |
|
24 |
+ |
|
25 |
+#### Directory structure |
|
26 |
+ |
|
27 |
+* [`/`](/../../): project config files |
|
28 |
+* [`.clj-kondo/`](.clj-kondo/): lint config and cache files (cache files are not tracked; see |
|
29 |
+[`.gitignore`](.gitignore)) |
|
30 |
+* [`dev/`](dev/): source files compiled only with the [dev](#running-the-app) profile |
|
31 |
+ - [`user.cljs`](dev/cljs/user.cljs): symbols for use during development in the |
|
32 |
+[ClojureScript REPL](#connecting-to-the-browser-repl-from-a-terminal) |
|
33 |
+* [`resources/public/`](resources/public/): SPA root directory; |
|
34 |
+[dev](#running-the-app) / [prod](#production) profile depends on the most recent build |
|
35 |
+ - [`index.html`](resources/public/index.html): SPA home page |
|
36 |
+ - Dynamic SPA content rendered in the following `div`: |
|
37 |
+ ```html |
|
38 |
+ <div id="app"></div> |
|
39 |
+ ``` |
|
40 |
+ - Customizable; add headers, footers, links to other scripts and styles, etc. |
|
41 |
+ - Generated directories and files |
|
42 |
+ - Created on build with either the [dev](#running-the-app) or [prod](#production) profile |
|
43 |
+ - `js/compiled/`: compiled CLJS (`shadow-cljs`) |
|
44 |
+ - Not tracked in source control; see [`.gitignore`](.gitignore) |
|
45 |
+* [`src/dm/styles.cljs`](src/dm/styles.cljs): CSS compilation source file (ClojureScript, |
|
46 |
+[Garden](https://github.com/noprompt/garden)) |
|
47 |
+* [`src/dm/`](src/dm/): SPA source files (ClojureScript, |
|
48 |
+[re-frame](https://github.com/Day8/re-frame)) |
|
49 |
+ - [`core.cljs`](src/dm/core.cljs): contains the SPA entry point, `init` |
|
50 |
+* [`.github/workflows/`](.github/workflows/): contains the |
|
51 |
+[github actions](https://github.com/features/actions) pipelines. |
|
52 |
+ - [`test.yaml`](.github/workflows/test.yaml): Pipeline for testing. |
|
53 |
+ |
|
54 |
+ |
|
55 |
+### Editor/IDE |
|
56 |
+ |
|
57 |
+Use your preferred editor or IDE that supports Clojure/ClojureScript development. See |
|
58 |
+[Clojure tools](https://clojure.org/community/resources#_clojure_tools) for some popular options. |
|
59 |
+ |
|
60 |
+### Environment Setup |
|
61 |
+ |
|
62 |
+1. Install [JDK 8 or later](https://openjdk.java.net/install/) (Java Development Kit) |
|
63 |
+2. Install [Node.js](https://nodejs.org/) (JavaScript runtime environment) which should include |
|
64 |
+ [NPM](https://docs.npmjs.com/cli/npm) or if your Node.js installation does not include NPM also install it. |
|
65 |
+4. Install [clj-kondo](https://github.com/borkdude/clj-kondo/blob/master/doc/install.md) (linter) |
|
66 |
+5. Clone this repo and open a terminal in the `dm` project root directory |
|
67 |
+6. (Optional) Setup [lint cache](https://github.com/borkdude/clj-kondo#project-setup): |
|
68 |
+ ```sh |
|
69 |
+ clj-kondo --lint "$(npx shadow-cljs classpath)" |
|
70 |
+ ``` |
|
71 |
+7. Setup |
|
72 |
+[linting in your editor](https://github.com/borkdude/clj-kondo/blob/master/doc/editor-integration.md) |
|
73 |
+ |
|
74 |
+### Browser Setup |
|
75 |
+ |
|
76 |
+Browser caching should be disabled when developer tools are open to prevent interference with |
|
77 |
+[`shadow-cljs`](https://github.com/thheller/shadow-cljs) hot reloading. |
|
78 |
+ |
|
79 |
+Custom formatters must be enabled in the browser before |
|
80 |
+[CLJS DevTools](https://github.com/binaryage/cljs-devtools) can display ClojureScript data in the |
|
81 |
+console in a more readable way. |
|
82 |
+ |
|
83 |
+#### Chrome/Chromium |
|
84 |
+ |
|
85 |
+1. Open [DevTools](https://developers.google.com/web/tools/chrome-devtools/) (Linux/Windows: `F12` |
|
86 |
+or `Ctrl-Shift-I`; macOS: `⌘-Option-I`) |
|
87 |
+2. Open DevTools Settings (Linux/Windows: `?` or `F1`; macOS: `?` or `Fn+F1`) |
|
88 |
+3. Select `Preferences` in the navigation menu on the left, if it is not already selected |
|
89 |
+4. Under the `Network` heading, enable the `Disable cache (while DevTools is open)` option |
|
90 |
+5. Under the `Console` heading, enable the `Enable custom formatters` option |
|
91 |
+ |
|
92 |
+#### Firefox |
|
93 |
+ |
|
94 |
+1. Open [Developer Tools](https://developer.mozilla.org/en-US/docs/Tools) (Linux/Windows: `F12` or |
|
95 |
+`Ctrl-Shift-I`; macOS: `⌘-Option-I`) |
|
96 |
+2. Open [Developer Tools Settings](https://developer.mozilla.org/en-US/docs/Tools/Settings) |
|
97 |
+(Linux/macOS/Windows: `F1`) |
|
98 |
+3. Under the `Advanced settings` heading, enable the `Disable HTTP Cache (when toolbox is open)` |
|
99 |
+option |
|
100 |
+ |
|
101 |
+Unfortunately, Firefox does not yet support custom formatters in their devtools. For updates, follow |
|
102 |
+the enhancement request in their bug tracker: |
|
103 |
+[1262914 - Add support for Custom Formatters in devtools](https://bugzilla.mozilla.org/show_bug.cgi?id=1262914). |
|
104 |
+ |
|
105 |
+ |
|
106 |
+## Development |
|
107 |
+ |
|
108 |
+### Running the App |
|
109 |
+ |
|
110 |
+Start a temporary local web server, build the app with the `dev` profile, and serve the app, |
|
111 |
+browser test runner and karma test runner with hot reload: |
|
112 |
+ |
|
113 |
+```sh |
|
114 |
+npm install |
|
115 |
+npx shadow-cljs watch app |
|
116 |
+``` |
|
117 |
+ |
|
118 |
+Please be patient; it may take over 20 seconds to see any output, and over 40 seconds to complete. |
|
119 |
+ |
|
120 |
+When `[:app] Build completed` appears in the output, browse to |
|
121 |
+[http://localhost:8280/](http://localhost:8280/). |
|
122 |
+ |
|
123 |
+[`shadow-cljs`](https://github.com/thheller/shadow-cljs) will automatically push ClojureScript code |
|
124 |
+changes to your browser on save. To prevent a few common issues, see |
|
125 |
+[Hot Reload in ClojureScript: Things to avoid](https://code.thheller.com/blog/shadow-cljs/2019/08/25/hot-reload-in-clojurescript.html#things-to-avoid). |
|
126 |
+ |
|
127 |
+Opening the app in your browser starts a |
|
128 |
+[ClojureScript browser REPL](https://clojurescript.org/reference/repl#using-the-browser-as-an-evaluation-environment), |
|
129 |
+to which you may now connect. |
|
130 |
+ |
|
131 |
+#### Connecting to the browser REPL from Emacs with CIDER |
|
132 |
+ |
|
133 |
+Connect to the browser REPL: |
|
134 |
+``` |
|
135 |
+M-x cider-jack-in-cljs |
|
136 |
+``` |
|
137 |
+ |
|
138 |
+See |
|
139 |
+[Shadow CLJS User's Guide: Emacs/CIDER](https://shadow-cljs.github.io/docs/UsersGuide.html#cider) |
|
140 |
+for more information. Note that the mentioned [`.dir-locals.el`](.dir-locals.el) file has already |
|
141 |
+been created for you. |
|
142 |
+ |
|
143 |
+#### Connecting to the browser REPL from VS Code with Calva |
|
144 |
+ |
|
145 |
+See the [re-frame-template README](https://github.com/day8/re-frame-template) for [Calva](https://github.com/BetterThanTomorrow/calva) instuctions. See also https://calva.io for Calva documentation. |
|
146 |
+ |
|
147 |
+ |
|
148 |
+#### Connecting to the browser REPL from other editors |
|
149 |
+ |
|
150 |
+See |
|
151 |
+[Shadow CLJS User's Guide: Editor Integration](https://shadow-cljs.github.io/docs/UsersGuide.html#_editor_integration). |
|
152 |
+Note that `npm run watch` runs `npx shadow-cljs watch` for you, and that this project's running build ids is |
|
153 |
+`app`, `browser-test`, `karma-test`, or the keywords `:app`, `:browser-test`, `:karma-test` in a Clojure context. |
|
154 |
+ |
|
155 |
+Alternatively, search the web for info on connecting to a `shadow-cljs` ClojureScript browser REPL |
|
156 |
+from your editor and configuration. |
|
157 |
+ |
|
158 |
+For example, in Vim / Neovim with `fireplace.vim` |
|
159 |
+1. Open a `.cljs` file in the project to activate `fireplace.vim` |
|
160 |
+2. In normal mode, execute the `Piggieback` command with this project's running build id, `:app`: |
|
161 |
+ ```vim |
|
162 |
+ :Piggieback :app |
|
163 |
+ ``` |
|
164 |
+ |
|
165 |
+#### Connecting to the browser REPL from a terminal |
|
166 |
+ |
|
167 |
+1. Connect to the `shadow-cljs` nREPL: |
|
168 |
+ ```sh |
|
169 |
+ lein repl :connect localhost:8777 |
|
170 |
+ ``` |
|
171 |
+ The REPL prompt, `shadow.user=>`, indicates that is a Clojure REPL, not ClojureScript. |
|
172 |
+ |
|
173 |
+2. In the REPL, switch the session to this project's running build id, `:app`: |
|
174 |
+ ```clj |
|
175 |
+ (shadow.cljs.devtools.api/nrepl-select :app) |
|
176 |
+ ``` |
|
177 |
+ The REPL prompt changes to `cljs.user=>`, indicating that this is now a ClojureScript REPL. |
|
178 |
+3. See [`user.cljs`](dev/cljs/user.cljs) for symbols that are immediately accessible in the REPL |
|
179 |
+without needing to `require`. |
|
180 |
+ |
|
181 |
+### Running `shadow-cljs` Actions |
|
182 |
+ |
|
183 |
+See a list of [`shadow-cljs CLI`](https://shadow-cljs.github.io/docs/UsersGuide.html#_command_line) |
|
184 |
+actions: |
|
185 |
+```sh |
|
186 |
+npx shadow-cljs --help |
|
187 |
+``` |
|
188 |
+ |
|
189 |
+Please be patient; it may take over 10 seconds to see any output. Also note that some actions shown |
|
190 |
+may not actually be supported, outputting "Unknown action." when run. |
|
191 |
+ |
|
192 |
+Run a shadow-cljs action on this project's build id (without the colon, just `app`): |
|
193 |
+```sh |
|
194 |
+npx shadow-cljs <action> app |
|
195 |
+``` |
|
196 |
+### Debug Logging |
|
197 |
+ |
|
198 |
+The `debug?` variable in [`config.cljs`](src/cljs/dm/config.cljs) defaults to `true` in |
|
199 |
+[`dev`](#running-the-app) builds, and `false` in [`prod`](#production) builds. |
|
200 |
+ |
|
201 |
+Use `debug?` for logging or other tasks that should run only on `dev` builds: |
|
202 |
+ |
|
203 |
+```clj |
|
204 |
+(ns dm.example |
|
205 |
+ (:require [dm.config :as config]) |
|
206 |
+ |
|
207 |
+(when config/debug? |
|
208 |
+ (println "This message will appear in the browser console only on dev builds.")) |
|
209 |
+``` |
|
210 |
+ |
|
211 |
+## Production |
|
212 |
+ |
|
213 |
+Build the app with the `prod` profile: |
|
214 |
+ |
|
215 |
+```sh |
|
216 |
+npm install |
|
217 |
+npm run release |
|
218 |
+``` |
|
219 |
+ |
|
220 |
+Please be patient; it may take over 15 seconds to see any output, and over 30 seconds to complete. |
|
221 |
+ |
|
222 |
+The `resources/public/js/compiled` directory is created, containing the compiled `app.js` and |
|
223 |
+`manifest.edn` files. |
... | ... |
@@ -1,229 +1,18 @@ |
1 | 1 |
# DMR |
2 | 2 |
A web-based REPL for dungeon masters. |
3 |
-Inspired by https://initiative.sh |
|
4 |
- |
|
5 |
-### Dice notation |
|
6 |
-https://sophiehoulden.com/dice/documentation/notation.html |
|
7 |
- |
|
8 |
-## Getting Started |
|
9 |
- |
|
10 |
-### Project Overview |
|
11 |
- |
|
12 |
-* Architecture: |
|
13 |
-[Single Page Application (SPA)](https://en.wikipedia.org/wiki/Single-page_application) |
|
14 |
-* Languages |
|
15 |
- - Front end is [ClojureScript](https://clojurescript.org/) with ([re-frame](https://github.com/day8/re-frame)) |
|
16 |
- - CSS compilation is [Garden](https://github.com/noprompt/garden) with [Spade](https://github.com/dhleong/spade) |
|
17 |
-* Dependencies |
|
18 |
- - UI framework: [re-frame](https://github.com/day8/re-frame) |
|
19 |
- ([docs](https://github.com/day8/re-frame/blob/master/docs/README.md), |
|
20 |
- [FAQs](https://github.com/day8/re-frame/blob/master/docs/FAQs/README.md)) -> |
|
21 |
- [Reagent](https://github.com/reagent-project/reagent) -> |
|
22 |
- [React](https://github.com/facebook/react) |
|
23 |
- - CSS rendering: [Garden](https://github.com/noprompt/garden) |
|
24 |
-* Build tools |
|
25 |
- - CLJS compilation, dependency management, REPL, & hot reload: [`shadow-cljs`](https://github.com/thheller/shadow-cljs) |
|
26 |
-* Development tools |
|
27 |
- - Debugging: [CLJS DevTools](https://github.com/binaryage/cljs-devtools), |
|
28 |
- [`re-frame-10x`](https://github.com/day8/re-frame-10x) |
|
29 |
- - Emacs integration: [CIDER](https://github.com/clojure-emacs/cider) |
|
30 |
- - Linter: [clj-kondo](https://github.com/borkdude/clj-kondo) |
|
31 |
- |
|
32 |
-#### Directory structure |
|
33 |
- |
|
34 |
-* [`/`](/../../): project config files |
|
35 |
-* [`.clj-kondo/`](.clj-kondo/): lint config and cache files (cache files are not tracked; see |
|
36 |
-[`.gitignore`](.gitignore)) |
|
37 |
-* [`dev/`](dev/): source files compiled only with the [dev](#running-the-app) profile |
|
38 |
- - [`user.cljs`](dev/cljs/user.cljs): symbols for use during development in the |
|
39 |
-[ClojureScript REPL](#connecting-to-the-browser-repl-from-a-terminal) |
|
40 |
-* [`resources/public/`](resources/public/): SPA root directory; |
|
41 |
-[dev](#running-the-app) / [prod](#production) profile depends on the most recent build |
|
42 |
- - [`index.html`](resources/public/index.html): SPA home page |
|
43 |
- - Dynamic SPA content rendered in the following `div`: |
|
44 |
- ```html |
|
45 |
- <div id="app"></div> |
|
46 |
- ``` |
|
47 |
- - Customizable; add headers, footers, links to other scripts and styles, etc. |
|
48 |
- - Generated directories and files |
|
49 |
- - Created on build with either the [dev](#running-the-app) or [prod](#production) profile |
|
50 |
- - `js/compiled/`: compiled CLJS (`shadow-cljs`) |
|
51 |
- - Not tracked in source control; see [`.gitignore`](.gitignore) |
|
52 |
-* [`src/dm/styles.cljs`](src/dm/styles.cljs): CSS compilation source file (ClojureScript, |
|
53 |
-[Garden](https://github.com/noprompt/garden)) |
|
54 |
-* [`src/dm/`](src/dm/): SPA source files (ClojureScript, |
|
55 |
-[re-frame](https://github.com/Day8/re-frame)) |
|
56 |
- - [`core.cljs`](src/dm/core.cljs): contains the SPA entry point, `init` |
|
57 |
-* [`.github/workflows/`](.github/workflows/): contains the |
|
58 |
-[github actions](https://github.com/features/actions) pipelines. |
|
59 |
- - [`test.yaml`](.github/workflows/test.yaml): Pipeline for testing. |
|
60 |
- |
|
61 |
- |
|
62 |
-### Editor/IDE |
|
63 |
- |
|
64 |
-Use your preferred editor or IDE that supports Clojure/ClojureScript development. See |
|
65 |
-[Clojure tools](https://clojure.org/community/resources#_clojure_tools) for some popular options. |
|
66 |
- |
|
67 |
-### Environment Setup |
|
68 |
- |
|
69 |
-1. Install [JDK 8 or later](https://openjdk.java.net/install/) (Java Development Kit) |
|
70 |
-2. Install [Node.js](https://nodejs.org/) (JavaScript runtime environment) which should include |
|
71 |
- [NPM](https://docs.npmjs.com/cli/npm) or if your Node.js installation does not include NPM also install it. |
|
72 |
-4. Install [clj-kondo](https://github.com/borkdude/clj-kondo/blob/master/doc/install.md) (linter) |
|
73 |
-5. Clone this repo and open a terminal in the `dm` project root directory |
|
74 |
-6. (Optional) Setup [lint cache](https://github.com/borkdude/clj-kondo#project-setup): |
|
75 |
- ```sh |
|
76 |
- clj-kondo --lint "$(npx shadow-cljs classpath)" |
|
77 |
- ``` |
|
78 |
-7. Setup |
|
79 |
-[linting in your editor](https://github.com/borkdude/clj-kondo/blob/master/doc/editor-integration.md) |
|
80 |
- |
|
81 |
-### Browser Setup |
|
82 |
- |
|
83 |
-Browser caching should be disabled when developer tools are open to prevent interference with |
|
84 |
-[`shadow-cljs`](https://github.com/thheller/shadow-cljs) hot reloading. |
|
85 |
- |
|
86 |
-Custom formatters must be enabled in the browser before |
|
87 |
-[CLJS DevTools](https://github.com/binaryage/cljs-devtools) can display ClojureScript data in the |
|
88 |
-console in a more readable way. |
|
89 |
- |
|
90 |
-#### Chrome/Chromium |
|
91 |
- |
|
92 |
-1. Open [DevTools](https://developers.google.com/web/tools/chrome-devtools/) (Linux/Windows: `F12` |
|
93 |
-or `Ctrl-Shift-I`; macOS: `⌘-Option-I`) |
|
94 |
-2. Open DevTools Settings (Linux/Windows: `?` or `F1`; macOS: `?` or `Fn+F1`) |
|
95 |
-3. Select `Preferences` in the navigation menu on the left, if it is not already selected |
|
96 |
-4. Under the `Network` heading, enable the `Disable cache (while DevTools is open)` option |
|
97 |
-5. Under the `Console` heading, enable the `Enable custom formatters` option |
|
98 |
- |
|
99 |
-#### Firefox |
|
100 |
- |
|
101 |
-1. Open [Developer Tools](https://developer.mozilla.org/en-US/docs/Tools) (Linux/Windows: `F12` or |
|
102 |
-`Ctrl-Shift-I`; macOS: `⌘-Option-I`) |
|
103 |
-2. Open [Developer Tools Settings](https://developer.mozilla.org/en-US/docs/Tools/Settings) |
|
104 |
-(Linux/macOS/Windows: `F1`) |
|
105 |
-3. Under the `Advanced settings` heading, enable the `Disable HTTP Cache (when toolbox is open)` |
|
106 |
-option |
|
107 |
- |
|
108 |
-Unfortunately, Firefox does not yet support custom formatters in their devtools. For updates, follow |
|
109 |
-the enhancement request in their bug tracker: |
|
110 |
-[1262914 - Add support for Custom Formatters in devtools](https://bugzilla.mozilla.org/show_bug.cgi?id=1262914). |
|
111 |
- |
|
112 |
-## Development |
|
113 |
- |
|
114 |
-### Running the App |
|
115 |
- |
|
116 |
-Start a temporary local web server, build the app with the `dev` profile, and serve the app, |
|
117 |
-browser test runner and karma test runner with hot reload: |
|
118 |
- |
|
119 |
-```sh |
|
120 |
-npm install |
|
121 |
-npx shadow-cljs watch app |
|
122 |
-``` |
|
123 |
- |
|
124 |
-Please be patient; it may take over 20 seconds to see any output, and over 40 seconds to complete. |
|
125 | 3 |
|
126 |
-When `[:app] Build completed` appears in the output, browse to |
|
127 |
-[http://localhost:8280/](http://localhost:8280/). |
|
128 |
- |
|
129 |
-[`shadow-cljs`](https://github.com/thheller/shadow-cljs) will automatically push ClojureScript code |
|
130 |
-changes to your browser on save. To prevent a few common issues, see |
|
131 |
-[Hot Reload in ClojureScript: Things to avoid](https://code.thheller.com/blog/shadow-cljs/2019/08/25/hot-reload-in-clojurescript.html#things-to-avoid). |
|
132 |
- |
|
133 |
-Opening the app in your browser starts a |
|
134 |
-[ClojureScript browser REPL](https://clojurescript.org/reference/repl#using-the-browser-as-an-evaluation-environment), |
|
135 |
-to which you may now connect. |
|
136 |
- |
|
137 |
-#### Connecting to the browser REPL from Emacs with CIDER |
|
138 |
- |
|
139 |
-Connect to the browser REPL: |
|
140 |
-``` |
|
141 |
-M-x cider-jack-in-cljs |
|
142 |
-``` |
|
143 |
- |
|
144 |
-See |
|
145 |
-[Shadow CLJS User's Guide: Emacs/CIDER](https://shadow-cljs.github.io/docs/UsersGuide.html#cider) |
|
146 |
-for more information. Note that the mentioned [`.dir-locals.el`](.dir-locals.el) file has already |
|
147 |
-been created for you. |
|
148 |
- |
|
149 |
-#### Connecting to the browser REPL from VS Code with Calva |
|
150 |
- |
|
151 |
-See the [re-frame-template README](https://github.com/day8/re-frame-template) for [Calva](https://github.com/BetterThanTomorrow/calva) instuctions. See also https://calva.io for Calva documentation. |
|
152 |
- |
|
153 |
- |
|
154 |
-#### Connecting to the browser REPL from other editors |
|
155 |
- |
|
156 |
-See |
|
157 |
-[Shadow CLJS User's Guide: Editor Integration](https://shadow-cljs.github.io/docs/UsersGuide.html#_editor_integration). |
|
158 |
-Note that `npm run watch` runs `npx shadow-cljs watch` for you, and that this project's running build ids is |
|
159 |
-`app`, `browser-test`, `karma-test`, or the keywords `:app`, `:browser-test`, `:karma-test` in a Clojure context. |
|
160 |
- |
|
161 |
-Alternatively, search the web for info on connecting to a `shadow-cljs` ClojureScript browser REPL |
|
162 |
-from your editor and configuration. |
|
163 |
- |
|
164 |
-For example, in Vim / Neovim with `fireplace.vim` |
|
165 |
-1. Open a `.cljs` file in the project to activate `fireplace.vim` |
|
166 |
-2. In normal mode, execute the `Piggieback` command with this project's running build id, `:app`: |
|
167 |
- ```vim |
|
168 |
- :Piggieback :app |
|
169 |
- ``` |
|
170 |
- |
|
171 |
-#### Connecting to the browser REPL from a terminal |
|
172 |
- |
|
173 |
-1. Connect to the `shadow-cljs` nREPL: |
|
174 |
- ```sh |
|
175 |
- lein repl :connect localhost:8777 |
|
176 |
- ``` |
|
177 |
- The REPL prompt, `shadow.user=>`, indicates that is a Clojure REPL, not ClojureScript. |
|
178 |
- |
|
179 |
-2. In the REPL, switch the session to this project's running build id, `:app`: |
|
180 |
- ```clj |
|
181 |
- (shadow.cljs.devtools.api/nrepl-select :app) |
|
182 |
- ``` |
|
183 |
- The REPL prompt changes to `cljs.user=>`, indicating that this is now a ClojureScript REPL. |
|
184 |
-3. See [`user.cljs`](dev/cljs/user.cljs) for symbols that are immediately accessible in the REPL |
|
185 |
-without needing to `require`. |
|
186 |
- |
|
187 |
-### Running `shadow-cljs` Actions |
|
188 |
- |
|
189 |
-See a list of [`shadow-cljs CLI`](https://shadow-cljs.github.io/docs/UsersGuide.html#_command_line) |
|
190 |
-actions: |
|
191 |
-```sh |
|
192 |
-npx shadow-cljs --help |
|
193 |
-``` |
|
194 |
- |
|
195 |
-Please be patient; it may take over 10 seconds to see any output. Also note that some actions shown |
|
196 |
-may not actually be supported, outputting "Unknown action." when run. |
|
197 |
- |
|
198 |
-Run a shadow-cljs action on this project's build id (without the colon, just `app`): |
|
199 |
-```sh |
|
200 |
-npx shadow-cljs <action> app |
|
201 |
-``` |
|
202 |
-### Debug Logging |
|
203 |
- |
|
204 |
-The `debug?` variable in [`config.cljs`](src/cljs/dm/config.cljs) defaults to `true` in |
|
205 |
-[`dev`](#running-the-app) builds, and `false` in [`prod`](#production) builds. |
|
206 |
- |
|
207 |
-Use `debug?` for logging or other tasks that should run only on `dev` builds: |
|
208 |
- |
|
209 |
-```clj |
|
210 |
-(ns dm.example |
|
211 |
- (:require [dm.config :as config]) |
|
212 |
- |
|
213 |
-(when config/debug? |
|
214 |
- (println "This message will appear in the browser console only on dev builds.")) |
|
215 |
-``` |
|
216 |
- |
|
217 |
-## Production |
|
4 |
+Inspired by https://initiative.sh |
|
218 | 5 |
|
219 |
-Build the app with the `prod` profile: |
|
6 |
+## Table of Contents |
|
7 |
+- [DMR](#dmr) |
|
8 |
+ - [Table of Contents](#table-of-contents) |
|
9 |
+ - [Install](#install) |
|
10 |
+ - [Usage](#usage) |
|
11 |
+ - [Contributing](#contributing) |
|
220 | 12 |
|
221 |
-```sh |
|
222 |
-npm install |
|
223 |
-npm run release |
|
224 |
-``` |
|
13 |
+## Install |
|
225 | 14 |
|
226 |
-Please be patient; it may take over 15 seconds to see any output, and over 30 seconds to complete. |
|
15 |
+## Usage |
|
227 | 16 |
|
228 |
-The `resources/public/js/compiled` directory is created, containing the compiled `app.js` and |
|
229 |
-`manifest.edn` files. |
|
17 |
+## Contributing |
|
18 |
+Check out [CONTRIBUTING.md](./CONTRIBUTING.md) for instructions on how to get started hacking on DMR. |
|
230 | 19 |
\ No newline at end of file |