Skip to content

Commit 650f30a

Browse files
authored
docs: reflect aws-cdk-lib and CLI split in the contribution guide (#34633)
Remove references to `cdk --version` check since this doesn't work now after CLI split from aws-cdk. Closes #34610 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 9d39db7 commit 650f30a

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

CONTRIBUTING.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,7 @@ If you would like to test your code changes against a CDK App, create the App an
198198
$ mkdir cdkApp # in parent dir of aws-cdk
199199
$ cd cdkApp
200200
$ npx cdk init app --language typescript
201-
$ npx cdk --version # shows the latest CDK version e.g. 2.155.0 (build 34dcc5a)
202201
$ ../aws-cdk/link-all.sh # link the aws-cdk repo with your cdkApp
203-
$ npx cdk --version # verify linked cdk version 0.0.0
204202
# Define the resource that uses your aws-cdk changes in cdkApp lib folder
205203
$ npx cdk deploy # deploy successfully
206204
```
@@ -1391,18 +1389,27 @@ Adding a new flag looks as follows:
13911389
See [release.md](./docs/release.md) for details on how CDK versions are maintained and how
13921390
to trigger a new release
13931391

1394-
## Troubleshooting
1392+
## Common Issues
13951393

1396-
Most build issues can be solved by doing a full clean rebuild:
1394+
### Import errors
13971395

1398-
```shell
1399-
$ git clean -fqdx .
1400-
$ yarn install
1401-
$ yarn build
1396+
An error similar to the below can happen while trying to consume the changed library in the example (or production) CDK app:
1397+
1398+
```ts
1399+
node_modules/ts-node/src/index.ts:859
1400+
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
1401+
^
1402+
TSError: ⨯ Unable to compile TypeScript:
1403+
1404+
aws-cdk/packages/aws-cdk-lib/aws-events-targets/lib/aws-api.ts:7:27 - error TS2732: Cannot find module '../../custom-resources/lib/helpers-internal/sdk-v3-metadata.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.
1405+
1406+
7 import * as metadata from '../../custom-resources/lib/helpers-internal/sdk-v3-metadata.json';
14021407
```
14031408

1404-
However, this will be time consuming. In this section we'll describe some common issues you may encounter and some more
1405-
targeted commands you can run to resolve your issue.
1409+
This is most probably caused by the fact that your CDK app is using `--prefer-ts-exts` option (which is the [default in new CDK TS-based apps]([url](https://github.com/aws/aws-cdk/issues/7475))). To fix this, try one of the following:
1410+
- Don't compile aws-cdk-lib. You can do this by removing `--prefer-ts-exts` from your app command in `cdk.json` - this means you will have to run a build in the lib repo every time you make a change (or use `npm run watch / yarn watch`).
1411+
- Update your `tsconfig.json`. In this case it's going to be adding `"resolveJsonModule": true` as suggested by the error to the `"compilerOptions"` section. If you change the test app, different or more errors might come up that will have a similar resolution.
1412+
14061413

14071414
#### The compiler is throwing errors on files that I renamed/it's running old tests that I meant to remove/code coverage is low and I didn't change anything.
14081415

0 commit comments

Comments
 (0)