Skip to content

Commit

Permalink
feat(src/import): Add support for dotnet to cdk8s import.
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Kane <[email protected]>
  • Loading branch information
ScottKane committed Jul 26, 2024
1 parent 148ca1f commit c4441bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cli/cmds/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { parseImports } from '../../util';
const config = readConfigSync();

const DEFAULT_OUTDIR = 'imports';
const LANGUAGES = ['typescript', 'python', 'java', 'go'];
const LANGUAGES = ['dotnet', 'typescript', 'python', 'java', 'go'];

class Command implements yargs.CommandModule {
public readonly command = 'import [SPEC]';
Expand Down
9 changes: 9 additions & 0 deletions src/import/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ export abstract class ImportBase {
};
}

// csharp!
if (options.targetLanguage === Language.DOTNET) {
const csharpName = module.name.replace(/\//g, '.').replace(/-/g, '_').replace(/(?:^|_)([a-z])/g, (_, char) => char.toUpperCase());
opts.csharp = {
outdir: outdir,
namespace: `Imports.${moduleNamePrefix ? moduleNamePrefix + '.' + csharpName : csharpName}`,
};
}

await srcmak.srcmak(staging, opts);
});
}
Expand Down

0 comments on commit c4441bb

Please sign in to comment.