Skip to content
This repository has been archived by the owner on Jan 5, 2022. It is now read-only.

feat: Link new and migrate command with the init functionality #66

Merged
merged 4 commits into from
Feb 17, 2021

Conversation

jamie-lynch
Copy link
Contributor

What does this change?

This PR links the functionality of the new and migrate commands with the init command to allow both steps to be done in one command. The first step of this work was refactoring the bulk of the initialisation logic into a new class in the utils/init.ts file. An --init flag was then added to both the new and migrate command. If this flag is passed in then the cdk project directory is created before the rest of the command is executed.

How to test

Try running the new and migrate commands both with and without the --init flag appended to see the project directory being created.

How can we measure success?

Users don't have to run the init command followed by either the new or migrate commands when starting a new cdk project.

Have we considered potential risks?

There is some risk when running commands that interact with the filesystem but validation has been added to check if files and directories already exist before taking any action.

@jamie-lynch jamie-lynch requested a review from a team January 29, 2021 16:27
@jamie-lynch jamie-lynch force-pushed the jl/link-commands branch 4 times, most recently from 0349613 to 08a467b Compare February 1, 2021 16:15
@jamie-lynch jamie-lynch changed the title Link new and migrate command with the init functionality feat: Link new and migrate command with the init functionality Feb 3, 2021
Copy link
Contributor

@jacobwinch jacobwinch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great - thanks for adding this functionality (and sorry for the delay getting this reviewed) 👍

I've tested this out locally and it all seems to work well.

@@ -112,7 +113,8 @@ ARGUMENTS
OPTIONS
-h, --help show CLI help
-v, --version show CLI version
--multi-app
--init create the cdk directory before building the app and stack files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should be the default behaviour for the new command? Perhaps we could consider that in a future PR though.

@jamie-lynch jamie-lynch merged commit d6b7c7a into main Feb 17, 2021
@jamie-lynch jamie-lynch deleted the jl/link-commands branch February 17, 2021 11:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants