wave hi all Really im…

1 minute read

:wave: hi all. Really impressed with the caching feature behind nx affected. Whenever I run nx affected --target=lint multiple times, I’m amazed every time how quick it is done. Something that I don’t get though, is I have configured a different cache dir in nx.json like so:

"tasksRunnerOptions": { "default": { "runner": "@nrwl/workspace/tasks-runners/default", "options": { "cacheDirectory": ".cache/nx", "cacheableOperations": ["build", "lint", "test", "e2e"] } } } and I have set up husky to run the affected task with lint as target:

"husky": { "hooks": { "pre-commit": "nx affected --target=lint" } } but even though i might have manually run nx affected --target=lint just before I execute git commit, the cache seems not to be there anymore. Does the task runner ignore the not look at the nx.json file for the taskRunnerOptions maybe when it is run via husky?

Responses:

When husky runs you would of modified a file so the cache would be invalid for the project. Therefore it will have to rebuild the cache before it will use it again. You may see some cache hits for a lib if they aren’t modified but are affected as they will still have a cache.

Sorry I miss read the bottom part. Could you setup up a min repo?

Thanks. l’ll give try (later, not today anymore)

no worries, keep us posted

Updated: