|
1 | 1 | # Stack |
2 | | -SilverBullet is written in [TypeScript](https://www.typescriptlang.org/) and built on top of the excellent [CodeMirror 6](https://codemirror.net/) editor component. Additional UI is built using [Preact](https://preactjs.com/). [ES Build](https://esbuild.github.io) is used to build both the front-end and back-end bundles. The server backend runs as an HTTP server on [Deno](https://deno.land/) using [Hono](https://hono.dev). |
| 2 | +SilverBullet’s client is written in [TypeScript](https://www.typescriptlang.org/) and built on top of the excellent [CodeMirror 6](https://codemirror.net/) editor component. Additional UI is built using [Preact](https://preactjs.com/). [ES Build](https://esbuild.github.io) is used to build the frontend. |
| 3 | + |
| 4 | +[[Plugs]] are also written in TypeScript. |
| 5 | + |
| 6 | +The SilverBullet server is written in [Go](https://go.dev/). |
| 7 | + |
| 8 | +# Project layout |
| 9 | + |
3 | 10 |
|
4 | 11 | # Development |
5 | | -Requirements: [Deno](https://deno.land/) 2.2 or newer. |
| 12 | +Requirements: |
| 13 | +* [Deno](https://deno.land/) 2.4 or newer. |
| 14 | +* [Go](https://go.dev/) 1.25 or newer |
| 15 | +* Make |
| 16 | + |
| 17 | +It's convenient to also install [air](https://github.com/air-verse/air) for development, this tool will watch your code base for changes and automatically rebuild: |
| 18 | + |
| 19 | +```shell |
| 20 | +go install github.com/air-verse/air@latest |
| 21 | +``` |
| 22 | + |
| 23 | +Make sure your `$GOPATH/bin` is in your $PATH. |
6 | 24 |
|
7 | | -Clone the repository from GitHub: |
| 25 | +To build everything and run the server using air: |
8 | 26 |
|
9 | 27 | ```shell |
10 | | -git clone git@github.com:silverbulletmd/silverbullet.git |
11 | | -cd silverbullet |
| 28 | +air <PATH-TO-YOUR-SPACE> |
12 | 29 | ``` |
13 | 30 |
|
14 | | -And build it: |
| 31 | +Note, that if you want to pass arguments to your SilverBullet binary like `-p` or `-L` you need to this as follows: |
15 | 32 |
|
16 | 33 | ```shell |
17 | | -deno task build |
| 34 | +air -- -L 0.0.0.0 <PATH-TO-YOUR-SPACE> |
18 | 35 | ``` |
19 | 36 |
|
20 | | -For convenience, replace your `silverbullet` install with the one from this repo via: |
| 37 | + |
| 38 | +Alternatively, to build the project without air: |
21 | 39 |
|
22 | 40 | ```shell |
23 | | -deno task install |
| 41 | +make build |
24 | 42 | ``` |
25 | 43 |
|
26 | | -You can now run the server in “watch mode” (automatically restarting when you change source files) with: |
| 44 | +To run the resulting server: |
27 | 45 |
|
28 | 46 | ```shell |
29 | | -deno task watch-server <PATH-TO-YOUR-SPACE> |
| 47 | +./silverbullet <PATH-TO-YOUR-SPACE> |
30 | 48 | ``` |
31 | 49 |
|
32 | | -It's convenient to run three commands in parallel (in separate terminals): |
| 50 | +### Useful development tasks |
| 51 | + |
| 52 | +Typecheck, lint, test the frontend: |
33 | 53 |
|
34 | 54 | ```shell |
35 | | -deno task watch-web |
36 | | -deno task watch-server <PATH-TO-YOUR-SPACE> |
37 | | -deno task watch-plugs |
| 55 | +make test |
38 | 56 | ``` |
39 | 57 |
|
40 | | -All of these watch for file changes and a rebuild should trigger automatically. |
| 58 | +### Build a docker container |
| 59 | +Note, you do not need Deno nor Go locally installed for this to work: |
| 60 | + |
| 61 | +```shell |
| 62 | +docker build -t silverbullet . |
| 63 | +``` |
| 64 | + |
| 65 | +To run: |
| 66 | + |
| 67 | +```shell |
| 68 | +docker run -p 3000:3000 -v <PATH-TO-YOUR-SPACE>:/space silverbullet |
| 69 | +``` |
41 | 70 |
|
42 | | -Note that there are dependencies between these builds. Any change to any of the built-in _plugs_ requires a rebuild of the web app. Any rebuild of the web app will only be picked up by the server after it restarts (which should happen automatically). |
|
0 commit comments