Skip to content
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

chore(pkglint): dont publish cdk.out directories #8803

Merged
merged 7 commits into from
Jun 30, 2020

Conversation

iliapolo
Copy link
Contributor

Adds a pkglint validation so that we always include **/cdk.out in our .npmignore files. This will prevent us from accidentally publishing cdk artifacts that were generated during build/test.


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

@iliapolo iliapolo requested a review from a team June 30, 2020 08:13
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jun 30, 2020
@iliapolo iliapolo changed the title chore: dont publish cdk.out directories chore(pkglint): dont publish cdk.out directories Jun 30, 2020
Comment on lines +66 to +75
if (!npmIgnore.includes('**/cdk.out')) {
pkg.report({
ruleName: this.name,
message: `${npmIgnorePath}: Must exclude **/cdk.out`,
fix: () => fs.writeFileSync(
npmIgnorePath,
`${npmIgnore}\n# exclude cdk artifacts\n**/cdk.out`
)
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to prefix with **/, and only ignore if it is a directory:

Suggested change
if (!npmIgnore.includes('**/cdk.out')) {
pkg.report({
ruleName: this.name,
message: `${npmIgnorePath}: Must exclude **/cdk.out`,
fix: () => fs.writeFileSync(
npmIgnorePath,
`${npmIgnore}\n# exclude cdk artifacts\n**/cdk.out`
)
});
}
if (!npmIgnore.includes('cdk.out/')) {
pkg.report({
ruleName: this.name,
message: `${npmIgnorePath}: Must exclude cdk.out/`,
fix: () => fs.writeFileSync(
npmIgnorePath,
`${npmIgnore}\n# exclude cdk artifacts\ncdk.out/`
)
});
}

Copy link
Contributor Author

@iliapolo iliapolo Jun 30, 2020

Choose a reason for hiding this comment

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

@RomainMuller Are you sure about the **/?

This is npm pack output without it:

npm pack                                                                                                  
npm notice 
npm notice 📦  @aws-cdk/aws-batch@0.0.0
npm notice === Tarball Contents === 
npm notice 193.3kB .jsii                               
npm notice 0       test/cdk.out/file                   
npm notice 0       test/nested/cdk.out/hello           
npm notice 11.4kB  LICENSE                             
npm notice 113B    NOTICE                              
....
....
aws-cdk-aws-batch-0.0.0.tgz

And this is with it:

npm pack                                                                                                  
npm notice 
npm notice 📦  @aws-cdk/aws-batch@0.0.0
npm notice === Tarball Contents === 
npm notice 193.3kB .jsii                               
npm notice 11.4kB  LICENSE                             
npm notice 113B    NOTICE                              
....
....
aws-cdk-aws-batch-0.0.0.tgz

Notice the first two lines. Am I missing something?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh fuck this is npmIgnore, not gitignore! Sorry this is PEBCAK.

@iliapolo iliapolo changed the base branch from release to master June 30, 2020 09:04
@mergify
Copy link
Contributor

mergify bot commented Jun 30, 2020

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

@mergify mergify bot merged commit c337d4a into master Jun 30, 2020
@mergify mergify bot deleted the epolon/dont-publish-tests-cdkout branch June 30, 2020 09:23
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 79db645
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

iliapolo added a commit that referenced this pull request Jun 30, 2020
Adds a pkglint validation so that we always include `**/cdk.out` in our `.npmignore` files. This will prevent us from accidentally publishing cdk artifacts that were generated during build/test.
 
----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
shivlaks added a commit that referenced this pull request Oct 14, 2020
…g missing libraries

this change was introduced in #8803 but the script to create missing construct
libraries was not updated.

As a follow-up, will look into creating a test that exercises creation of a new
construct library and the subsequent validation against pkglint.
mergify bot pushed a commit that referenced this pull request Oct 14, 2020
…g missing libraries (#10876)

this change was introduced in #8803 but the script to create missing construct
libraries was not updated.

As a follow-up, will look into creating a test that exercises creation of a new
construct library and the subsequent validation against pkglint.

----

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

4 participants