Skip to content
This repository was archived by the owner on Jun 15, 2021. It is now read-only.

feat: verbose file count #23

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

d4rekanguok
Copy link

@d4rekanguok d4rekanguok commented Oct 16, 2019

Hey @axe312ger, this PR address #22. What do you think?

  • Add a verbose options that when enabled, will log out total amount of files instead
  • Use Gatsby's reporter instead of console.log
plugins: [
  {
    resolve: "gatsby-plugin-netlify-cache",
    options: {
      verbose: true
    }
  }
]

info plugin-netlify-cache: Restoring 90 cached files for .cache directory with 0 already existing files.

} cached files for ${humanName} directory with ${
dirFiles.length
dirFileCount
Copy link
Author

@d4rekanguok d4rekanguok Oct 16, 2019

Choose a reason for hiding this comment

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

Actually after testing this code, since each netlify build is completely fresh, I'm not sure we need to log out already existing files, it'll always be 0?

Instead it could be more informative to store the file count of each cache directory & compare it on post build, i.e cached extra 12 files & removed 1 file

Copy link
Owner

Choose a reason for hiding this comment

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

If you additionally cache files within node_modules/.cache, it might happen that netlify already restored files for you.

Still, that post build information would be pretty useful. Happy to merge code that implements it :)

Copy link
Author

Choose a reason for hiding this comment

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

Ah true, I didn't think of the caches in node_modules. Will work on that post build info when I can! :)

@axe312ger
Copy link
Owner

Rebased it on master in feat/verbose and released it as canary release.

Check npm i gatsby-plugin-netlify-cache@canary and let me know :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants