Skip to content

Commit 8876e4b

Browse files
authored
docs: update contribution guides [skip-bc] (#4051)
1 parent 3894513 commit 8876e4b

File tree

11 files changed

+156
-103
lines changed

11 files changed

+156
-103
lines changed

scripts/cli/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ const flags = {
3434
flag: '-v, --verbose',
3535
description: 'make the generation verbose',
3636
},
37-
skipCache: {
38-
flag: '-s, --skip-cache',
39-
description: 'skip cache checking to force building specs',
40-
},
4137
};
4238

4339
program.name('cli');
@@ -141,7 +137,7 @@ buildCommand
141137
.description('Build a specified spec')
142138
.addArgument(args.clients)
143139
.option(flags.verbose.flag, flags.verbose.description)
144-
.option(flags.skipCache.flag, flags.skipCache.description)
140+
.option('-s, --skip-cache', 'skip cache checking to force building specs')
145141
.option('-json, --output-json', 'outputs the spec in JSON instead of yml')
146142
.option('-d, --docs', 'generates the doc specs with the code snippets')
147143
.action(async (clientArg: string[], { verbose, skipCache, outputJson, docs }) => {

website/docs/CLI/build-commands.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
title: Build commands
3+
---
4+
5+
# Build commands
6+
7+
:::info
8+
9+
You can use `yarn cli` as a drop in replacement for `apic`.
10+
11+
:::
12+
13+
The Build commands are used to [`build`](#build) API specs, clients, playground, snippets and guides.
14+
15+
## Usage for specs
16+
17+
> `client` defaults to `all`
18+
19+
> The `client` parameter is variadic, you can pass multiple `client` name
20+
21+
```bash
22+
apic build specs <client... | all>
23+
```
24+
25+
### Available options
26+
27+
| Option | Command | Description |
28+
| ---------- | :--------------- | :------------------------------------------------------------- |
29+
| verbose | -v, --verbose | Make the process verbose, display logs from third party tools |
30+
| skip cache | -s, --skip-cache | Skip cache checking to force building specs |
31+
| docs | -d, --docs | Builds the specs for the Algolia doc, which embeds the snippets|
32+
33+
## Build specs
34+
35+
### Build all specs
36+
37+
```bash
38+
apic build specs
39+
```
40+
41+
### Build specific spec
42+
43+
```bash
44+
apic build specs recommend
45+
```
46+
47+
### Build many spec
48+
49+
```bash
50+
apic build specs recommend search ingestion
51+
```
52+
53+
## Lint
54+
55+
### Fix specs
56+
57+
> Automatically done when building specs
58+
59+
```bash
60+
yarn specs:fix
61+
```
62+
63+
### Check specs
64+
65+
If you just want to check the format (not override the files)
66+
67+
```bash
68+
yarn specs:lint search
69+
```
70+
71+
## Usage for clients, playground, snippets and guides
72+
73+
> `language` and `client` defaults to `all`
74+
75+
> The `client` parameter is variadic, you can pass multiple `client` name
76+
77+
> scope is one of: `clients` | `playground` | `snippets` | `guides`
78+
79+
```bash
80+
apic build <scope> <language | all> <client... | all>
81+
```
82+
83+
### Available options
84+
85+
| Option | Command | Description |
86+
| ------- | :------------ | :------------------------------------------------------------ |
87+
| verbose | -v, --verbose | Make the process verbose, display logs from third party tools |
88+
89+
## Build
90+
91+
### Build all clients for all supported languages
92+
93+
```bash
94+
apic build clients
95+
```
96+
97+
### Build playground for specific language
98+
99+
```bash
100+
apic build playground javascript recommend
101+
```
102+
103+
### Build many snippets for specific language
104+
105+
```bash
106+
apic build snippets java insights recommend search
107+
```

website/docs/CLI/cts-commands.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ title: Common Test Suite commands
88

99
Common Test Suite requires all clients to be built.
1010

11+
You can use `yarn cli` as a drop in replacement for `apic`.
12+
1113
:::
1214

1315
The Common Test Suite commands are used to [`generate`](#generate) and [`run`](#run) tests.

website/docs/CLI/clients-commands.md renamed to website/docs/CLI/generate-commands.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
---
2-
title: Clients commands
2+
title: Generate commands
33
---
44

5-
# Clients commands
5+
# Generate commands
66

7-
The Clients commands are used to [`generate`](#generate) and [`build`](#build) API clients.
7+
:::info
8+
9+
You can use `yarn cli` as a drop in replacement for `apic`.
10+
11+
:::
12+
13+
The Generate commands are used to [`generate`](#generate) API clients.
814

915
## Usage
1016

website/docs/CLI/release-commands.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ title: Release commands
44

55
# Release commands
66

7+
:::info
8+
9+
You can use `yarn cli` as a drop in replacement for `apic`.
10+
11+
:::
12+
713
The Release commands are used to release every, or a subset of API clients.
814

915
## Usage

website/docs/CLI/specs-commands.md

Lines changed: 0 additions & 63 deletions
This file was deleted.

website/docs/add-new-api-client.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,22 +152,28 @@ The file [`config/clients.config.json`](https://github.com/algolia/api-clients-a
152152

153153
The following fields are required:
154154

155-
| Option | Description |
156-
| -------------------- | ------------------------------------------------------------------------------------------------- |
157-
| `folder` | Path to the parent folder of every client for this language. |
158-
| `gitRepoId` | Name of the repository for this API client. |
159-
| `packageVersion` | Initial version number to publish for the generated client. It will be automatically incremented. |
160-
| `modelFolder` | Path to the `model` folder that will host the generated code. |
161-
| `apiFolder` | Path to the `api` folder that will host the generated code. |
162-
| `tests.extension` | Test file extension, such as `.test.java` or `_test.py` |
163-
| `tests.outputFolder` | Path to the folder that holds the tests for this language, such as `tests/` |
155+
| Option | Description |
156+
| ---------------------- | ------------------------------------------------------------------------------------------------- |
157+
| `clients` | The clients to generate, either a list of string (matching the api name), or see below |
158+
| `clients.name` | The name of the client to generate (matching the API name) |
159+
| `clients.output` | The output folder |
160+
| `folder` | Path to the parent folder of every client for this language. |
161+
| `gitRepoId` | Name of the repository for this API client. |
162+
| `packageVersion` | Initial version number to publish for the generated client. It will be automatically incremented. |
163+
| `modelFolder` | Path to the `model` folder that will host the generated code. |
164+
| `apiFolder` | Path to the `api` folder that will host the generated code. |
165+
| `dockerImage` | The name of the docker image that runs this client `apic_base` | `apic_ruby` | `apic_swift` |
166+
| `tests.extension` | Test file extension, such as `.test.java` or `_test.py` |
167+
| `tests.outputFolder` | Path to the folder that holds the tests for this language, such as `tests/` |
168+
| `snippets.extension` | Snippet file extension, such as `.java` or `.py` |
169+
| `snippets.outputFolder`| Path to the folder that holds the snippets for this language, such as `lib/` |
164170

165171
## 3. Generate the client
166172

167173
Use the CLI to generate the clients:
168174

169-
- [Commands for working with specs](./CLI/specs-commands.md)
170-
- [Commands for working with clients](./CLI/clients-commands.md)
175+
- [Commands for working with specs](./CLI/build-commands.md)
176+
- [Commands for working with clients](./CLI/generate-commands.md)
171177

172178
## 4. Add tests with the Common Test Suite
173179

website/docs/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This section hosts informations about the [API clients automation](https://githu
1111
To contribute to the repository, make sure to take a look at our guidelines and recommendations:
1212

1313
- [Setup the repository tooling](/docs/setup-repository): to install our tooling.
14-
- CLI commands can be found at [CLI > specs commands](/docs/CLI/specs-commands), [CLI > clients commands](/docs/CLI/clients-commands) and [CLI > CTS commands](/docs/CLI/cts-commands).
14+
- CLI commands can be found at [CLI > build commands](/docs/CLI/build-commands), [CLI > generate commands](/docs/CLI/generate-commands) and [CLI > CTS commands](/docs/CLI/cts-commands).
1515
- [Add a new client](/docs/add-new-api-client): to add a new API spec to generate a client.
1616
- [Support a new language](/docs/add-new-language): to add a new supported language to the API clients.
1717
- [Commit and Pull-request](/docs/commit-and-pull-request): to see what to commit and send pull-requests.

website/docs/setup-repository.md

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ title: Setup repository
66

77
:::info
88

9-
Make sure to have Docker installed so you don't have to install the tooling for every API clients. [Installation guide](https://docs.docker.com/desktop/mac/install/)
9+
Make sure to have:
10+
- [Docker installed so you don't have to install the tooling for every API clients](https://docs.docker.com/desktop/mac/install/)
11+
- [jq because it's nice](https://jqlang.github.io/jq/download/)
1012

1113
:::
1214

@@ -18,28 +20,19 @@ nvm use && yarn
1820

1921
## Mounting the docker images
2022

21-
```bash
22-
yarn docker:setup
23-
```
24-
25-
### Docker
26-
27-
#### Build
28-
29-
We use 1 docker image per language to simplify the build, and reuse them on the CI.
30-
There is one base image containing node, java, scala and kotlin, located in [scripts/docker/Dockerfile](https://github.com/algolia/api-clients-automation/blob/main/scripts/docker/Dockerfile)
23+
We use multiple docker images to simplify the build. There is [one base image](https://github.com/algolia/api-clients-automation/blob/main/scripts/docker/Dockerfile.base) that contains everything except [swift](https://github.com/algolia/api-clients-automation/blob/main/scripts/docker/Dockerfile.swift) and [ruby](https://github.com/algolia/api-clients-automation/blob/main/scripts/docker/Dockerfile.ruby), they have their own Dockerfile
3124

3225
```bash
3326
yarn docker:setup
3427
```
3528

36-
:::caution
29+
## Tooling
3730

38-
The swift images takes a really long time to build (~5 minutes) because of swift-format, but it's only needed when you want to format swift.
31+
:::info
3932

40-
:::
33+
This step is optional, using `yarn cli ...` should work perfectly as well.
4134

42-
## Tooling
35+
:::
4336

4437
Install the CLI tool by following the instructions at the top of [scripts/install.sh](https://github.com/algolia/api-clients-automation/blob/main/scripts/install.sh) to acces `apic` from your terminal, with bash autocompletion.
4538
You can run `apic help` to check if it's working properly.
@@ -58,10 +51,10 @@ Once you've successfully built and mounted the Docker image, you can now play wi
5851

5952
- [How to add a new client](/docs/add-new-api-client)
6053
- [How to add a new language](/docs/add-new-language)
61-
- [Use CLI specs commands](/docs/CLI/specs-commands)
62-
- [Use CLI clients commands](/docs/CLI/clients-commands)
54+
- [Use CLI specs commands](/docs/CLI/build-commands)
55+
- [Use CLI clients commands](/docs/CLI/generate-commands)
6356
- [Use CLI release commands](/docs/CLI/release-commands)
64-
- [Use CLI Common Test Suite commands](/docs/CLI/specs-commands)
57+
- [Use CLI Common Test Suite commands](/docs/CLI/build-commands)
6558

6659
## Troubleshooting
6760

website/docs/testing/common-test-suite.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ It is automatically generated for all languages from JSON files and ensure prope
99

1010
:::info
1111

12-
While some clients can run tests from source, languages like Java or JavaScript and other requires clients to be built, see [CLI > clients commands page](/docs/CLI/clients-commands)
12+
While some clients can run tests from source, languages like Java or JavaScript and other requires clients to be built, see [CLI > generate commands page](/docs/CLI/generate-commands)
1313

1414
:::
1515

website/sidebars.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const sidebars = {
1515
type: 'category',
1616
label: 'CLI',
1717
collapsed: false,
18-
items: ['CLI/specs-commands', 'CLI/clients-commands', 'CLI/release-commands', 'CLI/cts-commands'],
18+
items: ['CLI/generate-commands', 'CLI/build-commands', 'CLI/cts-commands', 'CLI/release-commands'],
1919
},
2020
],
2121
},

0 commit comments

Comments
 (0)