-
Notifications
You must be signed in to change notification settings - Fork 40
feat(cli): add git repository support for custom init templates #820
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?
feat(cli): add git repository support for custom init templates #820
Conversation
Signed-off-by: github-actions <[email protected]>
Signed-off-by: github-actions <[email protected]>
…positories that users can select templates from using --template-path param
Signed-off-by: github-actions <[email protected]>
…ased on CR feedback
Signed-off-by: github-actions <[email protected]>
Signed-off-by: github-actions <[email protected]>
…fy implies constraint works correctly
Signed-off-by: github-actions <[email protected]>
Signed-off-by: github-actions <[email protected]>
Co-authored-by: Ian Hou <[email protected]>
Signed-off-by: github-actions <[email protected]>
…guage specified, and fixed post-install for CDK languages
Signed-off-by: github-actions <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #820 +/- ##
==========================================
- Coverage 82.60% 80.93% -1.68%
==========================================
Files 64 64
Lines 9465 9075 -390
Branches 1106 1108 +2
==========================================
- Hits 7819 7345 -474
- Misses 1612 1698 +86
+ Partials 34 32 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Probably will need to wait until #819 is merged.
'template-path': { type: 'string', desc: 'Path to a specific template within a multi-template repository', requiresArg: true }, | ||
}, | ||
implies: { 'template-path': 'from-path' }, |
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.
This should be replaced by a check that ensures that from-path
or from-git-url
was also used.
@@ -84,16 +91,27 @@ export async function cliInit(options: CliInitOptions) { | |||
const generateOnly = options.generateOnly ?? false; | |||
const workDir = options.workDir ?? process.cwd(); | |||
|
|||
// Validate that if template-path is provided, exactly one custom template source must be provided | |||
if (options.templatePath && !options.fromPath && !options.fromGitUrl) { | |||
throw new ToolkitError('--template-path can only be used with --from-path or --from-git-url'); |
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 not use a check in yargs instead? In general, try to catch problems as early as you can.
9b3ea2d
to
5437650
Compare
Signed-off-by: github-actions <[email protected]>
Updated code for
cdk init
command to handle custom templates from Git repository sources. This is compatible with the existing--language
and--template-path
flags. The--from-git-url
flag was added to clone a Git URL that is passed in by the user, clones the repository, extracts the specified template files and initializes new project with them. Thecdk init
functionality of creating new local Git repo to track changes, making initial commit, and installing project dependencies is maintained.Fixes #
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license