Skip to content

Commit c20c4fa

Browse files
authored
docs: format CONTRIBUTING.md (#8973)
1 parent b2a8446 commit c20c4fa

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

docs/CONTRIBUTING.md

+26-26
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
We recommend using the [Nix](https://nix.dev/) package manager as it makes any pain related to maintaining dependency versions [just disappear](https://twitter.com/mitchellh/status/1491102567296040961). Once nix [has been installed](https://nixos.org/download.html) the development environment can be _manually instantiated_ through the `nix-shell` command:
66

7-
```
8-
$ cd ~/code/coder
7+
```shell
8+
cd ~/code/coder
99

1010
# https://nix.dev/tutorials/declarative-and-reproducible-developer-environments
11-
$ nix-shell
11+
nix-shell
1212

1313
...
1414
copying path '/nix/store/3ms6cs5210n8vfb5a7jkdvzrzdagqzbp-iana-etc-20210225' from 'https://cache.nixos.org'...
@@ -19,18 +19,17 @@ copying path '/nix/store/v2gvj8whv241nj4lzha3flq8pnllcmvv-ignore-5.2.0.tgz' from
1919

2020
If [direnv](https://direnv.net/) is installed and the [hooks are configured](https://direnv.net/docs/hook.html) then the development environment can be _automatically instantiated_ by creating the following `.envrc`, thus removing the need to run `nix-shell` by hand!
2121

22-
```
23-
$ cd ~/code/coder
24-
$ echo "use nix" >.envrc
25-
$ direnv allow
22+
```shell
23+
cd ~/code/coder
24+
echo "use nix" >.envrc
25+
direnv allow
2626
```
2727

28-
Now, whenever you enter the project folder, `direnv` will prepare the environment for you:
28+
Now, whenever you enter the project folder, [`direnv`](https://direnv.net/docs/hook.html) will prepare the environment for you:
2929

30-
```
31-
$ cd ~/code/coder
30+
```shell
31+
cd ~/code/coder
3232

33-
# https://direnv.net/docs/hook.html
3433
direnv: loading ~/code/coder/.envrc
3534
direnv: using nix
3635
direnv: export +AR +AS +CC +CONFIG_SHELL +CXX +HOST_PATH +IN_NIX_SHELL +LD +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES +NIX_BUILD_TOP +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_STORE +NM +NODE_PATH +OBJCOPY +OBJDUMP +RANLIB +READELF +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +TEMP +TEMPDIR +TMP +TMPDIR +XDG_DATA_DIRS +buildInputs +buildPhase +builder +cmakeFlags +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +mesonFlags +name +nativeBuildInputs +out +outputs +patches +phases +propagatedBuildInputs +propagatedNativeBuildInputs +shell +shellHook +stdenv +strictDeps +system ~PATH
@@ -53,15 +52,15 @@ Alternatively if you do not want to use nix then you'll need to install the need
5352
- [`pg_dump`](https://stackoverflow.com/a/49689589)
5453
- on macOS, run `brew install libpq zstd`
5554
- on Linux, install [`zstd`](https://github.com/horta/zstd.install)
56-
- [`pkg-config`]()
55+
- `pkg-config`
5756
- on macOS, run `brew install pkg-config`
58-
- [`pixman`]()
57+
- `pixman`
5958
- on macOS, run `brew install pixman`
60-
- [`cairo`]()
59+
- `cairo`
6160
- on macOS, run `brew install cairo`
62-
- [`pango`]()
61+
- `pango`
6362
- on macOS, run `brew install pango`
64-
- [`pandoc`]()
63+
- `pandoc`
6564
- on macOS, run `brew install pandocomatic`
6665

6766
### Development workflow
@@ -108,13 +107,14 @@ Database migrations are managed with [`migrate`](https://github.com/golang-migra
108107

109108
To add new migrations, use the following command:
110109

111-
```
112-
$ ./coderd/database/migrations/create_fixture.sh my name
110+
```shell
111+
./coderd/database/migrations/create_fixture.sh my name
113112
/home/coder/src/coder/coderd/database/migrations/000070_my_name.up.sql
114113
/home/coder/src/coder/coderd/database/migrations/000070_my_name.down.sql
115-
Run "make gen" to generate models.
116114
```
117115

116+
Run "make gen" to generate models.
117+
118118
Then write queries into the generated `.up.sql` and `.down.sql` files and commit
119119
them into the repository. The down script should make a best-effort to retain as
120120
much data as possible.
@@ -140,8 +140,8 @@ migration of multiple features or complex configurations.
140140

141141
To add a new partial fixture, run the following command:
142142

143-
```
144-
$ ./coderd/database/migrations/create_fixture.sh my fixture
143+
```shell
144+
./coderd/database/migrations/create_fixture.sh my fixture
145145
/home/coder/src/coder/coderd/database/migrations/testdata/fixtures/000070_my_fixture.up.sql
146146
```
147147

@@ -153,9 +153,9 @@ To create a full dump, run a fully fledged Coder deployment and use it to
153153
generate data in the database. Then shut down the deployment and take a snapshot
154154
of the database.
155155

156-
```
157-
$ mkdir -p coderd/database/migrations/testdata/full_dumps/v0.12.2 && cd $_
158-
$ pg_dump "postgres://coder@localhost:..." -a --inserts >000069_dump_v0.12.2.up.sql
156+
```shell
157+
mkdir -p coderd/database/migrations/testdata/full_dumps/v0.12.2 && cd $_
158+
pg_dump "postgres://coder@localhost:..." -a --inserts >000069_dump_v0.12.2.up.sql
159159
```
160160

161161
Make sure sensitive data in the dump is desensitized, for instance names,
@@ -164,8 +164,8 @@ emails, OAuth tokens and other secrets. Then commit the dump to the project.
164164
To find out what the latest migration for a version of Coder is, use the
165165
following command:
166166

167-
```
168-
$ git ls-files v0.12.2 -- coderd/database/migrations/*.up.sql
167+
```shell
168+
git ls-files v0.12.2 -- coderd/database/migrations/*.up.sql
169169
```
170170

171171
This helps in naming the dump (e.g. `000069` above).

0 commit comments

Comments
 (0)