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

fix(commons): rename tests subfolder to samples to avoid being deleted by tools such as node-prune #882

Merged
merged 2 commits into from
May 25, 2022

Conversation

flochaz
Copy link
Contributor

@flochaz flochaz commented May 18, 2022

Description of your changes

Current project structure is having a folder called tests under commons/src package and was hosting samples context and events to use when calling a lambda function.

Customers using tools like node-prune where having issue (#881) because the tool was deleting the folder. A fix would have been to simply use the -exclude option of this tool but here we propose to simply rename the folder to samples.

How to verify this change

  1. prep the env
    npm ci --foreground-scripts
    npm run lerna-package
    cd examples/cdk
    npm ci
    npm install ../../packages/**/dist/aws-lambda-powertools-*
    npm run test
  2. use node-prune
    node-prune -exclude '*.d.ts' -excludes 'assets'
    
  3. test again, they should still pass
    npm run test

Related issues, RFCs

#881

PR status

Is this ready for review?: YES
Is it a breaking change?: NO

Checklist

  • My changes meet the tenets criteria
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding changes to the examples
  • My changes generate no new warnings
  • The code coverage hasn't decreased
  • I have added tests that prove my change is effective and works
  • New and existing unit tests pass locally and in Github Actions
  • Any dependent changes have been merged and published in downstream module
  • The PR title follows the conventional commit semantics

Breaking change checklist

  • I have documented the migration process
  • I have added, implemented necessary warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions github-actions bot added the bug Something isn't working label May 18, 2022
@flochaz flochaz marked this pull request as ready for review May 18, 2022 15:35
@dreamorosi
Copy link
Contributor

Is that any other way in which we can avoid including all these 50+ files in the deployment package?

Also note that there is another community PR #881 that attempts to fix this issue, we should at least address it before moving forward with this. And generally speaking, what do you think of that way of fixing it @flochaz?

@flochaz
Copy link
Contributor Author

flochaz commented May 19, 2022

I think we should do both : import Utility as suggested in #881 and change name because indeed tests is a confusing name. After the question regarding the need of this samples ... I am not sure ...

@flochaz flochaz mentioned this pull request May 23, 2022
13 tasks
Copy link
Contributor

@ijemmy ijemmy left a comment

Choose a reason for hiding this comment

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

Even without node-prune issue, I do agree that tests is misleading here and samples is a better name.

@dreamorosi dreamorosi added this to the production-ready-release milestone May 23, 2022
@saragerion saragerion linked an issue May 24, 2022 that may be closed by this pull request
@dreamorosi dreamorosi self-requested a review May 25, 2022 08:02
@dreamorosi dreamorosi merged commit 74ef816 into main May 25, 2022
@dreamorosi dreamorosi deleted the flochaz/FixCommonImport branch May 25, 2022 12:25
flochaz added a commit that referenced this pull request Jun 3, 2022
…d by tools such as node-prune (#882)

* rename commons sub folder from tests to samples

* update doc

Co-authored-by: Florian Chazal <chazalf@amazon.com>
dreamorosi pushed a commit that referenced this pull request Aug 2, 2022
…d by tools such as node-prune (#882)

* rename commons sub folder from tests to samples

* update doc

Co-authored-by: Florian Chazal <chazalf@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Importing Common Index in Logger Folder raises Module Error
3 participants