Skip to content

Commit 8995fa6

Browse files
committed
docs: generate doc from specs
1 parent c06f890 commit 8995fa6

29 files changed

+8377
-327
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ yarn docker:setup
2222

2323
Build docker image from [Dockerfile](./Dockerfile)
2424

25-
[How to add a new client](./docs/addNewClient.md) | [How to add a new language](./docs/addNewLanguage.md) | [Common Test Suite](./docs/CTS.md) | [Run the playground](./docs/playground.md)
25+
[How to add a new client](https://api-clients-automation.netlify.app/docs/addNewClient) | [How to add a new language](https://api-clients-automation.netlify.app/docs/addNewLanguage) | [Common Test Suite](https://api-clients-automation.netlify.app/docs/CTS) | [Run the playground](https://api-clients-automation.netlify.app/docs/playground)
2626

2727
```bash
2828
yarn docker:build
File renamed without changes.
File renamed without changes.
File renamed without changes.

netlify.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[build]
2+
command="yarn website:build"
3+
publish="website/build"
4+
ignore="git diff --quiet $COMMIT_REF $CACHED_COMMIT_REF -- website/"
5+
6+
[build.environment]
7+
YARN_VERSION = "3.2.0"

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"playground/javascript/node/",
77
"playground/javascript/browser/",
88
"tests/",
9-
"scripts/"
9+
"scripts/",
10+
"website/"
1011
],
1112
"scripts": {
1213
"build:clients": "./scripts/multiplexer.sh ${2:-nonverbose} ./scripts/builds/clients.sh ${0:-all} ${1:-all}",
@@ -30,7 +31,9 @@
3031
"specs:fix": "eslint --ext=yml specs/ --fix",
3132
"specs:lint": "eslint --ext=yml specs/$0",
3233
"github-actions:lint": "eslint --ext=yml .github/",
33-
"release": "yarn workspace scripts createReleaseIssue"
34+
"release": "yarn workspace scripts createReleaseIssue",
35+
"website:build": "yarn workspace website build",
36+
"website": "yarn workspace website start --host 0.0.0.0"
3437
},
3538
"devDependencies": {
3639
"@openapitools/openapi-generator-cli": "2.4.26",

scripts/release/process-release.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fs.writeFileSync(
9292
// update changelogs
9393
new Set([...Object.keys(versionsToRelease), ...langsToUpdateRepo]).forEach(
9494
(lang) => {
95-
const filePath = path.resolve(ROOT_DIR, `docs/changelogs/${lang}.md`);
95+
const filePath = path.resolve(ROOT_DIR, `changelogs/${lang}.md`);
9696
const header = versionsToRelease[lang!]
9797
? `## ${versionsToRelease[lang!].next}`
9898
: `## ${new Date().toISOString().split('T')[0]}`;

scripts/release/text.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default {
1515
].join('\n'),
1616

1717
changelogHeader: `## CHANGELOG`,
18-
changelogDescription: `Update the following lines. Once merged, it will be reflected to \`docs/changelogs/*.\``,
18+
changelogDescription: `Update the following lines. Once merged, it will be reflected to \`changelogs/*.\``,
1919

2020
approvalHeader: `## Approval`,
2121
approved: APPROVED,

website/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

website/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Website
2+
3+
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```
8+
$ yarn
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ yarn start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
### Build
20+
21+
```
22+
$ yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
Using SSH:
30+
31+
```
32+
$ USE_SSH=true yarn deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```
38+
$ GIT_USER=<Your GitHub username> yarn deploy
39+
```
40+
41+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

website/babel.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// eslint-disable-next-line import/no-commonjs
2+
module.exports = {
3+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
4+
};

docs/CTS.md renamed to website/docs/CTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: Common Test Suite
3+
---
4+
15
# Common Test Suite
26

37
The CTS aims at ensuring minimal working operation for the API clients, by comparing the request formed by sample parameters.

docs/addNewClient.md renamed to website/docs/addNewClient.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1+
---
2+
title: How to add a new client?
3+
---
4+
15
# How to add a new client
26

37
Adding a client requires a few manual steps in order to setup the tooling, generation scripts and properly generate the code. We recommend getting inspirations from existing clients such as `javascript-recommend`.
48

5-
> See [README](../README.md) to [`setup the repository tooling`](../README.md#setup-repository-tooling) and [`setup dev environment`](../README.md#setup-dev-environment).
9+
> See [README](/docs/setupRepository) to [`setup the repository tooling`](/docs/setupRepository#setup-repository-tooling) and [`setup dev environment`](/docs/setupRepository#setup-dev-environment).
610
711
## 1. Writing specs
812

9-
We recommend to have a look at [existing spec files](../specs/). The `bundled` folder is automatically generated, manual changes shouldn't be done in these files.
13+
We recommend to have a look at [existing spec files](https://github.com/algolia/api-clients-automation/blob/main/Dockerfile/specs/). The `bundled` folder is automatically generated, manual changes shouldn't be done in these files.
1014

11-
### [common spec folder](../specs/common/)
15+
### [common spec folder](https://github.com/algolia/api-clients-automation/blob/main/Dockerfile/specs/common/)
1216

1317
Properties that are common to Algolia or used in multiple clients.
1418

1519
### `<clientName>` spec folder
1620

17-
> Example with the [search client spec](../specs/search/)
21+
> Example with the [search client spec](https://github.com/algolia/api-clients-automation/blob/main/Dockerfile/specs/search/)
1822
1923
#### `spec.yml` file
2024

21-
This file is the entry point of the client spec, it contains `servers`, `paths` and other specific imformations of the API. We recommend to copy an existing [`spec.yml` file](../specs/search/spec.yml) to get started.
25+
This file is the entry point of the client spec, it contains `servers`, `paths` and other specific imformations of the API. We recommend to copy an existing [`spec.yml` file](https://github.com/algolia/api-clients-automation/blob/main/Dockerfile/specs/search/spec.yml) to get started.
2226

2327
#### `<clientName>`/common folder
2428

@@ -38,11 +42,11 @@ Path definition of the paths defined in the [spec file](#specyml-file)
3842

3943
## 2. Configuring the environment
4044

41-
After setting up the dev environment from [README](../README.md) and [writing your spec files](#1-writing-specs), you need to update the configuration files to properly generate clients that are maintainable.
45+
After setting up the dev environment from [README](/docs/setupRepository) and [writing your spec files](#1-writing-specs), you need to update the configuration files to properly generate clients that are maintainable.
4246

4347
### Generation config
4448

45-
[openapitools.json](../openapitools.json) hosts the configuration of all of the generated clients with their available languages.
49+
[openapitools.json](https://github.com/algolia/api-clients-automation/blob/main/Dockerfile/openapitools.json) hosts the configuration of all of the generated clients with their available languages.
4650

4751
#### `generators`
4852

@@ -60,19 +64,19 @@ You can copy an existing object of a client and replace the `<clientName>` value
6064
| apiName | string | JavaScript | `search` | The lowercase name of the exported API. |
6165
| capitalizedApiName | string | JavaScript | `Search` | The capitalized name of the exported API. |
6266
| packageVersion | string | JavaScript | `1.2.3` | The version you'd like to publish the first iteration of the generated client. It will be automatically incremented. |
63-
| packageName | string | common | `AlgoliaSearch` | Name of the API package, used in [CTS](./CTS.md). |
67+
| packageName | string | common | `AlgoliaSearch` | Name of the API package, used in [CTS](/docs/CTS). |
6468
| hasRegionalHost | boolean | common | `false` | Automatically guessed from `servers` in spec. `undefined` implies that hosts used will required the `appId`, regional hosts are used otherwise. |
6569
| isDeHost | boolean | common | `false` | Automatically guessed from `servers` in spec. `undefined` implies that `eu` is the regional host, `de` otherwise. |
6670
| host | string | common | `crawler` | Automatically guessed from `servers` in spec. |
6771
| topLevelDomain | string | common | `io` | Automatically guessed from `servers` in spec. |
6872

6973
### GitHub actions
7074

71-
The built clients are cached with the [Cache GitHub Action](../.github/actions/cache/action.yml) to avoid unnecessary CI tasks.
75+
The built clients are cached with the [Cache GitHub Action](https://github.com/algolia/api-clients-automation/blob/main/Dockerfile/.github/actions/cache/action.yml) to avoid unnecessary CI tasks.
7276

7377
> TODO: Automate this step
7478
75-
You can copy [an existing client caching step](../.github/actions/cache/action.yml) or edit the following example:
79+
You can copy [an existing client caching step](https://github.com/algolia/api-clients-automation/blob/main/Dockerfile/.github/actions/cache/action.yml) or edit the following example:
7680

7781
```yaml
7882
- name: Restore built <LANGUAGE> <CLIENT_NAME> client
@@ -85,12 +89,12 @@ You can copy [an existing client caching step](../.github/actions/cache/action.y
8589
8690
## 3. Generate new client
8791
88-
> You can find more commands in the [README](../README.md#generate-all-clients).
92+
> You can find more commands in the [README](/docs/setupRepository#generate-all-clients).
8993
9094
```bash
9195
yarn docker generate <languageName> <clientName>
9296
```
9397

9498
## 4. Implementing the Common Test Suite
9599

96-
See [CTS.md](./CTS.md) for more informations.
100+
See [CTS.md](/docs/CTS) for more informations.

docs/addNewLanguage.md renamed to website/docs/addNewLanguage.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
---
2+
title: How to add a new supported language?
3+
---
4+
15
# How to add support of a new language
26

37
This repository leverages [openapi-generator](https://openapi-generator.tech/) to generate API clients.
48

5-
> See [README](../README.md) to [`setup the repository tooling`](../README.md#setup-repository-tooling) and [`setup dev environment`](../README.md#setup-dev-environment).
9+
> See [README](/docs/setupRepository) to [`setup the repository tooling`](/docs/setupRepository#setup-repository-tooling) and [`setup dev environment`](/docs/setupRepository#setup-dev-environment).
610
711
> If not done already, [install openapi-generator](https://openapi-generator.tech/docs/installation/)
812
@@ -26,9 +30,9 @@ openapi-generator author template -g typescript-node -o templates/javascript/
2630

2731
## Update the generator config
2832

29-
Add each client in the file [`openapitools.json`](../openapitools.json), following the others client structure.
33+
Add each client in the file [`openapitools.json`](https://github.com/algolia/api-clients-automation/blob/main/Dockerfileopenapitools.json), following the others client structure.
3034

31-
> See [How to add a new client](./addNewClient.md) for informations regarding this file
35+
> See [How to add a new client](/docs/addNewClient) for informations regarding this file
3236
3337
### Algolia requirements
3438

@@ -62,7 +66,7 @@ The retry strategy cannot be generated and needs to be implemented outside of th
6266

6367
Some Algolia clients (search and recommend) targets the default appId host (`${appId}-dsn.algolia.net`, `${appId}.algolia.net`, etc.), while clients like `personalization` have their own regional `host` (`eu` | `us` | `de`).
6468

65-
As the generator does not support reading `servers` in a spec file, hosts methods and variables are extracted with a custom script and create variables for you to use in the mustache templates, [read more here](./addNewClient.md#generators).
69+
As the generator does not support reading `servers` in a spec file, hosts methods and variables are extracted with a custom script and create variables for you to use in the mustache templates, [read more here](/docs/addNewClient#generators).
6670

6771
### Requesters
6872

website/docs/introduction.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Introduction
3+
---
4+
5+
# Introduction
6+
7+
API Clients Automation by Algolia
8+
9+
## Specs doc
10+
11+
- [A/B Testing specs](/specs/abtesting)
12+
- [analytics specs](/specs/analytics)
13+
- [insights specs](/specs/insights)
14+
- [personalization specs](/specs/personalization)
15+
- [query-suggestions specs](/specs/query-suggestions)
16+
- [recommend specs](/specs/recommend)
17+
- [search specs](/specs/search)
18+
- [sources specs](/specs/sources)
19+
- [predict specs](/specs/predict)
20+
21+
## Repository
22+
23+
[API Clients Automation](https://github.com/algolia/api-clients-automation)

docs/playground.md renamed to website/docs/playground.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: Playground
3+
---
4+
15
# Playground
26

37
All of the existing clients should have an active playground for you to test generated clients, if it's not the case, consider contributing or letting us know!
@@ -24,5 +28,5 @@ yarn docker playground java search
2428

2529
To add a new supported language to the playground, you need to:
2630

27-
- Create a new folder with your `<languageName>` in [the playground folder](../playground/)
28-
- Edit the [playground script](../scripts/playground.sh) with the command to run it.
31+
- Create a new folder with your `<languageName>` in [the playground folder](https://github.com/algolia/api-clients-automation/blob/main/playground)
32+
- Edit the [playground script](https://github.com/algolia/api-clients-automation/blob/main/scripts/playground.sh) with the command to run it.

0 commit comments

Comments
 (0)