-
Notifications
You must be signed in to change notification settings - Fork 35
feat(cli): user-provided cdk init templates #673
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
base: main
Are you sure you want to change the base?
Conversation
custom-template-test3/README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 3? Let's have descriptive names if we're going to commit these template examples.
return tempDir; | ||
} catch (e) { | ||
// Clean up on error | ||
await fs.remove(tempDir).catch(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why empty catch block here?
init-fixed.ts
Outdated
|
||
// Auto-detect language if not specified | ||
if (!language && template.languages.length === 1) { | ||
language = template.languages[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember you mentioning we need to specify language, so autodetect can be removed?
template-name-summary.md
Outdated
3. Validate it contains required `typescript/` directory and `info.json` | ||
4. Use that specific template instead of root directory | ||
|
||
### 5. Error Handling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to specify here. How the error is handled should be evident to the user when they attempt to use the CLI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this file
`No --language was provided, but '${type}' supports only '${language}', so defaulting to --language=${language}`, | ||
try { | ||
// BRANCH 1: Git Repository Template Source | ||
if (options.gitUrl) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new options should be gated with the unstable
feature protection. For example:
aws-cdk-cli/packages/aws-cdk/lib/cli/cli.ts
Lines 280 to 282 in 666f1b9
if (!configuration.settings.get(['unstable']).includes('refactor')) { | |
throw new ToolkitError('Unstable feature use: \'refactor\' is unstable. It must be opted in via \'--unstable\', e.g. \'cdk refactor --unstable=refactor\''); | |
} |
Updated functionality allows CDK CLI users to pass in custom templates written in any CDK supported language from local directories, Git repositories, or NPM packages as parameters to the "cdk init" command.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license