Skip to content

Commit

Permalink
migrate to newer oclif
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni committed Apr 3, 2024
1 parent baeb3a9 commit eb50e60
Show file tree
Hide file tree
Showing 13 changed files with 32,606 additions and 8,709 deletions.
20 changes: 2 additions & 18 deletions modelina-cli/bin/dev
Original file line number Diff line number Diff line change
@@ -1,18 +1,2 @@
#!/usr/bin/env nod

const oclif = require('@oclif/core')

const path = require('path')
const project = path.join(__dirname, '..', 'tsconfig.json')

// In dev mode -> use ts-node and dev plugins
process.env.NODE_ENV = 'development'

require('ts-node').register({project})

// In dev mode, always show stack traces
oclif.settings.debug = true;

// Start the CLI
oclif.run().then(oclif.flush).catch(oclif.Errors.handle)

import {execute} from '@oclif/core';
await execute({development: true, dir: import.meta.url});
11 changes: 2 additions & 9 deletions modelina-cli/bin/run
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
#!/usr/bin/env node

const oclif = require('@oclif/core');

oclif.run()
.then(require('@oclif/core/flush'))
.catch((err) => {
const oclifHandler = require('@oclif/core/handle');
return oclifHandler(err.message);
});

import {execute} from '@oclif/core';
await execute({dir: import.meta.url});
94 changes: 48 additions & 46 deletions modelina-cli/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $ npm install -g @asyncapi/modelina-cli
$ modelina COMMAND
running command...
$ modelina (--version)
@asyncapi/modelina-cli/4.0.0-next.22 linux-x64 node-v18.19.1
@asyncapi/modelina-cli/4.0.0-next.23 darwin-x64 node-v18.19.0
$ modelina --help [COMMAND]
USAGE
$ modelina COMMAND
Expand All @@ -45,7 +45,7 @@ USAGE
* [`modelina config context add CONTEXT-NAME SPEC-FILE-PATH`](#modelina-config-context-add-context-name-spec-file-path)
* [`modelina config context current`](#modelina-config-context-current)
* [`modelina config context edit CONTEXT-NAME NEW-SPEC-FILE-PATH`](#modelina-config-context-edit-context-name-new-spec-file-path)
* [`modelina config context init [CONTEXT-FILE-PATH]`](#modelina-config-context-init-context-file-path)
* [`modelina config context init CONTEXT-FILE-PATH`](#modelina-config-context-init-context-file-path)
* [`modelina config context list`](#modelina-config-context-list)
* [`modelina config context remove CONTEXT-NAME`](#modelina-config-context-remove-context-name)
* [`modelina config context use CONTEXT-NAME`](#modelina-config-context-use-context-name)
Expand All @@ -63,7 +63,7 @@ DESCRIPTION
CLI config settings
```

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

## `modelina config context`

Expand All @@ -77,7 +77,7 @@ DESCRIPTION
Manage short aliases for full paths to inputs
```

_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)_
_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)_

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

Expand All @@ -89,7 +89,7 @@ USAGE
ARGUMENTS
CONTEXT-NAME context name
SPEC-FILE-PATH file path of the input document
SPEC-FILE-PATH file path of the spec file
FLAGS
-h, --help Show CLI help.
Expand All @@ -99,7 +99,7 @@ DESCRIPTION
Add a context to the store
```

_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)_
_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)_

## `modelina config context current`

Expand All @@ -116,7 +116,7 @@ DESCRIPTION
Shows the current context that is being used
```

_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)_
_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)_

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

Expand All @@ -128,7 +128,7 @@ USAGE
ARGUMENTS
CONTEXT-NAME context name
NEW-SPEC-FILE-PATH new file path of the input
NEW-SPEC-FILE-PATH file path of the spec file
FLAGS
-h, --help Show CLI help.
Expand All @@ -137,15 +137,15 @@ DESCRIPTION
Edit a context in the store
```

_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)_
_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)_

## `modelina config context init [CONTEXT-FILE-PATH]`
## `modelina config context init CONTEXT-FILE-PATH`

Initialize context

```
USAGE
$ modelina config context init [CONTEXT-FILE-PATH] [-h]
$ modelina config context init CONTEXT-FILE-PATH [-h]
ARGUMENTS
CONTEXT-FILE-PATH Specify directory in which context file should be created:
Expand All @@ -160,7 +160,7 @@ DESCRIPTION
Initialize context
```

_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)_
_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)_

## `modelina config context list`

Expand All @@ -177,7 +177,7 @@ DESCRIPTION
List all the stored contexts in the store
```

_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)_
_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)_

## `modelina config context remove CONTEXT-NAME`

Expand All @@ -197,7 +197,7 @@ DESCRIPTION
Delete a context from the store
```

_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)_
_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)_

## `modelina config context use CONTEXT-NAME`

Expand All @@ -217,7 +217,7 @@ DESCRIPTION
Set a context as current
```

_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)_
_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)_

