Skip to content

Turn CliIoHost singleton pattern into an IoHost class which is specific to a Toolkit Instance #32816

@mrgrain

Description

@mrgrain

CliIoHost exists today as a singleton pattern. However this creates an issue if someone wanted to do parrallel executions of the Cli i.e.

Promise.all([
    myToolkit.deploy(appA),
    myToolkit.deploy(appB)
]);

or if someone wanted to maintain multiple distinct copies of the tookit

const myAwesomeToolkitA = new Toolkit({
    ioHost: myCustomIoHost()
})

const myAwesomeToolkitB = new Toolkit({
    ioHost: myOtherCustomIoHost()
})

This is done if:

  • The singleton pattern is gone
  • Anywhere the the Cli was calling a log function i.e. info() is now changed to a IoHost.notify().
  • Log functions should return a formatted IoMessage, i.e. IoHost.notify(info('my message')) or some equivalent functionality

Singleton Implementation Pr:
#32708

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/coreRelated to core CDK functionalitycliIssues related to the CDK CLIeffort/mediumMedium work item – several days of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions