Skip to content

Commit ab2da9a

Browse files
authored
feat(portal): adds portal quickstart and serve commands (#33)
Implements a part of #10 . What was Added? Added the portal:quickstart command for helping new users get started with APIMatic Docs-as-Code solution. Added the portal:serve command to allow serving of static portals generated using Docs-as-Code locally.
1 parent 407c72f commit ab2da9a

34 files changed

Lines changed: 11825 additions & 12714 deletions

.github/workflows/check_build.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ jobs:
1818
runs-on: ubuntu-latest
1919
strategy:
2020
matrix:
21-
node: [ '14', '18' ]
21+
node: [ '14', '18', '20' ]
2222
name: Node ${{ matrix.node }} sample
2323
steps:
2424
- name: checkout cli
25-
uses: actions/checkout@v2
25+
uses: actions/checkout@v4
2626
with:
2727
repository: apimatic/apimatic-cli
28-
token: ${{ secrets.ACCESS_TOKEN }}
28+
token: ${{ secrets.GITHUB_TOKEN }}
2929
persist-credentials: false
3030
fetch-depth: 0
3131
path: cli
@@ -35,9 +35,7 @@ jobs:
3535

3636
- name: Install dependencies
3737
working-directory: cli
38-
run: |
39-
git config --global url."https://${{ secrets.ACCESS_TOKEN }}@github.com/".insteadOf https://github.com/
40-
npm install
38+
run: npm install
4139

4240
- name: Check Build
4341
working-directory: 'cli'

.github/workflows/npm-tag-latest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ jobs:
1313
steps:
1414
- name: change-latest-tag
1515
env:
16-
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1717
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1818
run: npm dist-tag add @apimatic/cli@${LATEST_VERSION} latest

.github/workflows/release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
node: [ '18' ]
12+
node: [ '20' ]
1313
name: Release with Node version ${{ matrix.node }}
1414
steps:
1515
- name: Checkout CLI
1616
uses: actions/checkout@v2
1717
with:
1818
repository: apimatic/apimatic-cli
19-
token: ${{ secrets.ACCESS_TOKEN }}
19+
token: ${{ secrets.GITHUB_TOKEN }}
2020
persist-credentials: false
2121
fetch-depth: 0
2222
path: cli
@@ -27,7 +27,6 @@ jobs:
2727
- name: Install dependencies
2828
working-directory: cli
2929
run: |
30-
git config --global url."https://${{ secrets.ACCESS_TOKEN }}@github.com/".insteadOf https://github.com/
3130
npm install
3231
npm install --save-dev @semantic-release/changelog @semantic-release/git
3332
- name: Check Build
@@ -37,6 +36,6 @@ jobs:
3736
- name: Release
3837
working-directory: cli
3938
env:
40-
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4140
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4241
run: npx semantic-release

README.md

Lines changed: 115 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@apimatic/cli
22
=============
3+
apimatic is in Alpha.
34

45
The official CLI for APIMatic.
56

@@ -8,18 +9,26 @@ The official CLI for APIMatic.
89
[![Downloads/week](https://img.shields.io/npm/dw/@apimatic/cli.svg)](https://npmjs.org/package/@apimatic/cli)
910
[![License](https://img.shields.io/npm/l/@apimatic/cli.svg)](https://github.com/apimatic/apimatic-cli/blob/master/package.json)
1011

12+
# Getting Started
13+
14+
To get started with APIMatic's CLI using a step by step wizard, run the following command:
15+
16+
```sh-session
17+
$ apimatic portal:quickstart
18+
```
19+
1120
<!-- toc -->
1221
* [Usage](#usage)
1322
* [Commands](#commands)
1423
<!-- tocstop -->
1524
# Usage
1625
<!-- usage -->
1726
```sh-session
18-
$ npm install -g @apimatic/cli@1.0.1-alpha.3
27+
$ npm install -g @apimatic/cli
1928
$ apimatic COMMAND
2029
running command...
21-
$ apimatic (-v|--version|version)
22-
@apimatic/cli/0.0.0-alpha.3 linux-x64 node-v16.13.0
30+
$ apimatic (--version)
31+
@apimatic/cli/0.0.0-alpha.0 win32-x64 node-v20.18.3
2332
$ apimatic --help [COMMAND]
2433
USAGE
2534
$ apimatic COMMAND
@@ -37,6 +46,8 @@ USAGE
3746
* [`apimatic autocomplete [SHELL]`](#apimatic-autocomplete-shell)
3847
* [`apimatic help [COMMAND]`](#apimatic-help-command)
3948
* [`apimatic portal:generate`](#apimatic-portalgenerate)
49+
* [`apimatic portal:quickstart`](#apimatic-portalquickstart)
50+
* [`apimatic portal:serve`](#apimatic-portalserve)
4051
* [`apimatic sdk:generate`](#apimatic-sdkgenerate)
4152

4253
## `apimatic api:transform`
@@ -45,9 +56,10 @@ Transform API specifications from one format to another. Supports [10+ different
4556

4657
```
4758
USAGE
48-
$ apimatic api:transform
59+
$ apimatic api:transform --format <value> [--file <value>] [--url <value>] [--destination <value>] [-f]
60+
[--auth-key <value>]
4961
50-
OPTIONS
62+
FLAGS
5163
-f, --force overwrite if same file exist in the destination
5264
--auth-key=auth-key override current authentication state with an authentication key
5365
@@ -63,6 +75,11 @@ OPTIONS
6375
--url=url URL to the API specification file to transform. Can be used in place of the --file option
6476
if the API specification is publicly available.
6577
78+
DESCRIPTION
79+
Transform API specifications from one format to another. Supports [10+ different
80+
formats](https://www.apimatic.io/transformer/#supported-formats) including OpenApi/Swagger, RAML, WSDL and Postman
81+
Collections.
82+
6683
EXAMPLES
6784
$ apimatic api:transform --format="OpenApi3Json" --file="./specs/sample.json" --destination="D:/"
6885
Success! Your transformed file is located at D:/Transformed_OpenApi3Json.json
@@ -71,23 +88,26 @@ EXAMPLES
7188
Success! Your transformed file is located at D:/swagger_raml.yaml
7289
```
7390

74-
_See code: [src/commands/api/transform.ts](https://github.com/apimatic/apimatic-cli/blob/v0.0.0-alpha.3/src/commands/api/transform.ts)_
91+
_See code: [src/commands/api/transform.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/api/transform.ts)_
7592

7693
## `apimatic api:validate`
7794

7895
Validate the syntactic and semantic correctness of an API specification
7996

8097
```
8198
USAGE
82-
$ apimatic api:validate
99+
$ apimatic api:validate [--file <value>] [--url <value>] [--auth-key <value>]
83100
84-
OPTIONS
101+
FLAGS
85102
--auth-key=auth-key override current authentication state with an authentication key
86103
--file=file Path to the API specification file to validate
87104
88105
--url=url URL to the specification file to validate. Can be used in place of the --file option if the API
89106
specification is publicly available.
90107
108+
DESCRIPTION
109+
Validate the syntactic and semantic correctness of an API specification
110+
91111
EXAMPLES
92112
$ apimatic api:validate --file="./specs/sample.json"
93113
Specification file provided is valid
@@ -96,19 +116,22 @@ EXAMPLES
96116
Specification file provided is valid
97117
```
98118

99-
_See code: [src/commands/api/validate.ts](https://github.com/apimatic/apimatic-cli/blob/v0.0.0-alpha.3/src/commands/api/validate.ts)_
119+
_See code: [src/commands/api/validate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/api/validate.ts)_
100120

101121
## `apimatic auth:login`
102122

103123
Login using your APIMatic credentials or an API Key
104124

105125
```
106126
USAGE
107-
$ apimatic auth:login
127+
$ apimatic auth:login [--auth-key <value>]
108128
109-
OPTIONS
129+
FLAGS
110130
--auth-key=auth-key Set authentication key for all commands
111131
132+
DESCRIPTION
133+
Login using your APIMatic credentials or an API Key
134+
112135
EXAMPLES
113136
$ apimatic auth:login
114137
Please enter your registered email: apimatic-user@gmail.com
@@ -120,7 +143,7 @@ EXAMPLES
120143
Authentication key successfully set
121144
```
122145

123-
_See code: [src/commands/auth/login.ts](https://github.com/apimatic/apimatic-cli/blob/v0.0.0-alpha.3/src/commands/auth/login.ts)_
146+
_See code: [src/commands/auth/login.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/login.ts)_
124147

125148
## `apimatic auth:logout`
126149

@@ -130,12 +153,15 @@ Clear local login credentials
130153
USAGE
131154
$ apimatic auth:logout
132155
133-
EXAMPLE
156+
DESCRIPTION
157+
Clear local login credentials
158+
159+
EXAMPLES
134160
$ apimatic auth:logout
135161
Logged out
136162
```
137163

138-
_See code: [src/commands/auth/logout.ts](https://github.com/apimatic/apimatic-cli/blob/v0.0.0-alpha.3/src/commands/auth/logout.ts)_
164+
_See code: [src/commands/auth/logout.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/logout.ts)_
139165

140166
## `apimatic auth:status`
141167

@@ -145,39 +171,45 @@ View current authentication state
145171
USAGE
146172
$ apimatic auth:status
147173
148-
EXAMPLE
174+
DESCRIPTION
175+
View current authentication state
176+
177+
EXAMPLES
149178
$ apimatic auth:status
150179
Currently logged in as apimatic-client@gmail.com
151180
```
152181

153-
_See code: [src/commands/auth/status.ts](https://github.com/apimatic/apimatic-cli/blob/v0.0.0-alpha.3/src/commands/auth/status.ts)_
182+
_See code: [src/commands/auth/status.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/status.ts)_
154183

155184
## `apimatic autocomplete [SHELL]`
156185

157-
display autocomplete installation instructions
186+
Display autocomplete installation instructions.
158187

159188
```
160189
USAGE
161-
$ apimatic autocomplete [SHELL]
190+
$ apimatic autocomplete [SHELL] [-r]
162191
163192
ARGUMENTS
164193
SHELL shell type
165194
166-
OPTIONS
195+
FLAGS
167196
-r, --refresh-cache Refresh cache (ignores displaying instructions)
168197
198+
DESCRIPTION
199+
Display autocomplete installation instructions.
200+
169201
EXAMPLES
170202
$ apimatic autocomplete
171203
$ apimatic autocomplete bash
172204
$ apimatic autocomplete zsh
173205
$ apimatic autocomplete --refresh-cache
174206
```
175207

176-
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v0.3.0/src/commands/autocomplete/index.ts)_
208+
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/main/src/commands/autocomplete/index.ts)_
177209

178210
## `apimatic help [COMMAND]`
179211

180-
display help for apimatic
212+
Display help for apimatic.
181213

182214
```
183215
USAGE
@@ -186,43 +218,87 @@ USAGE
186218
ARGUMENTS
187219
COMMAND command to show help for
188220
189-
OPTIONS
190-
--all see all commands in CLI
221+
DESCRIPTION
222+
Display help for apimatic.
191223
```
192224

193-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.14/src/commands/help.ts)_
225+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/main/src/commands/help.ts)_
194226

195227
## `apimatic portal:generate`
196228

197-
Generate and download a static API Documentation portal. Requires an input directory containing API specifications, a config file and optionally, markdown guides. For details, refer to the [documentation](https://portal-api-docs.apimatic.io/#/http/generating-api-portal/build-file)
229+
Generate and download a static API Documentation portal. Requires an input directory containing API specifications, a config file and optionally, markdown guides. For details, refer to the [documentation](https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/build-file-reference)
198230

199231
```
200232
USAGE
201-
$ apimatic portal:generate
233+
$ apimatic portal:generate [--folder <value>] [--destination <value>] [-f] [--zip] [--auth-key <value>]
202234
203-
OPTIONS
235+
FLAGS
204236
-f, --force overwrite if a portal exists in the destination
205-
--auth-key=auth-key override current authentication state with an authentication key
206-
--destination=destination [default: /home/runner/work/apimatic-cli/apimatic-cli/cli] path to the downloaded portal
207-
--folder=folder [default: ./] path to the input directory containing API specifications and config files
208-
--zip download the generated portal as a .zip archive
237+
DESCRIPTION
238+
Generate and download a static API Documentation portal. Requires an input directory containing API specifications, a
239+
config file and optionally, markdown guides. For details, refer to the [documentation](https://docs.apimatic.io/platfo
240+
rm-api/#/http/guides/generating-on-prem-api-portal/build-file-reference)
209241
210-
EXAMPLE
242+
EXAMPLES
211243
$ apimatic portal:generate --folder="./portal/" --destination="D:/"
212244
Your portal has been generated at D:/
213245
```
214246

215-
_See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v0.0.0-alpha.3/src/commands/portal/generate.ts)_
247+
_See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/generate.ts)_
248+
249+
## `apimatic portal:quickstart`
250+
251+
Create your first API Portal using APIMatic’s Docs as Code offering.
252+
253+
```
254+
USAGE
255+
$ apimatic portal:quickstart
256+
257+
DESCRIPTION
258+
Create your first API Portal using APIMatic’s Docs as Code offering.
259+
260+
EXAMPLES
261+
$ apimatic portal:quickstart
262+
```
263+
264+
_See code: [src/commands/portal/quickstart.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.11/src/commands/portal/quickstart.ts)_
265+
266+
## `apimatic portal:serve`
267+
268+
Generate and deploy a Docs as Code portal with hot reload.
269+
270+
```
271+
USAGE
272+
$ apimatic portal:serve [-p <value>] [-d <value>] [-s <value>] [-o] [--no-reload] [-i <value>] [--auth-key <value>]
273+
274+
FLAGS
275+
-d, --destination=<value> [default: ./api-portal] Directory to store and serve the generated portal.
276+
-i, --ignore=<value> Comma-separated list of files/directories to ignore.
277+
-o, --open Open the portal in the default browser.
278+
-p, --port=<value> [default: 3000] Port to serve the portal.
279+
-s, --source=<value> [default: ./] Source directory containing specs, content, and build file. By default, the
280+
current directory is used.
281+
--auth-key=<value> Override current authentication state with an authentication key.
282+
--no-reload Disable hot reload.
283+
284+
DESCRIPTION
285+
Generate and deploy a Docs as Code portal with hot reload.
286+
287+
EXAMPLES
288+
$ apimatic portal:serve --source="./" --destination="./api-portal" --port=3000 --open --no-reload
289+
```
290+
291+
_See code: [src/commands/portal/serve.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.11/src/commands/portal/serve.ts)_
216292

217293
## `apimatic sdk:generate`
218294

219295
Generate SDK for your APIs
220296

221297
```
222298
USAGE
223-
$ apimatic sdk:generate
299+
$ apimatic sdk:generate --platform <value> [--file <value>] [--url <value>] [--destination <value>] [-f] [--zip] [--auth-key <value>]
224300
225-
OPTIONS
301+
FLAGS
226302
-f, --force overwrite if an SDK already exists in the destination
227303
--auth-key=auth-key override current authentication state with an authentication key
228304
@@ -239,8 +315,10 @@ OPTIONS
239315
240316
--url=url URL to the API specification to generate SDKs for. Can be used in place of the --file
241317
option if the API specification is publicly available.
318+
--zip download the generated SDK as a .zip archive
242319
243-
--zip download the generated SDK as a .zip archive
320+
DESCRIPTION
321+
Generate SDK for your APIs
244322
245323
EXAMPLES
246324
$ apimatic sdk:generate --platform="CSHARP" --file="./specs/sample.json"
@@ -254,5 +332,5 @@ EXAMPLES
254332
Success! Your SDK is located at swagger_sdk_csharp
255333
```
256334

257-
_See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v0.0.0-alpha.3/src/commands/sdk/generate.ts)_
335+
_See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/sdk/generate.ts)_
258336
<!-- commandsstop -->

0 commit comments

Comments
 (0)