Skip to content

Commit a842d8f

Browse files
aliasghar98sohail2721saeedjamshaidShield-Jaguar
authored
feat: restructure working directory usage across all portal commands (#123)
Additional miscellaneous fixes: Improved user messaging Fixed file watcher issues in portal:serve command --------- Co-authored-by: Muhammad Sohail <62895181+sohail2721@users.noreply.github.com> Co-authored-by: saeedjamshaid <saeed.jamshaid@outlook.com> Co-authored-by: Mujahid Daud Khan <37825767+Shield-Jaguar@users.noreply.github.com>
1 parent d322a4c commit a842d8f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1881
-1411
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,4 @@ tmp/
179179
test-source/
180180
test-destination/
181181
test-portal/
182+
/.idea/

.vscode/launch.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
"${workspaceFolder}/node_modules/mocha/bin/_mocha",
6262
"--forbid-only",
6363
"test/**/*.test.ts",
64+
// "--ignore",
65+
// "test/commands/portal/generate.test.ts",
6466
// "${file}", // Run Tests for the currently open test file.
6567
"--timeout",
6668
"99999"

README.md

Lines changed: 22 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ $ npm install -g @apimatic/cli
2424
$ apimatic COMMAND
2525
running command...
2626
$ apimatic (--version)
27-
@apimatic/cli/1.1.0-alpha.10 win32-x64 node-v23.4.0
27+
@apimatic/cli/1.1.0-alpha.14 win32-x64 node-v20.18.3
2828
$ apimatic --help [COMMAND]
2929
USAGE
3030
$ apimatic COMMAND
@@ -75,10 +75,8 @@ DESCRIPTION
7575
7676
EXAMPLES
7777
$ apimatic api:transform --format="OpenApi3Json" --file="./specs/sample.json" --destination="D:/"
78-
Success! Your transformed file is located at D:/Transformed_OpenApi3Json.json
7978
8079
$ apimatic api:transform --format=RAML --url="https://petstore.swagger.io/v2/swagger.json" --destination="D:/"
81-
Success! Your transformed file is located at D:/swagger_raml.yaml
8280
```
8381

8482
_See code: [src/commands/api/transform.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/api/transform.ts)_
@@ -102,10 +100,8 @@ DESCRIPTION
102100
103101
EXAMPLES
104102
$ apimatic api:validate --file="./specs/sample.json"
105-
Specification file provided is valid
106103
107104
$ apimatic api:validate --url=https://petstore.swagger.io/v2/swagger.json
108-
Specification file provided is valid
109105
```
110106

111107
_See code: [src/commands/api/validate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/api/validate.ts)_
@@ -126,12 +122,8 @@ DESCRIPTION
126122
127123
EXAMPLES
128124
$ apimatic auth:login
129-
Enter your registered email: apimatic-user@gmail.com
130-
Please enter your password: *********
131-
You have successfully logged into APIMatic
132125
133126
$ apimatic auth:login --auth-key=xxxxxx
134-
Authentication key successfully set
135127
```
136128

137129
_See code: [src/commands/auth/login.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/login.ts)_
@@ -149,7 +141,6 @@ DESCRIPTION
149141
150142
EXAMPLES
151143
$ apimatic auth:logout
152-
Logged out
153144
```
154145

155146
_See code: [src/commands/auth/logout.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/logout.ts)_
@@ -167,7 +158,6 @@ DESCRIPTION
167158
168159
EXAMPLES
169160
$ apimatic auth:status
170-
Currently logged in as apimatic-client@gmail.com
171161
```
172162

173163
_See code: [src/commands/auth/status.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/status.ts)_
@@ -229,8 +219,9 @@ USAGE
229219
FLAGS
230220
-f, --force overwrite if a portal exists in the destination
231221
--auth-key=<value> override current authentication state with an authentication key
232-
--destination=<value> [default: ./generated_portal] path to the downloaded portal
233-
--folder=<value> [default: ./] path to the input directory containing API specifications and config files
222+
--destination=<value> [default: <folder>/portal] path to the generated portal
223+
--folder=<value> [default: ./] path to the parent directory containing the 'build' folder,
224+
which includes API specifications and configuration files.
234225
--zip download the generated portal as a .zip archive
235226
236227
DESCRIPTION
@@ -240,7 +231,6 @@ DESCRIPTION
240231
241232
EXAMPLES
242233
$ apimatic portal:generate --folder="./portal/" --destination="D:/"
243-
Your portal has been generated at D:/
244234
```
245235

246236
_See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/generate.ts)_
@@ -268,13 +258,11 @@ Generate an API Recipe for a static API Documentation portal.
268258

