From 27c06c3b3e8b93ddd11dabc53026429c08406d27 Mon Sep 17 00:00:00 2001 From: Abhishek Raj Date: Mon, 23 Sep 2024 12:37:10 -0700 Subject: [PATCH] fix(migrate): add README --- packages/amplify-migration/README.md | 11 +++++++ .../generate_templates_command.ts | 31 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 packages/amplify-migration/README.md create mode 100644 packages/amplify-migration/src/commands/gen2/generate-templates/generate_templates_command.ts diff --git a/packages/amplify-migration/README.md b/packages/amplify-migration/README.md new file mode 100644 index 00000000000..b4bb0532fda --- /dev/null +++ b/packages/amplify-migration/README.md @@ -0,0 +1,11 @@ +## Usage + +### Codegen + +In Gen1 root directory run the following to generate Gen2 code based on Gen1 configuration: + +`npx @aws-amplify/migrate to-gen-2 generate-code` + +Once this command runs successfully, the Gen1 project is converted to Gen2 with `amplify` directory containing Gen2 code and `.amplify/migration/amplify` containing Gen1 configuration. + + diff --git a/packages/amplify-migration/src/commands/gen2/generate-templates/generate_templates_command.ts b/packages/amplify-migration/src/commands/gen2/generate-templates/generate_templates_command.ts new file mode 100644 index 00000000000..ca8363611f7 --- /dev/null +++ b/packages/amplify-migration/src/commands/gen2/generate-templates/generate_templates_command.ts @@ -0,0 +1,31 @@ +import { Argv, CommandModule } from 'yargs'; +// import { execute, generateTemplates } from '../../../'; + +export type Gen2GenerateTemplatesCommandOptions = Record; + +/** + * Command that generates CloudFormation templates needed for stack refactor operation to move resources from Gen1 to Gen2. + */ +export class Gen2GenerateTemplatesCommand implements CommandModule { + /** + * @inheritDoc + */ + readonly command: string; + + /** + * @inheritDoc + */ + readonly describe: string; + + constructor() { + this.command = 'generate-templates'; + this.describe = 'Generates stack refactor inputs (CFN templates) to move Gen1 resources to Gen2 applications.'; + } + + builder = (yargs: Argv): Argv => { + return yargs.version(false); + }; + handler = async (): Promise => { + // await generateTemplates(); + }; +}