Skip to content

Commit

Permalink
fix: add function comments for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanay Yogesh Shah committed Oct 24, 2024
1 parent 423d6a3 commit b9326c0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ void describe('Codegen E2E tests', () => {
await runCodegenCommand(projRoot);
await copyFunctionFile(projRoot, 'function', gen1FunctionName);
await copyGen1Schema(projRoot, projName);

// TODO: replace below line with correct package version
await updatePackageDependency(projRoot, '@aws-amplify/backend', '0.0.0-test-20241003180022');
await updatePackageDependency(projRoot, '@aws-amplify/backend');

await npmInstall(projRoot);
const gen2StackName = await runGen2SandboxCommand(projRoot);
await assertAuthResource(projRoot, gen1UserPoolId, gen1ClientIds, gen1IdentityPoolId, gen1Region);
Expand All @@ -78,8 +80,10 @@ void describe('Codegen E2E tests', () => {
await runCodegenCommand(projRoot);
await copyFunctionFile(projRoot, 'auth', gen1FunctionName);
await removeErrorThrowsFromAuthResourceFile(projRoot);

// TODO: replace below line with correct package version
await updatePackageDependency(projRoot, '@aws-amplify/backend', '0.0.0-test-20241003180022');
await updatePackageDependency(projRoot, '@aws-amplify/backend');

await npmInstall(projRoot);
await toggleSandboxSecrets(projRoot, 'set');
const gen2StackName = await runGen2SandboxCommand(projRoot);
Expand All @@ -94,8 +98,10 @@ void describe('Codegen E2E tests', () => {
projRoot,
);
await runCodegenCommand(projRoot);

// TODO: replace below line with correct package version
await updatePackageDependency(projRoot, '@aws-amplify/backend', '0.0.0-test-20241003180022');
await updatePackageDependency(projRoot, '@aws-amplify/backend');

await npmInstall(projRoot);
await runGen2SandboxCommand(projRoot);
await assertAuthResource(projRoot, gen1UserPoolId, gen1ClientIds, gen1IdentityPoolId, gen1Region);
Expand Down
20 changes: 20 additions & 0 deletions packages/amplify-migration-e2e/src/migrationReadmeParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,26 @@ function extractCommands(readmeContent: string) {
return commands;
}

/**
* Sample from the README file for STEP 1:
*
* ### STEP 1: UPDATE GEN-1 AUTH STACK
*
* It is a non-disruptive update since the template only replaces resource references with their resolved values. This is a required step to execute cloudformation stack refactor later.
*
* ```
* aws cloudformation update-stack \
* --stack-name my-auth-stack-name \
* --template-body file://path/to/template.json \
* --parameters '[{"ParameterKey":"authRoleArn","ParameterValue":"arn:aws:iam::123456789012:role/my-auth-role"},{"ParameterKey":"autoVerifiedAttributes","ParameterValue":"email"},{"ParameterKey":"allowUnauthenticatedIdentities","ParameterValue":"false"},{"ParameterKey":"smsVerificationMessage","ParameterValue":"Your verification code is {####}"}]' \
* --capabilities CAPABILITY_NAMED_IAM --tags '[]'
* ```
*
* ```
* aws cloudformation describe-stacks \
* --stack-name my-auth-stack-name
* ```
*/
export function getCommandsFromReadme(readmeContent: string) {
const step1Content = extractContent(readmeContent, '### STEP 1', '#### Rollback step');
const step2Content = extractContent(readmeContent, '### STEP 2', '#### Rollback step');
Expand Down

0 comments on commit b9326c0

Please sign in to comment.