Our situation is that we have a main Rails app, but which has many child components, some of which are client-side apps, etc. We need to cache directories like node_modules/ for some components, but we don’t want to explicitly list each needed cache path for each component, as that introduces a pretty tight coupling between the main app and its components.
Does the circle.yml configration provide a way to read a list of cache_directories paths from a single file, or recognize glob paths, or a way to programatically/dynamically cache directories?
Unfortunately globs are not supported in cache_directories, nor is it possible to read the list of directories from a file.
What you could do, though, is move the directories you want to cache to a specific subdirectory in the home folder and then symlink those directories into where they should be available. This way you could cache the whole directory at once but still have flexibility as per which directories are cached and where are they made available in your app folder.
Is this feature being considered for your roadmap? This unfortunately kills the ability to do proper caching for monorepos (without burdensome config churn), which are becoming more popular in the node community thanks to the lerna tool and popular projects using the pattern (e.g., babel).