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

Better cache handling of multiple (but different) prettier calls #13010

Closed
HolgerJeromin opened this issue Jun 14, 2022 · 1 comment · Fixed by #13019
Closed

Better cache handling of multiple (but different) prettier calls #13010

HolgerJeromin opened this issue Jun 14, 2022 · 1 comment · Fixed by #13019
Labels
area:cli Issues with Prettier's Command Line Interface type:enhancement A potential new feature to be added, or an improvement to how we print something
Milestone

Comments

@HolgerJeromin
Copy link
Contributor

Environments:

  • Prettier Version: 2.7.0
  • Running Prettier via: CLI
  • Operating System: Windows

After discussion #12800 (comment) you moved from default cache location .prettiercache (eslint style) to node_modules/.cache/prettier (ava style).

In #12800 (comment) you needed a use case for a --cache-location CLI param.

I have a script which formats and compiles many Visual Studio projects which shares one node_modules dir.
Compiling one project boosts the prettier call from 15s to 2s. 🎉

But every project has different files (surprise :-) so every prettier call finds new files and rebuilds (!) node_modules/.cache/prettier from scratch (which renders the cache useless in many situations).

It would be better if prettier would

  • expand the cached cache file with new found files (but when do we cleanup?) or
  • default to .prettiercache to be able to have a cache file per vs project or
  • readd --cache-location CLI param so I can configure the cache in my build script

cc @sosukesuzuki @fisker @7rulnik

@sosukesuzuki sosukesuzuki added type:enhancement A potential new feature to be added, or an improvement to how we print something area:cli Issues with Prettier's Command Line Interface labels Jun 15, 2022
@alexander-akait
Copy link
Member

I think --cache-location is good

@kachkaev kachkaev added this to the 2.8 milestone Nov 16, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:cli Issues with Prettier's Command Line Interface type:enhancement A potential new feature to be added, or an improvement to how we print something
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants