Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(import): dir config option #2937

Open
wants to merge 4 commits into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cli/cmds/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Command implements yargs.CommandModule {
.example('cdk8s import helm:https://charts.bitnami.com/bitnami/mysql@9.10.10', 'Imports the specified version of helm chart')

.option('save', { type: 'boolean', required: false, default: true, desc: "Dont save the import URL in the 'imports' section of the cdk8s.yaml configuration file.", alias: 's' })
.option('output', { default: DEFAULT_OUTDIR, type: 'string', desc: 'Output directory', alias: 'o' })
.option('output', { default: config?.importDirectory ?? DEFAULT_OUTDIR, type: 'string', desc: 'Output directory', alias: 'o' })
.option('exclude', { type: 'array', desc: 'Do not import types that match these regular expressions. They will be represented as the "any" type (only for "k8s")' })
.option('class-prefix', { type: 'string', desc: 'A prefix to add to all generated class names. By default, this is "Kube" for "k8s" imports and disabled for CRD imports. Use --no-class-prefix to disable. Must be PascalCase' })
.option('language', { default: config?.language, demand: true, type: 'string', desc: 'Output programming language', alias: 'l', choices: LANGUAGES });
Expand Down
3 changes: 2 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface Config {
readonly app?: string;
readonly language?: Language;
readonly output?: string;
readonly importDirectory?: string;
readonly imports?: string[];
readonly pluginsDirectory?: string;
readonly validations?: string | ValidationConfig[];
Expand Down Expand Up @@ -74,4 +75,4 @@ export async function addImportToConfig(source: string) {
};
await fs.outputFile(CONFIG_FILE, yaml.stringify(config));
}
}
}
Loading