Skip to content

Commit 4a49a04

Browse files
authored
[gen-readme] Improve gen readme (#1735)
## Summary Improve automatically generated readme. Highlights: * Adds "getting started" section. * documents how to install devbox, start shell, run script * Adds more context around scripts, init hook. * Adds link to devbox repo. * Adds more spacing between script details What it looks like: https://github.com/jetpack-io/devbox/blob/56e7427a8f3da266d2f3d2b4a5028a7c7a017fc3/devbox.md ## How was it tested? `devbox gen readme devbox.md`
1 parent bd5a091 commit 4a49a04

File tree

2 files changed

+82
-32
lines changed

2 files changed

+82
-32
lines changed

devbox.md

Lines changed: 58 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,42 @@
33

44
Instant, easy, and predictable development environments
55

6-
## Scripts
6+
## Getting Started
7+
This project uses [devbox](https://github.com/jetpack-io/devbox) to manage its development environment.
8+
9+
Install devbox:
10+
```sh
11+
curl -fsSL https://get.jetpack.io/devbox | bash
12+
```
713

8-
* [build](#build)
9-
* [build-all](#build-all)
10-
* [build-darwin-amd64](#build-darwin-amd64)
11-
* [build-darwin-arm64](#build-darwin-arm64)
12-
* [build-linux-amd64](#build-linux-amd64)
13-
* [build-linux-arm64](#build-linux-arm64)
14-
* [code](#code)
15-
* [fmt](#fmt)
16-
* [lint](#lint)
17-
* [test](#test)
18-
* [tidy](#tidy)
19-
* [update-examples](#update-examples)
20-
21-
## Init Hook
14+
Start the devbox shell:
15+
```sh
16+
devbox shell
17+
```
2218

19+
Run a script in the devbox environment:
20+
```sh
21+
devbox run <script>
22+
```
23+
## Scripts
24+
Scripts are custom commands that can be run using this project's environment. This project has the following scripts:
25+
26+
* [build](#devbox-run-build)
27+
* [build-all](#devbox-run-build-all)
28+
* [build-darwin-amd64](#devbox-run-build-darwin-amd64)
29+
* [build-darwin-arm64](#devbox-run-build-darwin-arm64)
30+
* [build-linux-amd64](#devbox-run-build-linux-amd64)
31+
* [build-linux-arm64](#devbox-run-build-linux-arm64)
32+
* [code](#devbox-run-code)
33+
* [fmt](#devbox-run-fmt)
34+
* [lint](#devbox-run-lint)
35+
* [test](#devbox-run-test)
36+
* [tidy](#devbox-run-tidy)
37+
* [update-examples](#devbox-run-update-examples)
38+
39+
## Shell Init Hook
40+
The Shell Init Hook is a script that runs whenever the devbox environment is instantiated. It runs
41+
on `devbox shell` and on `devbox run`.
2342
```sh
2443
test -z $FISH_VERSION && unset CGO_ENABLED GO111MODULE GOARCH GOFLAGS GOMOD GOOS GOROOT GOTOOLCHAIN GOWORK
2544
```
@@ -29,74 +48,85 @@ test -z $FISH_VERSION && unset CGO_ENABLED GO111MODULE GOARCH GOFLAGS GOMOD GOOS
2948
* [go@latest](https://www.nixhub.io/packages/go)
3049
* [runx:golangci/golangci-lint@latest](https://www.github.com/golangci/golangci-lint)
3150
* [runx:mvdan/gofumpt@latest](https://www.github.com/mvdan/gofumpt)
32-
* nixpkgs/63143ac2c9186be6d9da6035fa22620018c85932#hello
3351

3452
## Script Details
3553

36-
### build
54+
### devbox run build
3755
Build devbox for the current platform
3856
```sh
3957
go build -o dist/devbox ./cmd/devbox
4058
```
59+
&ensp;
4160

42-
### build-all
61+
### devbox run build-all
4362
```sh
4463
devbox run build-darwin-amd64
4564
devbox run build-darwin-arm64
4665
devbox run build-linux-amd64
4766
devbox run build-linux-arm64
4867
```
68+
&ensp;
4969

50-
### build-darwin-amd64
70+
### devbox run build-darwin-amd64
5171
```sh
5272
GOOS=darwin GOARCH=amd64 go build -o dist/devbox-darwin-amd64 ./cmd/devbox
5373
```
74+
&ensp;
5475

55-
### build-darwin-arm64
76+
### devbox run build-darwin-arm64
5677
```sh
5778
GOOS=darwin GOARCH=arm64 go build -o dist/devbox-darwin-arm64 ./cmd/devbox
5879
```
80+
&ensp;
5981

60-
### build-linux-amd64
82+
### devbox run build-linux-amd64
6183
```sh
6284
GOOS=linux GOARCH=amd64 go build -o dist/devbox-linux-amd64 ./cmd/devbox
6385
```
86+
&ensp;
6487

65-
### build-linux-arm64
88+
### devbox run build-linux-arm64
6689
```sh
6790
GOOS=linux GOARCH=arm64 go build -o dist/devbox-linux-arm64 ./cmd/devbox
6891
```
92+
&ensp;
6993

70-
### code
94+
### devbox run code
7195
Open VSCode
7296
```sh
7397
code .
7498
```
99+
&ensp;
75100

76-
### fmt
101+
### devbox run fmt
77102
```sh
78103
scripts/gofumpt.sh
79104
```
105+
&ensp;
80106

81-
### lint
107+
### devbox run lint
82108
```sh
83109
golangci-lint run --timeout 5m && scripts/gofumpt.sh
84110
```
111+
&ensp;
85112

86-
### test
113+
### devbox run test
87114
```sh
88115
go test -race -cover ./...
89116
```
117+
&ensp;
90118

91-
### tidy
119+
### devbox run tidy
92120
```sh
93121
go mod tidy
94122
```
123+
&ensp;
95124

96-
### update-examples
125+
### devbox run update-examples
97126
```sh
98127
devbox run build && go run testscripts/testrunner/updater/main.go
99128
```
129+
&ensp;
100130

101131

102132

internal/devbox/docgen/readme.tmpl

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,29 @@
77
{{- if .Description }}
88
{{ .Description }}
99
{{ end }}
10+
## Getting Started
11+
This project uses [devbox](https://github.com/jetpack-io/devbox) to manage its development environment.
12+
13+
Install devbox:
14+
```sh
15+
curl -fsSL https://get.jetpack.io/devbox | bash
16+
```
17+
18+
Start the devbox shell:
19+
```sh
20+
devbox shell
21+
```
22+
23+
Run a script in the devbox environment:
24+
```sh
25+
devbox run <script>
26+
```
1027

1128
{{- if .Scripts }}
1229
## Scripts
30+
Scripts are custom commands that can be run using this project's environment. This project has the following scripts:
1331
{{ range $name, $_ := .Scripts }}
14-
* [{{ $name }}](#{{ $name }})
32+
* [{{ $name }}](#devbox-run-{{ $name }})
1533
{{- end }}
1634
{{ end }}
1735

@@ -26,8 +44,9 @@
2644
{{ end }}
2745

2846
{{- if .InitHook }}
29-
## Init Hook
30-
47+
## Shell Init Hook
48+
The Shell Init Hook is a script that runs whenever the devbox environment is instantiated. It runs
49+
on `devbox shell` and on `devbox run`.
3150
```sh
3251
{{ .InitHook }}
3352
```
@@ -43,13 +62,14 @@
4362
{{- if .Scripts }}
4463
## Script Details
4564
{{ range $name, $commands := .Scripts }}
46-
### {{ $name }}
65+
### devbox run {{ $name }}
4766
{{- if .Comments }}
4867
{{ .Comments }}
4968
{{- end }}
5069
```sh
5170
{{ $commands }}
5271
```
72+
&ensp;
5373
{{ end }}
5474
{{ end }}
5575

0 commit comments

Comments
 (0)