-
Notifications
You must be signed in to change notification settings - Fork 4k
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
cdk: add option to specify projectName to cdk init
#31992
Comments
cdk init
cdk init
related: #29695 |
Findings:
|
The comment for #29695 mentioned above was made in April. Any update on how we should deal with this issue going forward? |
Describe the feature
When running
cdk init
, I want to pass projectName as a command option.Use Case
I'm always frustrated when I have to manually change the stack name and file names generated by
cdk init
.This could be resolved by making a
projectName
option available.Proposed Solution
I think the steps for possible implementation are as follows
name
optionFor example, add
name
to the command options.(see: https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk/lib/cli.ts#L304-L308)
.command('init [TEMPLATE]', 'Create a new, empty CDK project from a template.', (yargs: Argv) => yargs .option('language', { type: 'string', alias: 'l', desc: 'The language to be used for the new project (default can be configured in ~/.cdk.json)', choices: initTemplateLanguages }) + .option('name', { type: 'string', alias: 'n', desc: 'The name of new project' }) .option('list', { type: 'boolean', desc: 'List the available templates' }) .option('generate-only', { type: 'boolean', default: false, desc: 'If true, only generates project files, without executing additional operations such as setting up a git repo, installing dependencies or compiling the project' }), )
packages/aws-cdk/lib/init.ts
Add the
name
property toCliInitOptions
and modify theinstall
method as follows(see: https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk/lib/init.ts)
Other Information
No response
Acknowledgements
CDK version used
2.146.0
Environment details (OS name and version, etc.)
macOS Sonoma v14.0
The text was updated successfully, but these errors were encountered: