Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rush] Support caching for specified files #5051

Open
fzxen opened this issue Dec 18, 2024 · 3 comments
Open

[rush] Support caching for specified files #5051

fzxen opened this issue Dec 18, 2024 · 3 comments

Comments

@fzxen
Copy link
Contributor

fzxen commented Dec 18, 2024

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
@aramissennyeydd
Copy link
Contributor

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

"taskPlugin": {
"pluginPackage": "@rushstack/heft",
"pluginName": "copy-files-plugin",
"options": {
"copyOperations": [
{
"sourcePath": "src",
"destinationFolders": ["lib"],
"includeGlobs": ["**/test/test-data/**/*"]
}
]
}
}
.

@iclanton
Copy link
Member

iclanton commented Jan 6, 2025

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 iclanton moved this from Needs triage to Low priority in Bug Triage Jan 6, 2025
@dmichon-msft
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Low priority
Development

No branches or pull requests

4 participants