aws / aws/aws-cdk

aws-cdk: separate dependencies from devDependencies to work with pnpm

Open
#23,182 31 comments 0 reactions 1 assignee Claimed by @rix0rrr View on GitHub
@aws-cdk/aws-config feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

When using the CDK with pnpm it is prone to have package hoisting issues as all the packages are declared as `devDependencies` not `dependencies`. Looking at

https://unpkg.com/aws-cdk@2.53.0/package.json

I am seeing all dependencies have been moved to `devDependencies` however in the code itself it looks like there are normal `dependencies` (https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk/package.json#L94).

When these are only declared as dev pnpm is not hoisting the dependency (as it is not declared as one that is needed to use the package), which causes `aws-cdk` to load `yaml@2.0` instead of `yaml@1.0` if there is another package in the monorepo that has a hard dependency on `yaml@2.0`.

### Expected Behavior

Dependencies and devDependencies should be maintained in the released npm package indicating packages needed to use the cdk vs packages just needed when developing it.

### Current Behavior

All dependencies are merged into `devDependencies` when released

### Reproduction Steps

Create a pnpm workspace where the main `package.json` depends on `lint-staged` as well as `aws-cdk`. Attmepting to use the cdk will result in yaml errors when trying to use `yaml/types` for example.

### Possible Solution

Maintain dependencies when released.

### Additional Information/Context

Workaround for this is to add the following to your pnpm config in `paclage.json`
```json
"aws-cdk": {
"dependencies": {
"yaml": "1.10.2"
}
}
```

### CDK CLI Version

n/a

### Framework Version

_No response_

### Node.js Version

16

### OS

WSL/Ubuntu

### Language

Typescript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.