rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

[rush] Support caching for specified files

Open fzxen opened this issue 1 year ago • 3 comments

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

fzxen avatar Dec 18 '24 08:12 fzxen

👋 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.

aramissennyeydd avatar Jan 03 '25 19:01 aramissennyeydd

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.

iclanton avatar Jan 06 '25 19:01 iclanton

Allowing individual files makes the cache logic far more complicated. With folders we can just nuke the entire folders in preparation for cache replay.

dmichon-msft avatar Jan 08 '25 19:01 dmichon-msft