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

Clarify common conventions the tool supports for output and input folders #157

Open
dobesv opened this issue Dec 22, 2021 · 1 comment
Open
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@dobesv
Copy link

dobesv commented Dec 22, 2021

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.

@dobesv dobesv added the enhancement New feature or request label Dec 22, 2021
@ojkelly
Copy link
Owner

ojkelly commented Jan 1, 2022

Great question. The specific algorithm is here

private async checkIfRunIsRequired(workspace: Workspace): Promise<boolean> {

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

const DEFAULT_CONFIG: YarnBuildConfiguration = {

  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"
  },

@ojkelly ojkelly added the documentation Improvements or additions to documentation label Jan 1, 2022
@ojkelly ojkelly self-assigned this Jan 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants