From a0ef91b877ae472df1f27a06d43223c43c7bfe18 Mon Sep 17 00:00:00 2001 From: Emlyn Rice Date: Fri, 1 Dec 2023 09:04:23 +0800 Subject: [PATCH 1/7] A code gen for typescript --- apps/cli/src/commands/code-gen.ts | 4 +- .../__snapshots__/code-generator.spec.js.snap | 111 ---------------- .../__snapshots__/code-generator.spec.ts.snap | 32 +++++ .../src/lib/code-generator.spec.ts | 124 +++++++++++------ libs/code-generator/src/lib/code-generator.ts | 5 +- .../featureboard-features.ts.template | 16 +++ .../__snapshots__/executor.spec.ts.snap | 46 +++++++ .../src/executors/code-gen/executor.spec.ts | 125 +++++++++++------- .../__snapshots__/generator.spec.ts.snap | 46 +++++++ .../src/generators/code-gen/generator.spec.ts | 125 +++++++++++------- .../src/generators/code-gen/schema.json | 4 + 11 files changed, 385 insertions(+), 253 deletions(-) delete mode 100644 libs/code-generator/src/lib/__snapshots__/code-generator.spec.js.snap create mode 100644 libs/code-generator/src/lib/templates/typescript/featureboard-features.ts.template diff --git a/apps/cli/src/commands/code-gen.ts b/apps/cli/src/commands/code-gen.ts index f84ce9b1..cefb0e0c 100644 --- a/apps/cli/src/commands/code-gen.ts +++ b/apps/cli/src/commands/code-gen.ts @@ -17,13 +17,13 @@ import { promptForOrganization } from '../lib/prompt-for-organization' import { titleText } from '../lib/title-text' // Code Gen -const templateChoices: Template[] = ['dotnet-api'] +const templateChoices: Template[] = ['dotnet-api', 'typescript'] export function codeGenCommand() { return new Command('code-gen') .description(`A Code generator for FeatureBoard`) .option('-o, --output ', 'Output path') - .option('-g, --organizationId ', 'The Orgnization Id') + .option('-g, --organizationId ', 'The Organization Id') .addOption( new Option( '-t, --template