Skip to content

Commit 5bee7b0

Browse files
committed
fix: Updated generator to be run from any project
1 parent 3cb858f commit 5bee7b0

File tree

8 files changed

+662
-888
lines changed

8 files changed

+662
-888
lines changed

.github/workflows/generator.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ on:
33
push:
44
branches:
55
- main
6-
- ci-build
76
paths:
87
- '.github/workflows/generator.yml'
98
- 'generator/sonos-docs/src/**/*.ts'

docs/developers.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ npm install
7676

7777
### Combine discovery files and documentation
7878

79-
If you changed the [documentation.json](#documentation.json) file or if you added/updated discovery files, you need to combine the two into one file, the **intermediate.json** file.
79+
If you changed the [documentation.json](#documentation.json) file or if you added/updated discovery files, you need to combine the two into one file, the **.cache/combined.json** file.
8080

8181
This file is the result of the the manual documentation and the device discovery files. This file is almost 8000 lines of json at the moment, which is why it is ignored in git.
8282
Being able to inspect this json file should really help in debugging the generator.
@@ -94,11 +94,14 @@ npm install
9494
npm run intermediate-win
9595
# on Unix/mac short for ./bin/run combine --docsFile=../../docs/documentation.json --folder=data
9696
npm run intermediate
97+
98+
# or with npx from the root directory
99+
npx @svrooij/sonos-docs combine --docsFile=./docs/documentation.json --folder=./generator/sonos-docs/data --out=./generator/sonos-docs/.cache/combined.json
97100
```
98101

99102
### Regenerate documentation
100103

101-
Once you generated the **intermediate.json** file, you can use the generator to (re)generate the [service documentation]({{ '/services' | relative_url }}). This step is mandatory if you changed either the **documentation.json** or if you added/updated one of the discovery files.
104+
Once you generated the **combined.json** file, you can use the generator to (re)generate the [service documentation]({{ '/services' | relative_url }}). This step is mandatory if you changed either the **documentation.json** or if you added/updated one of the discovery files.
102105

103106
The resulting files, are **not to be changed manually**, since changes will get lost upon the next generation.
104107

@@ -111,13 +114,16 @@ Regenerate documentation:
111114

112115
```bash
113116
# Fork, clone, go to '/generator/sonos-docs' and run npm install
114-
# generate intermediate, see above
117+
# generate combined.json, see above
115118

116119
# Regenerate documentation
117120
# on windows, short for .\\bin\\run generate docs ../../docs
118121
npm run docs-win
119122
# on unix/mac, short for ./bin/run generate docs ../../docs
120123
npm run docs
124+
125+
# or with npx (from root folder)
126+
npx @svrooij/sonos-docs generate docs ./docs -i ./generator/sonos-docs/.cache/combined.json
121127
```
122128

123129
### Use generator for other library
@@ -134,7 +140,7 @@ Be sure to check out the [docs template](https://github.com/svrooij/sonos-api-do
134140

135141
```bash
136142
# Fork, clone, go to '/generator/sonos-docs' and run npm install
137-
# generate intermediate, see above
143+
# generate combined.json, see above
138144

139145
# generate library
140146
# [template-folder] can either be a folder relative to the current location, a full path to a template folder or the name of the folder inside the generator folder.
@@ -143,4 +149,7 @@ Be sure to check out the [docs template](https://github.com/svrooij/sonos-api-do
143149
.\bin\run generate [template-folder] [root-output-folder]
144150
# on unix/mac
145151
./bin/run generate [template-folder] [root-output-folder]
152+
153+
# or with npx
154+
npx @svrooij/sonos-docs generate [template-folder] [root-output-folder] -i ./generator/sonos-docs/.cache/combined.json
146155
```

generator/sonos-docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
/yarn.lock
88
node_modules
99
/data/intermediate.json
10+
/.cache/combined.json

0 commit comments

Comments
 (0)