-
Notifications
You must be signed in to change notification settings - Fork 4.3k
chore: rewrite readmes correctly in aws-cdk-lib and monocdk #17573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
There is a lot going on in this PR and some of it likely does not belong in the same PR together. Especially because the origin of this PR is |
|
Couple of things @rix0rrr:
|
| '', | ||
| '```ts', | ||
| `import ${module.moduleName.toLocaleLowerCase()} = require('${module.packageName}');`, | ||
| `import * as ${module.moduleName.toLocaleLowerCase().replace(/-/g, '_')} from '${module.packageName}';`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not be the same old, same old "guess import name from module name" function that we have in a bunch of places? Might also be centralized here...
I guess this will do, but it's perhaps worth considering
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be overkill to add it here, since this is just a suggested name and can really be anything at this point. No need to add the module function from generated-examples, which is what I think you're referring to. Instead, I have added a more robust regex to ensure that the module name is always valid.
|
@Mergifyio backport master |
🟠 Waiting for conditions to match
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
- Adds `rewriteImports` and helper functions `rewriteReadmeImports` and `rewriteMonoPackageImports` to `aws-cdk-migration` package. - `individual-package-gen` consumes `rewriteReadmeImports` for alpha modules. - `individual-package-gen` treats rosetta fixtures as source files and rewrites imports there as well. - Adds `aws-cdk-migration` as a dependency to `ubergen`. - Refactors `rewriteImports` in `ubergen` to use the API in `aws-cdk-migration`. Has the side affect of removing the string-replace function that was introduced in this [PR](#14255). This changes the readme import style from `import { blah as blah } from 'aws-cdk-lib';` to `import * as blah from 'aws-cdk-lib/blah';`. - fixes error in `cfnspec` that generated invalid import names for L1 module readmes. - fixes bug in `cdk-build` that only executed one `post` command. - fixes `verify-imports` scripts typo introduced previously (that was not caught due to the `cdk-build` bug). ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* (cherry picked from commit 66e37cc) # Conflicts: # packages/@aws-cdk/cfnspec/lib/library-creation.ts
✅ Backports have been created
|
…17573) (#17635) This is an automatic backport of pull request #17573 done by [Mergify](https://mergify.com). Cherry-pick of 66e37cc has failed: ``` On branch mergify/bp/master/pr-17573 Your branch is up to date with 'origin/master'. You are currently cherry-picking commit 66e37cc. (fix conflicts and run "git cherry-pick --continue") (use "git cherry-pick --skip" to skip this patch) (use "git cherry-pick --abort" to cancel the cherry-pick operation) Changes to be committed: modified: packages/@aws-cdk/cfnspec/test/libary-creation.test.ts modified: packages/aws-cdk-lib/.gitignore modified: packages/aws-cdk-lib/package.json modified: packages/aws-cdk-lib/scripts/verify-imports-resolve-same.ts deleted: packages/aws-cdk-lib/scripts/verify-readme-import-rewrites.ts modified: packages/aws-cdk-migration/bin/rewrite-imports-v2.ts modified: packages/aws-cdk-migration/lib/rewrite.ts modified: packages/aws-cdk-migration/test/rewrite.test.ts modified: packages/monocdk/.gitignore modified: tools/@aws-cdk/cdk-build-tools/bin/cdk-build.ts modified: tools/@aws-cdk/individual-pkg-gen/transform-packages.ts modified: tools/@aws-cdk/ubergen/bin/ubergen.ts modified: tools/@aws-cdk/ubergen/package.json Unmerged paths: (use "git add <file>..." to mark resolution) both modified: packages/@aws-cdk/cfnspec/lib/library-creation.ts ``` To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally --- <details> <summary>Mergify commands and options</summary> <br /> More conditions and actions can be found in the [documentation](https://docs.mergify.com/). You can also trigger Mergify actions by commenting on this pull request: - `@Mergifyio refresh` will re-evaluate the rules - `@Mergifyio rebase` will rebase this PR on its base branch - `@Mergifyio update` will merge the base branch into this PR - `@Mergifyio backport <destination>` will backport this PR on `<destination>` branch Additionally, on Mergify [dashboard](https://dashboard.mergify.com/) you can: - look at your merge queues - generate the Mergify configuration with the config editor. Finally, you can contact us on https://mergify.com </details>
…ws#17573) (aws#17635) This is an automatic backport of pull request aws#17573 done by [Mergify](https://mergify.com). Cherry-pick of 66e37cc has failed: ``` On branch mergify/bp/master/pr-17573 Your branch is up to date with 'origin/master'. You are currently cherry-picking commit 66e37cc. (fix conflicts and run "git cherry-pick --continue") (use "git cherry-pick --skip" to skip this patch) (use "git cherry-pick --abort" to cancel the cherry-pick operation) Changes to be committed: modified: packages/@aws-cdk/cfnspec/test/libary-creation.test.ts modified: packages/aws-cdk-lib/.gitignore modified: packages/aws-cdk-lib/package.json modified: packages/aws-cdk-lib/scripts/verify-imports-resolve-same.ts deleted: packages/aws-cdk-lib/scripts/verify-readme-import-rewrites.ts modified: packages/aws-cdk-migration/bin/rewrite-imports-v2.ts modified: packages/aws-cdk-migration/lib/rewrite.ts modified: packages/aws-cdk-migration/test/rewrite.test.ts modified: packages/monocdk/.gitignore modified: tools/@aws-cdk/cdk-build-tools/bin/cdk-build.ts modified: tools/@aws-cdk/individual-pkg-gen/transform-packages.ts modified: tools/@aws-cdk/ubergen/bin/ubergen.ts modified: tools/@aws-cdk/ubergen/package.json Unmerged paths: (use "git add <file>..." to mark resolution) both modified: packages/@aws-cdk/cfnspec/lib/library-creation.ts ``` To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally --- <details> <summary>Mergify commands and options</summary> <br /> More conditions and actions can be found in the [documentation](https://docs.mergify.com/). You can also trigger Mergify actions by commenting on this pull request: - `@Mergifyio refresh` will re-evaluate the rules - `@Mergifyio rebase` will rebase this PR on its base branch - `@Mergifyio update` will merge the base branch into this PR - `@Mergifyio backport <destination>` will backport this PR on `<destination>` branch Additionally, on Mergify [dashboard](https://dashboard.mergify.com/) you can: - look at your merge queues - generate the Mergify configuration with the config editor. Finally, you can contact us on https://mergify.com </details>
rewriteImportsand helper functionsrewriteReadmeImportsandrewriteMonoPackageImportstoaws-cdk-migrationpackage.individual-package-genconsumesrewriteReadmeImportsfor alpha modules.individual-package-gentreats rosetta fixtures as source files and rewrites imports there as well.aws-cdk-migrationas a dependency toubergen.rewriteImportsinubergento use the API inaws-cdk-migration. Has the side affect of removing the string-replace function that was introduced in this PR. This changes the readme import style fromimport { blah as blah } from 'aws-cdk-lib';toimport * as blah from 'aws-cdk-lib/blah';.cfnspecthat generated invalid import names for L1 module readmes.cdk-buildthat only executed onepostcommand.verify-importsscripts typo introduced previously (that was not caught due to thecdk-buildbug).By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license