Skip to content

chore: fix packages transform for stability stripping#17388

Merged
mergify[bot] merged 2 commits intomasterfrom
epolon/stability-banner-strip-transform
Nov 7, 2021
Merged

chore: fix packages transform for stability stripping#17388
mergify[bot] merged 2 commits intomasterfrom
epolon/stability-banner-strip-transform

Conversation

@iliapolo
Copy link
Copy Markdown
Contributor

@iliapolo iliapolo commented Nov 7, 2021

In #17327, we stripped away the stability banner for Cfn resources from README's of alpha modules, since these modules don't actually contain L1 resources.

Problem is that this stripping causes a bunch of pkglint violations on the v2-main branch, for example:

@aws-cdk/aws-iot-alpha: In package package.json
--
972 | @aws-cdk/aws-iot-alpha: - [package-info/maturity] Missing stability banner for experimental in README.md file (fixable)
973 | @aws-cdk/aws-iot-alpha: Error: Some package.json files had errors
974 | @aws-cdk/aws-iot-alpha:     at main (/codebuild/output/src115445882/src/github.com/aws/aws-cdk/tools/@aws-cdk/pkglint/bin/pkglint.js:30:15)
975 | @aws-cdk/aws-iot-alpha:     at Object.<anonym

This PR fixes the transform and makes the necessary changes so that pkglint will be happy.
Note that this was not detected during merge of #17327 into master since on master, these packages are transformed into private packages, and hence are not validated.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link
Copy Markdown

gitpod-io bot commented Nov 7, 2021

@iliapolo iliapolo changed the title fix transform chore: fix packages transform for stability stripping Nov 7, 2021
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Nov 7, 2021
@iliapolo iliapolo requested a review from a team November 7, 2021 18:29
'>',
'> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib',
].join('\n');
].join('\n')}\n\n`;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to strip the newlines preceding the banner as well.

![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)

> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use.
>
> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib

> stable and safe to use.
>
> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib`;
> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib\n\n<!-- -->\n\n`;
Copy link
Copy Markdown
Contributor Author

@iliapolo iliapolo Nov 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strip newlines as well as notice separators added by

for (const notice of filteredNotices) {
if (notices.length !== 0) {
// This delimiter helps ensure proper parsing & rendering with various parsers
notices.push('<!-- -->', '');
}
const lowerTrainCase = notice.toLowerCase().replace(/\s/g, '-');
notices.push(readBannerFile(`features-${lowerTrainCase}.md`));
notices.push('');
}

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 4b4c4c0
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify mergify bot merged commit d231b9e into master Nov 7, 2021
@mergify mergify bot deleted the epolon/stability-banner-strip-transform branch November 7, 2021 19:22
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Nov 7, 2021

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).

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
In aws#17327, we stripped away the stability banner for `Cfn` resources from README's of alpha modules, since these modules don't actually contain L1 resources. 

Problem is that this stripping causes a bunch of `pkglint` violations on the `v2-main` branch, for example:

```console
@aws-cdk/aws-iot-alpha: In package package.json
--
972 | @aws-cdk/aws-iot-alpha: - [package-info/maturity] Missing stability banner for experimental in README.md file (fixable)
973 | @aws-cdk/aws-iot-alpha: Error: Some package.json files had errors
974 | @aws-cdk/aws-iot-alpha:     at main (/codebuild/output/src115445882/src/github.com/aws/aws-cdk/tools/@aws-cdk/pkglint/bin/pkglint.js:30:15)
975 | @aws-cdk/aws-iot-alpha:     at Object.<anonym
```

This PR fixes the transform and makes the necessary changes so that `pkglint` will be happy. 
Note that this was not detected during merge of aws#17327 into master since on master, these packages are transformed into private packages, and hence are not validated. 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution/core This is a PR that came from AWS.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants