Clarify common conventions the tool supports for output and input folders
The readme says "Yarn build tries to guess your input and output folders based on common conventions." but I don't really know what that means. It would be great to spell out the exact algorithm it uses to guess the folders.
Great question. The specific algorithm is here https://github.com/ojkelly/yarn.build/blob/298b2d3385b2751cf66e590252cb8618ea0d4746/packages/plugins/shared/src/supervisor/index.ts#L538
In short, package.json#main conventionally points to the compiled js for other packages to run. If defined the folder containing the main file is marked as an output folder, and any changes to it are ignored.
This is only relevant for caching, as the build command is the script at [email protected].
The full defaults are here https://github.com/ojkelly/yarn.build/blob/2f000664c0255a0bd63e1180e679c5ede2e63fac/packages/plugins/shared/src/config.ts#L26
folders: {
input: ".",
output: ["build", "node_modules"],
},
Output folders are explicitly ignored, while input folders are explicitly included. Again, only matters for caching of subsequent builds.
And this can be set on a per workspace setting the following in package.json
"yarn.build": {
"input": ".",
"output": "dist"
},