269259
```
270260
USAGE
271-
$ apimatic portal:recipe:new [--name <value>] [--folder <value>] [--build-config <value>]
261+
$ apimatic portal:recipe:new [--name <value>] [--folder <value>]
272262
273263
FLAGS
274-
--build-config=<value> path to the APIMATIC-BUILD.json file. Defaults to the APIMATIC-BUILD.json file in the build
275-
directory if not provided.
276-
--folder=<value> [default: C:\Users\Ali\Desktop\apimatic-cli] path to the build directory containing specs,
277-
content, and build config file. Defaults to the current working directory if not provided.
264+
--folder=<value> [default: ./] path to the parent directory containing the
265+
'build' folder, which includes API specifications and configuration files.
278266
--name=<value> name for the recipe
279267
280268
DESCRIPTION
@@ -284,11 +272,9 @@ DESCRIPTION
284272
https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/api-recipes
285273
286274
EXAMPLES
287-
$ apimatic portal:recipe:new --name="My API Recipe" --folder="./build-folder" --build-config-file="./build-folder/APIMATIC-BUILD.json"
288-
Generated recipe has been added to build directory at: C:/build-folder/
275+
$ apimatic portal:recipe:new --name="My API Recipe" --folder="./build-folder"
289276
290277
$ apimatic portal:recipe:new
291-
Generated recipe has been added to build directory at: C:/
292278
```
293279

294280
_See code: [src/commands/portal/recipe/new.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/recipe/new.ts)_
@@ -299,24 +285,25 @@ Generate and deploy a Docs as Code portal with hot reload.
299285

300286
```
301287
USAGE
302-
$ apimatic portal:serve [-p <value>] [-d <value>] [-s <value>] [-o] [--no-reload] [-i <value>] [--auth-key
288+
$ apimatic portal:serve [-p <value>] [-destination <value>] [--folder <value>] [-o] [--no-reload] [-i <value>] [--auth-key
303289
<value>]
304290
305291
FLAGS
306-
-d, --destination=<value> [default: ./generated_portal] Directory to store and serve the generated portal.
307-
-i, --ignore=<value> Comma-separated list of files/directories to ignore.
292+
-i, --ignore=<value> Comma-separated list of file and directory paths to exclude from portal generation and hot
293+
reload.
308294
-o, --open Open the portal in the default browser.
309-
-p, --port=<value> [default: 3000] Port to serve the portal.
310-
-s, --source=<value> [default: ./] Source directory containing specs, content, and build file. By default, the
311-
current directory is used.
295+
-p, --port=<value> Port to serve the portal.
312296
--auth-key=<value> Override current authentication state with an authentication key.
297+
--folder=<value> [default: ./] Path to the parent directory containing the 'build' folder,
298+
which includes API specifications and configuration files.
299+
--destination=<value> [default: <folder>/portal] Path to the generated portal.
313300
--no-reload Disable hot reload.
314301
315302
DESCRIPTION
316303
Generate and deploy a Docs as Code portal with hot reload.
317304
318305
EXAMPLES
319-
$ apimatic portal:serve --source="./" --destination="./generated_portal" --port=3000 --open --no-reload
306+
$ apimatic portal:serve --folder="./" --destination="./portal" --port=3000 --open --no-reload
320307
```
321308

322309
_See code: [src/commands/portal/serve.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/serve.ts)_
@@ -331,15 +318,14 @@ USAGE
331318
[--expand-models]
332319
333320
FLAGS
334-
--destination=<value> optional path where the generated TOC file will be saved. Defaults to the current working
335-
directory if not provided.
336-
--expand-endpoints include individual entries for each endpoint in the generated TOC. Requires a valid API
321+
--destination=<value> [default: <folder>/build/content] optional path where the generated toc.yml file will be saved.
322+
--expand-endpoints include individual entries for each endpoint in the generated toc.yml. Requires a valid API
337323
specification in the working directory.
338-
--expand-models include individual entries for each model in the generated TOC. Requires a valid API
324+
--expand-models include individual entries for each model in the generated toc.yml. Requires a valid API
339325
specification in the working directory.
340-
--folder=<value> [default: C:\Users\Ali\Desktop\apimatic-cli] path to the working directory containing the API
341-
project files. Defaults to the current working directory if not specified.
342-
--force overwrite the TOC file if one already exists at the destination.
326+
--folder=<value> [default: ./] Path to the parent directory containing the 'build' folder,
327+
which includes API specifications and configuration files.
328+
--force overwrite the toc.yml file if one already exists at the destination.
343329
344330
DESCRIPTION
345331
Generates a TOC file based on the content directory and spec folder provided in your working directory
@@ -354,13 +340,10 @@ DESCRIPTION
354340
355341
EXAMPLES
356342
$ apimatic portal:toc:new --destination="./portal/content/"
357-
A new toc file has been created at ./portal/content/toc.yml
358343
359344
$ apimatic portal:toc:new --folder="./my-project"
360-
A new toc file has been created at ./my-project/content/toc.yml
361345
362346
$ apimatic portal:toc:new --folder="./my-project" --destination="./portal/content/"
363-
A new toc file has been created at ./portal/content/toc.yml
364347
```
365348

366349
_See code: [src/commands/portal/toc/new.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/toc/new.ts)_
@@ -392,14 +375,8 @@ DESCRIPTION
392375
393376
EXAMPLES
394377
$ apimatic sdk:generate --platform="CSHARP" --file="./specs/sample.json"
395-
Generating SDK... done
396-
Downloading SDK... done
397-
Success! Your SDK is located at swagger_sdk_csharp
398378
399379
$ apimatic sdk:generate --platform="CSHARP" --url=https://petstore.swagger.io/v2/swagger.json
400-
Generating SDK... done
401-
Downloading SDK... done
402-
Success! Your SDK is located at swagger_sdk_csharp
403380
```
404381

405382
_See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/sdk/generate.ts)_

package-lock.json

Lines changed: 29 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)