Skip to content

Commit e0f9a6f

Browse files
authored
feat(toolkit-lib): default to using a non interactive IoHost (#306)
Replaces the current default `IoHost` which is the same as the one used by the CLI with a strictly non-interactive version. This is more in accordance with the goals of a library providing actions. Fixes #157 Closes #289 BREAKING CHANGE: This change updates the default `IoHost` implementation used by `Toolkit` to a version that is strictly non-interactive, i.e. there is no expectation anymore that users will respond to command-line prompts. To restore previous behavior, you will can provide a custom `IoHost` implementation to your `Toolkit` instance. You may consider extending the new `NonInteractiveIoHost` class with desired interactive prompts. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
1 parent 73e5ad4 commit e0f9a6f

File tree

22 files changed

+486
-48
lines changed

22 files changed

+486
-48
lines changed

.projenrc.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,11 +681,14 @@ const tmpToolkitHelpers = configureProject(
681681
deps: [
682682
cloudAssemblySchema.name,
683683
cloudFormationDiff,
684+
cxApi,
685+
`@aws-sdk/client-cloudformation@${CLI_SDK_V3_RANGE}`,
684686
'archiver',
685687
'chalk@4',
686688
'glob',
687689
'semver',
688690
'uuid',
691+
'wrap-ansi@^7', // Last non-ESM version
689692
'yaml@^1',
690693
],
691694
tsconfig: {

packages/@aws-cdk/tmp-toolkit-helpers/.projen/deps.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/tmp-toolkit-helpers/.projen/tasks.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/tmp-toolkit-helpers/package.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/aws-cdk/lib/cli/activity-printer/base.ts renamed to packages/@aws-cdk/tmp-toolkit-helpers/src/private/activity-printer/base.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { CloudFormationStackArtifact } from '@aws-cdk/cx-api';
2-
import { type StackActivity, type StackProgress } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api';
3-
import { IO } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private';
2+
import type { IoMessage } from '../../api/io';
3+
import { type StackActivity, type StackProgress } from '../../api/io/payloads';
4+
import { IO } from '../../api/io/private';
45
import { maxResourceTypeLength, stackEventHasErrorMessage } from '../../util';
5-
import type { IoMessage } from '../io-host/cli-io-host';
66

77
export interface IActivityPrinter {
88
notify(msg: IoMessage<unknown>): void;

packages/aws-cdk/lib/cli/activity-printer/current.ts renamed to packages/@aws-cdk/tmp-toolkit-helpers/src/private/activity-printer/current.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as util from 'util';
2-
import type { StackActivity } from '@aws-cdk/tmp-toolkit-helpers';
32
import * as chalk from 'chalk';
43
import type { ActivityPrinterProps } from './base';
54
import { ActivityPrinterBase } from './base';
65
import { RewritableBlock } from './display';
6+
import type { StackActivity } from '../../api/io/payloads';
77
import { padLeft, padRight, stackEventHasErrorMessage } from '../../util';
88

99
/**

packages/aws-cdk/lib/cli/activity-printer/history.ts renamed to packages/@aws-cdk/tmp-toolkit-helpers/src/private/activity-printer/history.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as util from 'util';
2-
import type { StackActivity } from '@aws-cdk/tmp-toolkit-helpers';
32
import * as chalk from 'chalk';
43
import type { ActivityPrinterProps } from './base';
54
import { ActivityPrinterBase } from './base';
5+
import type { StackActivity } from '../../api/io/payloads';
66
import { padRight } from '../../util';
77

88
/**
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './activity-printer';

0 commit comments

Comments
 (0)