Skip to content

Commit 46d28cb

Browse files
authored
docs(toolkit-lib): fix some examples (#127)
Fixes some incorrect examples and makes formatting consistent for others. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
1 parent 0dcb15a commit 46d28cb

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

packages/@aws-cdk/toolkit-lib/README.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ import * as core from 'aws-cdk-lib/core';
6262
declare const cdk: Toolkit;
6363

6464
const cx = cdk.fromAssemblyBuilder(async () => {
65-
const app = new core.App();
65+
const app = new core.App();
6666

67-
// Define your stacks here
68-
new MyStack(app, 'MyStack');
67+
// Define your stacks here
68+
new MyStack(app, 'MyStack');
6969

70-
return app.synth();
70+
return app.synth();
7171
});
7272
```
7373

@@ -82,11 +82,11 @@ The following is a basic example that creates a deployment of the `MyStack` stac
8282
declare const cdk: Toolkit;
8383
declare const cx: ICloudAssemblySource;
8484

85-
await toolkit.deploy(cloudAssembly, {
86-
stacks: {
87-
strategy: StackSelectionStrategy.PATTERN_MUST_MATCH,
88-
patterns: ["MyStack"],
89-
},
85+
await cdk.deploy(cx, {
86+
stacks: {
87+
strategy: StackSelectionStrategy.PATTERN_MUST_MATCH,
88+
patterns: ["MyStack"],
89+
},
9090
});
9191
```
9292

@@ -231,9 +231,9 @@ The following is an example implementation that simply logs all message objects
231231

232232
```ts
233233
const toolkit = new toolkitLib.Toolkit({
234-
ioHost: {
234+
ioHost: {
235235
notify: async function (msg) {
236-
console.log(msg);
236+
console.log(msg);
237237
},
238238
requestResponse: async function (msg) {
239239
console.log(msg);
@@ -322,12 +322,12 @@ Alternatively a inline `AssemblyBuilder` function can be used to build a CDK app
322322
declare const cdk: Toolkit;
323323

324324
const cx = cdk.fromAssemblyBuilder(async () => {
325-
const app = new core.App();
325+
const app = new core.App();
326326

327-
// Define your stacks here
328-
new MyStack(app, 'MyStack');
327+
// Define your stacks here
328+
new MyStack(app, 'MyStack');
329329

330-
return app.synth();
330+
return app.synth();
331331
});
332332
```
333333

@@ -403,7 +403,7 @@ declare const cx: ICloudAssemblySource;
403403
try {
404404
// Attempt a CDK Toolkit operation
405405
const deployment = await cdk.deploy(cloudAssembly, {
406-
stacks: ['MyStack']
406+
stacks: ['MyStack']
407407
});
408408

409409
} catch (error) {
@@ -425,8 +425,8 @@ try {
425425
console.error('Generic Toolkit error:', error.message);
426426

427427
} else {
428-
// Handle unexpected errors
429-
console.error('Unexpected error:', error);
428+
// Handle unexpected errors
429+
console.error('Unexpected error:', error);
430430
}
431431
}
432432
```

0 commit comments

Comments
 (0)