Skip to content

Commit

Permalink
pr feedback and build works
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizencc committed Feb 24, 2025
1 parent aac453a commit 6684f5a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/toolkit-lib/CODE_REGISTRY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| CDK_TOOLKIT_I2901 | Provides details on the selected stacks and their dependencies | result | n/a |
| CDK_TOOLKIT_E3900 | Resource import failed | error | n/a |
| CDK_TOOLKIT_I5000 | Provides deployment times | info | n/a |
| CDK_TOOLKIT_I5001 | Provides total time in deploy action, including synth and rollback | info | n/a |
| CDK_TOOLKIT_I5001 | Provides total time in deploy action, including synth and rollback | info | [Duration](docs/interfaces/Duration.html) |
| CDK_TOOLKIT_I5002 | Provides time for resource migration | info | n/a |
| CDK_TOOLKIT_I5031 | Informs about any log groups that are traced as part of the deployment | info | n/a |
| CDK_TOOLKIT_I5050 | Confirm rollback during deployment | info | n/a |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as cxapi from '@aws-cdk/cx-api';
import * as fs from 'fs-extra';
import type { ICloudAssemblySource } from '../';
import type { AssemblySourceProps, ICloudAssemblySource } from '../';
import { ContextAwareCloudAssembly, ContextAwareCloudAssemblyProps } from './context-aware-source';
import { execInChildProcess } from './exec';
import { assemblyFromDirectory, changeDir, determineOutputDirectory, guessExecutable, prepareDefaultEnvironment, withContext, withEnv } from './prepare-source';
import { ToolkitServices } from '../../../toolkit/private';
import { Context, ILock, RWLock, Settings } from '../../aws-cdk';
import { ToolkitError } from '../../errors';
import { CODES, debug, error, info } from '../../io/private';
import { AssemblyBuilder, CdkAppSourceProps } from '../source-builder';
import { AssemblyBuilder } from '../source-builder';

export abstract class CloudAssemblySourceBuilder {
/**
Expand Down
12 changes: 8 additions & 4 deletions packages/@aws-cdk/toolkit-lib/lib/api/io/private/messages.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as chalk from 'chalk';
import type { IoMessageCodeCategory, IoMessageLevel } from '../io-message';
import { CodeInfo, CODES } from './codes';
import type { IoMessageCode, IoMessageLevel } from '../io-message';
import { CodeInfo } from './codes';
import type { ActionLessMessage, ActionLessRequest, IoMessageCodeCategory, Optional, SimplifiedMessage } from './types';

/**
Expand All @@ -26,8 +26,12 @@ export function defaultMessageCode(level: IoMessageLevel, category: IoMessageCod
const levelIndicator = level === 'error' ? 'E' :
level === 'warn' ? 'W' :
'I';
const code = `CDK_${category}_${levelIndicator}0000` as keyof typeof CODES;
return CODES[code];
const code = `CDK_${category}_${levelIndicator}0000` as IoMessageCode;
return {
code,
description: `Generic ${level} message for CDK_${category}`,
level,
};
}

/**
Expand Down
7 changes: 4 additions & 3 deletions packages/@aws-cdk/toolkit-lib/lib/toolkit/types.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { SuccessfulDeployStackResult as _SuccessfulDeployStackResult } from "../api/aws-cdk";
import { SuccessfulDeployStackResult as _SuccessfulDeployStackResult } from '../api/aws-cdk';

export interface AssemblyData {
assemblyDirectory: string;
stacksCount: number;
stackIds: string[];
}

export interface SuccessfulDeployStackResult extends _SuccessfulDeployStackResult {}
export interface SuccessfulDeployStackResult extends _SuccessfulDeployStackResult {
}

export interface StackData extends AssemblyData {
stack: {
Expand All @@ -19,5 +20,5 @@ export interface StackData extends AssemblyData {
}

export interface Duration {
duration: number,
duration: number;
}
5 changes: 4 additions & 1 deletion packages/@aws-cdk/toolkit-lib/scripts/gen-code-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ function codesToMarkdownTable(codes: Record<string, CodeInfo>, mdPrefix?: string
let table = '| Code | Description | Level | Data Interface |\n';
table += '|------|-------------|-------|----------------|\n';

Object.values(codes).forEach((code) => {
Object.entries(codes).forEach(([key, code]) => {
if (key !== code.code) {
throw new Error(`Code key ${key} does not match code.code ${code.code}. This is probably a typo.`);
}
table += `| ${code.code} | ${code.description} | ${code.level} | ${code.interface ? linkInterface(code.interface) : 'n/a'} |\n`;
});

Expand Down

0 comments on commit 6684f5a

Please sign in to comment.