Skip to content

Commit

Permalink
feat: add Initialize command (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni authored Jun 18, 2024
1 parent fe42d8c commit c984ca0
Show file tree
Hide file tree
Showing 10 changed files with 812 additions and 2,607 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3,003 changes: 422 additions & 2,581 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
"@oclif/errors": "^1.3.6",
"@oclif/plugin-autocomplete": "^3.0.16",
"@oclif/plugin-help": "^6.0.21",
"@oclif/plugin-plugins": "^5.0.16",
"@oclif/plugin-version": "^2.0.17",
"graphology": "^0.25.4",
"inquirer": "^8.2.6",
"supports-esm": "1.0.0",
"yaml": "^2.4.5",
"zod": "^3.23.8",
"zod-to-json-schema": "^3.23.0"
"zod": "^3.23.8"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@oclif/prettier-config": "^0.2.1",
"@oclif/test": "^4.0.2",
"@swc/jest": "^0.2.23",
"@types/inquirer": "^9.0.7",
"@types/jest": "^29.5.12",
"@types/node": "^18",
"@types/rimraf": "^4.0.5",
Expand All @@ -50,7 +50,8 @@
"simple-git": "^3.16.0",
"ts-jest": "^29.1.3",
"ts-node": "^10.9.2",
"typescript": "^5.4.5"
"typescript": "^5.4.5",
"zod-to-json-schema": "^3.23.0"
},
"files": [
"/bin",
Expand All @@ -72,7 +73,6 @@
"bin": "codegen",
"plugins": [
"@oclif/plugin-help",
"@oclif/plugin-plugins",
"@oclif/plugin-autocomplete",
"@oclif/plugin-version"
],
Expand Down
31 changes: 12 additions & 19 deletions src/codegen/generators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@ import {
SupportedLanguages
} from '../types';
import {Logger} from '../../LoggingInterface';
import {
TypeScriptChannelsGenerator,
generateTypeScriptChannels,
defaultTypeScriptChannelsGenerator
} from './typescript/channels/index';
import {
TypeScriptPayloadGenerator,
generateTypescriptPayload,
defaultTypeScriptPayloadGenerator
} from './typescript/payloads';
import {
JavaPayloadGenerator,
generateJavaPayload,
Expand All @@ -25,27 +15,30 @@ import {
import {
TypescriptParametersGenerator,
generateTypescriptParameters,
defaultTypeScriptParametersOptions
} from './typescript/parameters';
defaultTypeScriptParametersOptions,
TypeScriptPayloadGenerator,
generateTypescriptPayload,
defaultTypeScriptPayloadGenerator,
TypeScriptChannelsGenerator,
generateTypeScriptChannels,
defaultTypeScriptChannelsGenerator
} from './typescript';
import {defaultCustomGenerator} from './generic/custom';

export {
TypeScriptChannelsGenerator,
generateTypeScriptChannels,
defaultTypeScriptChannelsGenerator
};
export {
defaultTypeScriptChannelsGenerator,
TypeScriptPayloadGenerator,
generateTypescriptPayload,
defaultTypeScriptPayloadGenerator
};
export {JavaPayloadGenerator, generateJavaPayload, defaultJavaPayloadGenerator};
export {
defaultTypeScriptPayloadGenerator,
TypescriptParametersGenerator,
generateTypescriptParameters,
defaultTypeScriptParametersOptions
};

export {JavaPayloadGenerator, generateJavaPayload, defaultJavaPayloadGenerator};

export async function renderGenerator(
generator: Generators,
context: RunGeneratorContext,
Expand Down
31 changes: 31 additions & 0 deletions src/codegen/generators/typescript/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {
TypeScriptChannelsGenerator,
generateTypeScriptChannels,
defaultTypeScriptChannelsGenerator,
} from "./channels/index";
import {
TypeScriptPayloadGenerator,
generateTypescriptPayload,
defaultTypeScriptPayloadGenerator,
} from "./payloads";
import {
TypescriptParametersGenerator,
generateTypescriptParameters,
defaultTypeScriptParametersOptions,
} from "./parameters";

export {
TypeScriptChannelsGenerator,
generateTypeScriptChannels,
defaultTypeScriptChannelsGenerator,
};
export {
TypeScriptPayloadGenerator,
generateTypescriptPayload,
defaultTypeScriptPayloadGenerator,
};
export {
TypescriptParametersGenerator,
generateTypescriptParameters,
defaultTypeScriptParametersOptions,
};
4 changes: 2 additions & 2 deletions src/commands/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {loadAsyncapi} from '../codegen/inputs/asyncapi';
import {RunGeneratorContext} from '../codegen/types';
import {runGenerators} from '../codegen/index';
export default class Generate extends Command {
static description = 'Generate';
static description = 'Generate code based on your configuration, use `init` to get started.';
static args = {
file: Args.string({
description:
Expand All @@ -18,7 +18,7 @@ export default class Generate extends Command {
};

static flags = {
help: Flags.help({char: 'h'})
help: Flags.help()
};

async run() {
Expand Down
Loading

0 comments on commit c984ca0

Please sign in to comment.