Skip to content

Commit 4894ebe

Browse files
committed
fix: lint errors in deploy actions and preflight hook
1 parent 1d78ead commit 4894ebe

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aws/agentcore",
3-
"version": "0.3.0-preview.2.1",
3+
"version": "0.3.0-preview.3",
44
"description": "CLI for Amazon Bedrock AgentCore",
55
"license": "Apache-2.0",
66
"repository": {

src/cli/commands/deploy/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export async function handleDeploy(options: ValidatedDeployOptions): Promise<Dep
191191
if (Object.keys(deployedCredentials).length > 0) {
192192
const existingPreSynthState = await configIO.readDeployedState().catch(() => ({targets: {}} as DeployedState));
193193
const targetState = existingPreSynthState.targets?.[target.name] ?? { resources: {} };
194-
if (!targetState.resources) targetState.resources = {};
194+
targetState.resources ??= {};
195195
targetState.resources.credentials = deployedCredentials;
196196
if (identityKmsKeyArn) targetState.resources.identityKmsKeyArn = identityKmsKeyArn;
197197
await configIO.writeDeployedState({

src/cli/tui/hooks/useCdkPreflight.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ConfigIO, SecureCredentials } from '../../../lib';
2+
import type { DeployedState } from '../../../schema';
23
import { AwsCredentialsError, validateAwsCredentials } from '../../aws/account';
34
import { type CdkToolkitWrapper, type SwitchableIoHost, createSwitchableIoHost } from '../../cdk/toolkit-lib';
45
import { getErrorMessage, isExpiredTokenError, isNoCredentialsError } from '../../errors';
@@ -640,9 +641,9 @@ export function useCdkPreflight(options: PreflightOptions): PreflightResult {
640641
if (Object.keys(deployedCredentials).length > 0) {
641642
const configIO = new ConfigIO();
642643
const target = context.awsTargets[0];
643-
const existingState = await configIO.readDeployedState().catch(() => ({ targets: {} } as any));
644+
const existingState = await configIO.readDeployedState().catch(() => ({ targets: {} } as DeployedState));
644645
const targetState = existingState.targets?.[target!.name] ?? { resources: {} };
645-
if (!targetState.resources) targetState.resources = {};
646+
targetState.resources ??= {};
646647
targetState.resources.credentials = deployedCredentials;
647648
if (identityResult.kmsKeyArn) targetState.resources.identityKmsKeyArn = identityResult.kmsKeyArn;
648649
await configIO.writeDeployedState({
@@ -659,7 +660,7 @@ export function useCdkPreflight(options: PreflightOptions): PreflightResult {
659660
logger.startStep('Synthesize CloudFormation');
660661
try {
661662
const synthResult = await synthesizeCdk(context.cdkProject, {
662-
ioHost: switchableIoHost!.ioHost,
663+
ioHost: switchableIoHost.ioHost,
663664
previousWrapper: wrapperRef.current,
664665
});
665666
wrapperRef.current = synthResult.toolkitWrapper;
@@ -680,7 +681,7 @@ export function useCdkPreflight(options: PreflightOptions): PreflightResult {
680681
const bootstrapCheck = await checkBootstrapNeeded(context.awsTargets);
681682
if (bootstrapCheck.needsBootstrap && bootstrapCheck.target) {
682683
setBootstrapContext({
683-
toolkitWrapper: wrapperRef.current!,
684+
toolkitWrapper: wrapperRef.current,
684685
target: bootstrapCheck.target,
685686
});
686687
setPhase('bootstrap-confirm');

0 commit comments

Comments
 (0)