Skip to content

Commit 771bba1

Browse files
9paceclaude
andcommitted
fix(cli): use existing printer singleton in validateTemplateDrift
Remove unnecessary Printer adapter that wrapped this.logger and the redundant `import type { Printer }`. The file already imports the `printer` singleton from @aws-amplify/amplify-prompts, which is the correct type expected by detectTemplateDrift() and CloudFormationService. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fddacc7 commit 771bba1

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

packages/amplify-cli/src/commands/gen2-migration/_validations.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import execa from 'execa';
1414
import { Logger } from '../gen2-migration';
1515
import chalk from 'chalk';
1616
import { printer } from '@aws-amplify/amplify-prompts';
17-
import type { Printer } from '@aws-amplify/amplify-prompts';
1817
import { extractCategory } from './categories';
1918
import { detectTemplateDrift } from '../drift-detection/detect-template-drift';
2019
import { CloudFormationService } from '../drift-detection/services';
@@ -198,18 +197,7 @@ export class AmplifyGen2MigrationValidations {
198197
public async validateTemplateDrift(): Promise<void> {
199198
this.logger.info('Checking for template drift...');
200199

201-
const print: Printer = {
202-
info: (msg: string) => this.logger.info(msg),
203-
debug: (msg: string) => this.logger.debug(msg),
204-
warn: (msg: string) => this.logger.warn(msg),
205-
blankLine: () => {
206-
return;
207-
},
208-
success: (msg: string) => this.logger.info(msg),
209-
error: (msg: string) => this.logger.warn(msg),
210-
};
211-
212-
const cfnService = new CloudFormationService(print);
200+
const cfnService = new CloudFormationService(printer);
213201
const syncSuccess = await cfnService.syncCloudBackendFromS3(this.context);
214202
if (!syncSuccess) {
215203
throw new AmplifyError('MigrationError', {
@@ -219,7 +207,7 @@ export class AmplifyGen2MigrationValidations {
219207
}
220208

221209
const cfn = await cfnService.getClient(this.context);
222-
const results = await detectTemplateDrift(this.rootStackName, print, cfn);
210+
const results = await detectTemplateDrift(this.rootStackName, printer, cfn);
223211

224212
if (results.skipped) {
225213
throw new AmplifyError('MigrationError', {

0 commit comments

Comments
 (0)