Skip to content

Commit

Permalink
api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgrain committed Jan 16, 2025
1 parent b65c51c commit c32914d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/toolkit/lib/actions/synth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export interface SynthOptions {
/**
* Select the stacks
*/
readonly stacks: StackSelector;
readonly stacks?: StackSelector;

/**
* After synthesis, validate stacks with the "validateOnSynth" attribute set (can also be controlled with CDK_VALIDATION)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from './context-aware-source';
export * from './exec';
export * from './prepare-source';
export * from './source-builder';
export * from './stack-selectors';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { StackSelectionStrategy, StackSelector } from '../stack-selector';

export const ALL_STACKS: StackSelector = {
strategy: StackSelectionStrategy.ALL_STACKS,
};
13 changes: 5 additions & 8 deletions packages/@aws-cdk/toolkit/lib/toolkit/toolkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { patternsArrayForWatch, WatchOptions } from '../actions/watch';
import { SdkOptions } from '../api/aws-auth';
import { DEFAULT_TOOLKIT_STACK_NAME, SdkProvider, SuccessfulDeployStackResult, StackCollection, Deployments, HotswapMode, StackActivityProgress, ResourceMigrator, obscureTemplate, serializeStructure, tagsForStack, CliIoHost, validateSnsTopicArn, Concurrency, WorkGraphBuilder, AssetBuildNode, AssetPublishNode, StackNode } from '../api/aws-cdk';
import { CachedCloudAssemblySource, IdentityCloudAssemblySource, StackAssembly, ICloudAssemblySource, StackSelectionStrategy } from '../api/cloud-assembly';
import { CloudAssemblySourceBuilder } from '../api/cloud-assembly/private/source-builder';
import { ALL_STACKS, CloudAssemblySourceBuilder } from '../api/cloud-assembly/private';
import { ToolkitError } from '../api/errors';
import { IIoHost, IoMessageCode, IoMessageLevel } from '../api/io';
import { asSdkLogger, withAction, Timer, confirm, data, error, highlight, info, success, warn, ActionAwareIoHost, debug } from '../api/io/private';
Expand All @@ -38,7 +38,7 @@ export interface ToolkitOptions {
/**
* The IoHost implementation, handling the inline interactions between the Toolkit and an integration.
*/
// ioHost: IIoHost;
ioHost?: IIoHost;

/**
* Configuration options for the SDK.
Expand Down Expand Up @@ -78,10 +78,7 @@ export class Toolkit extends CloudAssemblySourceBuilder implements AsyncDisposab
public constructor(private readonly props: ToolkitOptions = {}) {
super();

// @todo open ioHost up
this.ioHost = CliIoHost.getIoHost();
// this.ioHost = options.ioHost;

this.ioHost = props.ioHost ?? CliIoHost.getIoHost();
this.toolkitStackName = props.toolkitStackName ?? DEFAULT_TOOLKIT_STACK_NAME;
}

Expand Down Expand Up @@ -121,10 +118,10 @@ export class Toolkit extends CloudAssemblySourceBuilder implements AsyncDisposab
/**
* Synth Action
*/
public async synth(cx: ICloudAssemblySource, options: SynthOptions): Promise<ICloudAssemblySource> {
public async synth(cx: ICloudAssemblySource, options: SynthOptions = {}): Promise<ICloudAssemblySource> {
const ioHost = withAction(this.ioHost, 'synth');
const assembly = await this.assemblyFromSource(cx);
const stacks = assembly.selectStacksV2(options.stacks);
const stacks = assembly.selectStacksV2(options.stacks ?? ALL_STACKS);
const autoValidateStacks = options.validateStacks ? [assembly.selectStacksForValidation()] : [];
await this.validateStacksMetadata(stacks.concat(...autoValidateStacks), ioHost);

Expand Down

0 comments on commit c32914d

Please sign in to comment.