## `modelina generate LANGUAGE FILE`

Expand All @@ -237,40 +237,42 @@ ARGUMENTS
FILE Path or URL to the AsyncAPI document, or context-name
FLAGS
-h, --help Show CLI help.
-o, --output=<value> The output directory where the models should be written to. Omitting this flag will write
the models to `stdout`.
--csharpArrayType=<option> [default: Array] C# specific, define which type of array needs to be generated.
<options: Array|List>
--csharpAutoImplement C# specific, define whether to generate auto-implemented properties or not.
--csharpEqual C# specific, generate the models with the Equal method overwritten
--csharpHashcode C# specific, generate the models with the GetHashCode method overwritten
--csharpNewtonsoft C# specific, generate the models with newtonsoft serialization support
--csharpSystemJson C# specific, generate the models with System.Text.Json serialization support
--javaConstraints Java specific, generate the models with constraints
--javaIncludeComments Java specific, if enabled add comments while generating models.
--javaJackson Java specific, generate the models with Jackson serialization support
--namespace=<value> C#, C++ and PHP specific, define the namespace to use for the generated models. This is
required when language is `csharp`,`c++` or `php`.
--packageName=<value> Go, Java and Kotlin specific, define the package to use for the generated models. This is
required when language is `go`, `java` or `kotlin`.
--tsEnumType=<option> [default: enum] TypeScript specific, define which type of enums needs to be generated.
<options: enum|union>
--tsExampleInstance Typescript specific, generate example of the model.
--tsExportType=<option> [default: default] TypeScript specific, define which type of export needs to be generated.
<options: default|named>
--tsIncludeComments TypeScript specific, if enabled add comments while generating models.
--tsJsonBinPack TypeScript specific, define basic support for serializing to and from binary with
jsonbinpack.
--tsMarshalling TypeScript specific, generate the models with marshalling functions.
--tsModelType=<option> [default: class] TypeScript specific, define which type of model needs to be generated.
<options: class|interface>
--tsModuleSystem=<option> [default: ESM] TypeScript specific, define the module system to be used.
<options: ESM|CJS>
-h, --help Show CLI help.
-o, --output=<value> The output directory where the models should be written to. Omitting this flag will
write the models to `stdout`.
--csharpArrayType=<option> [default: Array] C# specific, define which type of array needs to be generated.
<options: Array|List>
--csharpAutoImplement C# specific, define whether to generate auto-implemented properties or not.
--csharpEqual C# specific, generate the models with the Equal method overwritten
--csharpHashcode C# specific, generate the models with the GetHashCode method overwritten
--csharpNewtonsoft C# specific, generate the models with newtonsoft serialization support
--csharpSystemJson C# specific, generate the models with System.Text.Json serialization support
--javaConstraints Java specific, generate the models with constraints
--javaIncludeComments Java specific, if enabled add comments while generating models.
--javaJackson Java specific, generate the models with Jackson serialization support
--namespace=<value> C#, C++ and PHP specific, define the namespace to use for the generated models. This
is required when language is `csharp`,`c++` or `php`.
--packageName=<value> Go, Java and Kotlin specific, define the package to use for the generated models. This
is required when language is `go`, `java` or `kotlin`.
--tsEnumType=<option> [default: enum] TypeScript specific, define which type of enums needs to be generated.
<options: enum|union>
--tsExampleInstance Typescript specific, generate example of the model.
--tsExportType=<option> [default: default] TypeScript specific, define which type of export needs to be
generated.
<options: default|named>
--tsIncludeComments TypeScript specific, if enabled add comments while generating models.
--tsJsonBinPack TypeScript specific, define basic support for serializing to and from binary with
jsonbinpack.
--tsMarshalling TypeScript specific, generate the models with marshalling functions.
--tsModelType=<option> [default: class] TypeScript specific, define which type of model needs to be
generated.
<options: class|interface>
--tsModuleSystem=<option> [default: ESM] TypeScript specific, define the module system to be used.
<options: ESM|CJS>
DESCRIPTION
Generates typed models
```

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

0 comments on commit eb50e60

Please sign in to comment.