[rush] Support caching for specified files
Summary
The outputFolderNames field in rush-projects.json can only specify directories but cannot specify file paths.
My package project structure is as follows:
.
├── config
├── dist
├── index.js
├── package.json
└── src
I hope to cache the dist and index.js, but i don't know how to configure index.js in rush-projects.json
Details
Perhaps we can add an outputFileNames field to the rush-projects.json file, or add a new field named output that supports both directories and files.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@microsoft/rush globally installed version? |
5.147.0 |
rushVersion from rush.json? |
5.147.0 |
useWorkspaces from rush.json? |
true |
| Operating system? | mac |
| Would you consider contributing a PR? | Yes |
Node.js version (node -v)? |
20.16.0 |
👋 Is index.js build output? You should be able to configure your build tool to stick index.js into dist, if not, you can also use the heft-copy-plugin to move it to a folder, https://github.com/microsoft/rushstack/blob/417158483ed800333ba34c70efe1e4bf4e1db070/apps/api-extractor/config/heft.json#L17-L29.
Only allowing top-level folders was intentional. I'm trying to recall if there was a reason why we don't allow individual files.
You could always emit that file to a folder and use package.json's exports property to point index.js at that folder. Or use the package.json main/module properties.
Allowing individual files makes the cache logic far more complicated. With folders we can just nuke the entire folders in preparation for cache replay.