Repository navigation
feat: store incremental file in node_modules and use a binary format - #1473
Merged
Merged
Conversation
When the root directory has a node_modules folder, the incremental file is now stored at node_modules/.cache/dprint/incremental-v1. Otherwise it's stored in the cache directory like before. The file is now binary (the plugins hash followed by the sorted file hashes, each a little endian u64) instead of JSON, and its format version is in the file name. The legacy JSON file in the cache directory is removed.
… incremental file The incremental file is now stored in the nearest node_modules folder, which is the one in the root directory or, within a git repository, the closest one in an ancestor directory (ex. the root of a monorepo). It's named with a hash of the root directory's path relative to that folder so the config files of a workspace each get their own file and the name is the same across systems.
Running `dprint clear-cache` deletes it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The incremental file is now stored in the
.cache/dprintfolder of the nearestnode_modulesfolder, so it lives with the project (like other JS tools' caches) and is cleaned up along with it:node_modulesis the one in the config file's directory or, within a git repository, the closest one in an ancestor directory (ex. the root of a monorepo that hoists its dependencies). Ancestors aren't searched outside a git repository so a straynode_modules(ex. in the home directory) is never used.incremental-<hash>-v1, where the hash is of the config file's directory relative to the folder containingnode_modules(with forward slashes). So each config file in a workspace gets its own file, and the name is the same when the folder is moved or shared between systems (ex. Windows and WSL).node_modulesor the folder can't be created, it's stored in the cache directory like before, as<root path hash>-v1.The incremental file is also now a binary file instead of JSON:
u64. This is smaller and faster to read than JSON and avoids precision issues with hashes above 2^53 if a JS tool reads it.dprint clear-cacheis run.Existing incremental files aren't read after upgrading, so each project does one full format run.