Skip to content

Commit 249ad9f

Browse files
authored
feat: migrate to new Oclif versions (#1923)
1 parent 534837e commit 249ad9f

File tree

16 files changed

+31545
-8880
lines changed

16 files changed

+31545
-8880
lines changed

modelina-cli/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
node_modules
1010
oclif.lock
1111
oclif.manifest.json
12-
dist
12+
dist

modelina-cli/bin/dev

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,2 @@
1-
#!/usr/bin/env nod
2-
3-
const oclif = require('@oclif/core')
4-
5-
const path = require('path')
6-
const project = path.join(__dirname, '..', 'tsconfig.json')
7-
8-
// In dev mode -> use ts-node and dev plugins
9-
process.env.NODE_ENV = 'development'
10-
11-
require('ts-node').register({project})
12-
13-
// In dev mode, always show stack traces
14-
oclif.settings.debug = true;
15-
16-
// Start the CLI
17-
oclif.run().then(oclif.flush).catch(oclif.Errors.handle)
18-
1+
import {execute} from '@oclif/core';
2+
await execute({development: true, dir: import.meta.url});

modelina-cli/bin/run

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
#!/usr/bin/env node
22

3-
const oclif = require('@oclif/core');
4-
5-
oclif.run()
6-
.then(require('@oclif/core/flush'))
7-
.catch((err) => {
8-
const oclifHandler = require('@oclif/core/handle');
9-
return oclifHandler(err.message);
10-
});
11-
3+
import {execute} from '@oclif/core';
4+
await execute({dir: import.meta.url});

modelina-cli/docs/usage.md

Lines changed: 54 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,33 @@
1-
---
2-
title: 'Usage'
3-
weight: 40
4-
---
5-
6-
<!--
7-
8-
This file is automatically generated from updateUsageDocs.js script. In package.json in line 158-161 lines the following steps has been executed in order to run this script successfully -
9-
10-
* generate:readme:create: It creates the initial content for the README file by printing the usage and commands tags using printf and redirects the output to scripts/README.md file.
11-
* generate:readme:commands: It changes the directory to the scripts folder and executes the oclif readme command. This command generates the usage and commands sections based on the CLI commands and updates the content in the scripts/README.md file.
12-
* generate:assets: This script combines the two previously mentioned scripts (generate:readme:toc and generate:commands) to generate the necessary assets, such as the README file and usage documentation.
13-
* generate:commands: This script executes the following steps:
14-
- Runs the generate:readme:create script to create the initial content for the README file.
15-
- Executes the generate:readme:commands script to generate the usage and commands sections based on the CLI commands.
16-
- Runs the updateUsageDocs.js script using Node.js to update the usage documentation file with the contents of the generated README file.
17-
- Deletes the scripts/README.md file using the rimraf command.
18-
19-
-->
20-
211
The Modelina CLI makes it easier to generate AsyncAPI Models.
222

23-
3+
# Table of contents
4+
<!-- toc -->
5+
* [Table of contents](#table-of-contents)
6+
* [Usage](#usage)
7+
* [Commands](#commands)
8+
<!-- tocstop -->
249
# Usage
25-
2610
<!-- usage -->
2711
```sh-session
2812
$ npm install -g @asyncapi/modelina-cli
2913
$ modelina COMMAND
3014
running command...
3115
$ modelina (--version)
32-
@asyncapi/modelina-cli/4.0.0-next.22 linux-x64 node-v18.19.1
16+
@asyncapi/modelina-cli/4.0.0-next.23 darwin-x64 node-v18.19.0
3317
$ modelina --help [COMMAND]
3418
USAGE
3519
$ modelina COMMAND
3620
...
3721
```
3822
<!-- usagestop -->
39-
4023
# Commands
41-
4224
<!-- commands -->
4325
* [`modelina config`](#modelina-config)
4426
* [`modelina config context`](#modelina-config-context)
4527
* [`modelina config context add CONTEXT-NAME SPEC-FILE-PATH`](#modelina-config-context-add-context-name-spec-file-path)
4628
* [`modelina config context current`](#modelina-config-context-current)
4729
* [`modelina config context edit CONTEXT-NAME NEW-SPEC-FILE-PATH`](#modelina-config-context-edit-context-name-new-spec-file-path)
48-
* [`modelina config context init [CONTEXT-FILE-PATH]`](#modelina-config-context-init-context-file-path)
30+
* [`modelina config context init CONTEXT-FILE-PATH`](#modelina-config-context-init-context-file-path)
4931
* [`modelina config context list`](#modelina-config-context-list)
5032
* [`modelina config context remove CONTEXT-NAME`](#modelina-config-context-remove-context-name)
5133
* [`modelina config context use CONTEXT-NAME`](#modelina-config-context-use-context-name)
@@ -63,7 +45,7 @@ DESCRIPTION
6345
CLI config settings
6446
```
6547

66-
_See code: [src/commands/config/index.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.22/src/commands/config/index.ts)_
48+
_See code: [src/commands/config/index.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.23/src/commands/config/index.ts)_
6749

6850
## `modelina config context`
6951

@@ -77,7 +59,7 @@ DESCRIPTION
7759
Manage short aliases for full paths to inputs
7860
```
7961

80-
_See code: [src/commands/config/context/index.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.22/src/commands/config/context/index.ts)_
62+
_See code: [src/commands/config/context/index.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.23/src/commands/config/context/index.ts)_
8163

8264
## `modelina config context add CONTEXT-NAME SPEC-FILE-PATH`
8365

@@ -89,7 +71,7 @@ USAGE
8971
9072
ARGUMENTS
9173
CONTEXT-NAME context name
92-
SPEC-FILE-PATH file path of the input document
74+
SPEC-FILE-PATH file path of the spec file
9375
9476
FLAGS
9577
-h, --help Show CLI help.
@@ -99,7 +81,7 @@ DESCRIPTION
9981
Add a context to the store
10082
```
10183

102-
_See code: [src/commands/config/context/add.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.22/src/commands/config/context/add.ts)_
84+
_See code: [src/commands/config/context/add.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.23/src/commands/config/context/add.ts)_
10385

10486
## `modelina config context current`
10587

@@ -116,7 +98,7 @@ DESCRIPTION
11698
Shows the current context that is being used
11799
```
118100

119-
_See code: [src/commands/config/context/current.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.22/src/commands/config/context/current.ts)_
101+
_See code: [src/commands/config/context/current.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.23/src/commands/config/context/current.ts)_
120102

121103
## `modelina config context edit CONTEXT-NAME NEW-SPEC-FILE-PATH`
122104

@@ -128,7 +110,7 @@ USAGE
128110
129111
ARGUMENTS
130112
CONTEXT-NAME context name
131-
NEW-SPEC-FILE-PATH new file path of the input
113+
NEW-SPEC-FILE-PATH file path of the spec file
132114
133115
FLAGS
134116
-h, --help Show CLI help.
@@ -137,15 +119,15 @@ DESCRIPTION
137119
Edit a context in the store
138120
```
139121

140-
_See code: [src/commands/config/context/edit.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.22/src/commands/config/context/edit.ts)_
122+
_See code: [src/commands/config/context/edit.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.23/src/commands/config/context/edit.ts)_
141123

142-
## `modelina config context init [CONTEXT-FILE-PATH]`
124+
## `modelina config context init CONTEXT-FILE-PATH`
143125

144126
Initialize context
145127

146128
```
147129
USAGE
148-
$ modelina config context init [CONTEXT-FILE-PATH] [-h]
130+
$ modelina config context init CONTEXT-FILE-PATH [-h]
149131
150132
ARGUMENTS
151133
CONTEXT-FILE-PATH Specify directory in which context file should be created:
@@ -160,7 +142,7 @@ DESCRIPTION
160142
Initialize context
161143
```
162144

163-
_See code: [src/commands/config/context/init.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.22/src/commands/config/context/init.ts)_
145+
_See code: [src/commands/config/context/init.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.23/src/commands/config/context/init.ts)_
164146

165147
## `modelina config context list`
166148

@@ -177,7 +159,7 @@ DESCRIPTION
177159
List all the stored contexts in the store
178160
```
179161

180-
_See code: [src/commands/config/context/list.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.22/src/commands/config/context/list.ts)_
162+
_See code: [src/commands/config/context/list.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.23/src/commands/config/context/list.ts)_
181163

182164
## `modelina config context remove CONTEXT-NAME`
183165

@@ -197,7 +179,7 @@ DESCRIPTION
197179
Delete a context from the store
198180
```
199181

200-
_See code: [src/commands/config/context/remove.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.22/src/commands/config/context/remove.ts)_
182+
_See code: [src/commands/config/context/remove.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.23/src/commands/config/context/remove.ts)_
201183

202184
## `modelina config context use CONTEXT-NAME`
203185

@@ -217,7 +199,7 @@ DESCRIPTION
217199
Set a context as current
218200
```
219201

220-
_See code: [src/commands/config/context/use.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.22/src/commands/config/context/use.ts)_
202+
_See code: [src/commands/config/context/use.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.23/src/commands/config/context/use.ts)_
221203

222204
## `modelina generate LANGUAGE FILE`
223205

@@ -237,40 +219,42 @@ ARGUMENTS
237219
FILE Path or URL to the AsyncAPI document, or context-name
238220
239221
FLAGS
240-
-h, --help Show CLI help.
241-
-o, --output=<value> The output directory where the models should be written to. Omitting this flag will write
242-
the models to `stdout`.
243-
--csharpArrayType=<option> [default: Array] C# specific, define which type of array needs to be generated.
244-
<options: Array|List>
245-
--csharpAutoImplement C# specific, define whether to generate auto-implemented properties or not.
246-
--csharpEqual C# specific, generate the models with the Equal method overwritten
247-
--csharpHashcode C# specific, generate the models with the GetHashCode method overwritten
248-
--csharpNewtonsoft C# specific, generate the models with newtonsoft serialization support
249-
--csharpSystemJson C# specific, generate the models with System.Text.Json serialization support
250-
--javaConstraints Java specific, generate the models with constraints
251-
--javaIncludeComments Java specific, if enabled add comments while generating models.
252-
--javaJackson Java specific, generate the models with Jackson serialization support
253-
--namespace=<value> C#, C++ and PHP specific, define the namespace to use for the generated models. This is
254-
required when language is `csharp`,`c++` or `php`.
255-
--packageName=<value> Go, Java and Kotlin specific, define the package to use for the generated models. This is
256-
required when language is `go`, `java` or `kotlin`.
257-
--tsEnumType=<option> [default: enum] TypeScript specific, define which type of enums needs to be generated.
258-
<options: enum|union>
259-
--tsExampleInstance Typescript specific, generate example of the model.
260-
--tsExportType=<option> [default: default] TypeScript specific, define which type of export needs to be generated.
261-
<options: default|named>
262-
--tsIncludeComments TypeScript specific, if enabled add comments while generating models.
263-
--tsJsonBinPack TypeScript specific, define basic support for serializing to and from binary with
264-
jsonbinpack.
265-
--tsMarshalling TypeScript specific, generate the models with marshalling functions.
266-
--tsModelType=<option> [default: class] TypeScript specific, define which type of model needs to be generated.
267-
<options: class|interface>
268-
--tsModuleSystem=<option> [default: ESM] TypeScript specific, define the module system to be used.
269-
<options: ESM|CJS>
222+
-h, --help Show CLI help.
223+
-o, --output=<value> The output directory where the models should be written to. Omitting this flag will
224+
write the models to `stdout`.
225+
--csharpArrayType=<option> [default: Array] C# specific, define which type of array needs to be generated.
226+
<options: Array|List>
227+
--csharpAutoImplement C# specific, define whether to generate auto-implemented properties or not.
228+
--csharpEqual C# specific, generate the models with the Equal method overwritten
229+
--csharpHashcode C# specific, generate the models with the GetHashCode method overwritten
230+
--csharpNewtonsoft C# specific, generate the models with newtonsoft serialization support
231+
--csharpSystemJson C# specific, generate the models with System.Text.Json serialization support
232+
--javaConstraints Java specific, generate the models with constraints
233+
--javaIncludeComments Java specific, if enabled add comments while generating models.
234+
--javaJackson Java specific, generate the models with Jackson serialization support
235+
--namespace=<value> C#, C++ and PHP specific, define the namespace to use for the generated models. This
236+
is required when language is `csharp`,`c++` or `php`.
237+
--packageName=<value> Go, Java and Kotlin specific, define the package to use for the generated models. This
238+
is required when language is `go`, `java` or `kotlin`.
239+
--tsEnumType=<option> [default: enum] TypeScript specific, define which type of enums needs to be generated.
240+
<options: enum|union>
241+
--tsExampleInstance Typescript specific, generate example of the model.
242+
--tsExportType=<option> [default: default] TypeScript specific, define which type of export needs to be
243+
generated.
244+
<options: default|named>
245+
--tsIncludeComments TypeScript specific, if enabled add comments while generating models.
246+
--tsJsonBinPack TypeScript specific, define basic support for serializing to and from binary with
247+
jsonbinpack.
248+
--tsMarshalling TypeScript specific, generate the models with marshalling functions.
249+
--tsModelType=<option> [default: class] TypeScript specific, define which type of model needs to be
250+
generated.
251+
<options: class|interface>
252+
--tsModuleSystem=<option> [default: ESM] TypeScript specific, define the module system to be used.
253+
<options: ESM|CJS>
270254
271255
DESCRIPTION
272256
Generates typed models
273257
```
274258

275-
_See code: [src/commands/generate.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.22/src/commands/generate.ts)_
259+
_See code: [src/commands/generate.ts](https://github.com/asyncapi/modelina/blob/v4.0.0-next.23/src/commands/generate.ts)_
276260
<!-- commandsstop -->

0 commit comments

Comments
 (0)