Skip to content

chore: npm-check-updates && yarn upgrade#33299

Closed
aws-cdk-automation wants to merge 1 commit intomainfrom
automation/yarn-upgrade
Closed

chore: npm-check-updates && yarn upgrade#33299
aws-cdk-automation wants to merge 1 commit intomainfrom
automation/yarn-upgrade

Conversation

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

Ran npm-check-updates and yarn upgrade to keep the yarn.lock file up-to-date.

@aws-cdk-automation aws-cdk-automation requested a review from a team as a code owner February 5, 2025 13:54
@aws-cdk-automation aws-cdk-automation added auto-approve contribution/core This is a PR that came from AWS. dependencies This issue is a problem in a dependency or a pull request that updates a dependency file. labels Feb 5, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team February 5, 2025 13:54
@aws-cdk-automation aws-cdk-automation requested a review from a team February 5, 2025 13:54
@github-actions github-actions bot added the p2 label Feb 5, 2025
@QuantumNeuralCoder QuantumNeuralCoder self-assigned this Feb 6, 2025
mergify bot pushed a commit that referenced this pull request Feb 15, 2025
### Issue # (if applicable)

N/A

The problem was `yarn upgrade` no longer worked. You can see the auto upgrade PR - #33299 - is having a failed build.

After diving deep into the reason of failure, here are the findings:

I first checked out the branch for #33299, then run the build locally. Here is the error in the build log:
```
> tsc --build

aws-cdk/node_modules/@types/glob/index.d.ts:29:42 - error TS2694: Namespace '"<path skipped>/aws-cdk/node_modules/minimatch/dist/commonjs/index"' has no exported member 'IOptions'.

29     interface IOptions extends minimatch.IOptions {
                                            ~~~~~~~~

aws-cdk/node_modules/@types/glob/index.d.ts:74:30 - error TS2724: '"<path skipped>/aws-cdk/node_modules/minimatch/dist/commonjs/index"' has no exported member named 'IMinimatch'. Did you mean 'Minimatch'?

74         minimatch: minimatch.IMinimatch;
                                ~~~~~~~~~~

```

Pay attention to the file paths above. `aws-cdk/node_modules/@types/glob` is trying to reference a type from `aws-cdk/node_modules/minimatch` because yarn upgraded to a `minimatch` version that natively export minimatch types. But `@types/glob` is not compatible with these new `minimatch` types, causing the error seen above.

Ideally, `@types/glob` should specify the `@types/minimatch` version it works with, but in reality, it has `"@types/minimatch": "*"`, which started pointing to the upgraded `aws-cdk/node_modules/minimatch` as yarn hoist dependencies into the top level `node_modules`.

Some references:
- igorshubovych/markdownlint-cli#508 <-- `aws-cdk/tools/@aws-cdk/cdk-build-tools` uses `markdownlint-cli`, which depend on `glob` and `minimatch` as well.
- isaacs/rimraf#264 <-- New versions of `glob` and `minimatch` are written in Typescript, which is causing problem when these new version co-exist with the `@types/xxx` packages.



### Description of changes

Use `nohoist` for `@types/glob` and `@types/minimatch` so that the different places that use these two packages do not conflict with each other at the top level `node_modules`.

After doing the above, I noticed `cdk-build-tools` was actually relying on `@types/glob` but it does not declare the dependency in its `package.json`. It worked because it pulled the `@types/glob` at the top level `node_modules` (which is no longer available with `nohoist`).

### Describe any new or updated permissions being added

None


### Description of how you validated changes

Locally built and no error.

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Ran npm-check-updates and yarn upgrade to keep the `yarn.lock` file up-to-date.
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator Author

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 85614d5
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@GavinZZ GavinZZ closed this Feb 18, 2025
@github-actions
Copy link
Copy Markdown
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2025
@GavinZZ GavinZZ deleted the automation/yarn-upgrade branch February 20, 2025 23:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

auto-approve contribution/core This is a PR that came from AWS. dependencies This issue is a problem in a dependency or a pull request that updates a dependency file. p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants