This repository was archived by the owner on Aug 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +814
-4
lines changed Expand file tree Collapse file tree 6 files changed +814
-4
lines changed Original file line number Diff line number Diff line change 3
3
cmd /coder /coder
4
4
ci /integration /bin
5
5
ci /integration /env.sh
6
- coder-sdk /env.sh
6
+ coder-sdk /env.sh
7
+ .vscode
Original file line number Diff line number Diff line change 7
7
- ` steps/gendocs.sh ` generates CLI documentation into ` /docs ` from the command specifications.
8
8
- ` steps/lint.sh ` lints all Go source files based on the rules set fourth in ` /.golangci.yml ` .
9
9
10
-
11
10
## integration tests
12
11
13
12
### ` tcli `
Original file line number Diff line number Diff line change @@ -5,4 +5,7 @@ ENV CI=true
5
5
6
6
RUN go get golang.org/x/tools/cmd/goimports
7
7
RUN go get github.com/mattn/goveralls
8
- RUN apt update && apt install grep
8
+
9
+ RUN apt update && apt install zip curl grep
10
+ RUN curl -fsSL https://deno.land/x/install/install.sh | sh
11
+ ENV PATH="/root/.deno/bin:${PATH}"
Original file line number Diff line number Diff line change
1
+ // join all /docs files into a single markdown file
2
+ // fix all hyperlinks
3
+
4
+ const newFilename = "coder_cli_all_docs.md"
5
+ const newPath = `./docs/${ newFilename } `
6
+ Deno . chdir ( `${ new URL ( "." , import . meta. url ) . pathname } /../../` )
7
+
8
+ const dirs = [ ]
9
+ for await ( const dir of Deno . readDir ( "./docs" ) ) {
10
+ dirs . push ( dir )
11
+ }
12
+
13
+ const filenames = dirs . map ( ( { name } ) => name ) . filter ( ( f ) => f !== newFilename )
14
+ const filenameParts = filenames
15
+ . map ( ( f ) => f . split ( "_" ) )
16
+ . sort ( ( a , b ) => a . length - b . length )
17
+ . sort ( ( a , b ) => {
18
+ for ( let i in a . length > b . length ? a : b ) {
19
+ if ( a [ i ] != b [ i ] ) return a > b ? - 1 : 1
20
+ }
21
+ return 1
22
+ } )
23
+
24
+ let aggregated = ""
25
+ for ( let i in filenameParts ) {
26
+ const filename = filenameParts [ i ] . join ( "_" )
27
+ const file = await Deno . readFile ( `./docs/${ filename } ` )
28
+ aggregated += `\n${ new TextDecoder ( ) . decode ( file ) } `
29
+ }
30
+ for ( let i in filenames ) {
31
+ aggregated = aggregated . replaceAll (
32
+ filenames [ i ] ,
33
+ `#${ filenames [ i ] . replace ( ".md" , "" ) . split ( "_" ) . join ( "-" ) } `
34
+ )
35
+ }
36
+
37
+ try {
38
+ await Deno . remove ( newPath )
39
+ } catch { }
40
+ await Deno . writeFile ( newPath , new TextEncoder ( ) . encode ( aggregated ) )
Original file line number Diff line number Diff line change 2
2
3
3
set -euo pipefail
4
4
5
- echo " Generating docs... "
5
+ echo " -- Generating docs"
6
6
7
7
cd " $( dirname " $0 " ) "
8
8
cd ../../
@@ -11,6 +11,14 @@ rm -rf ./docs
11
11
mkdir ./docs
12
12
go run ./cmd/coder gen-docs ./docs
13
13
14
+ if ! command -v deno > /dev/null; then
15
+ " deno is required to compile the docs into a single file"
16
+ exit 1
17
+ fi
18
+
19
+ echo " -- Aggregating docs"
20
+ deno run --allow-read --allow-write ./ci/scripts/aggregate_docs.ts
21
+
14
22
if [[ ${CI-} && $( git ls-files --other --modified --exclude-standard) ]]; then
15
23
echo " Documentation needs generation:"
16
24
git -c color.ui=always status | grep --color=no ' \e\[31m'
You can’t perform that action at this time.
0 commit comments