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

Warn if files doesn't resolve to a file #1058

Open
appsforartists opened this issue Feb 21, 2024 · 5 comments
Open

Warn if files doesn't resolve to a file #1058

appsforartists opened this issue Feb 21, 2024 · 5 comments

Comments

@appsforartists
Copy link
Member

files leaves room for subtle mistakes that are hard to catch at review time, such as:

      "files": [
        "vite.config.js", // maybe the actual extension is ts
        "../../vite.config.common.ts" // maybe there's a wrong number of ../s

If a literal path is specified that doesn't match an actual file, Wireit should throw an error.

See also #215

@rictic
Copy link
Member

rictic commented Feb 21, 2024

This seems like a good default, as it's usually an error, but I wonder about cases where a file might or might not be present, but it's still an input. We'd need a way to express that

@appsforartists
Copy link
Member Author

Good point.

I wonder if letting the last character be ? is close enough. If the last character is ? and there's no file that matches that (which I can't imagine anyone doing on purpose, but it is possible), strip the ? and look for that file.

If a string contains a * or a ?, don't warn if it doesn't find a match. Otherwise, do.

@deebloo
Copy link

deebloo commented Feb 22, 2024

could be an object? First option will throw error if no files found. Current syntax would work as it does now

{
  "files": [
    {  "path": "src/**", "required": true  }, 
    "./some-generated-file.yml"
  ]
}

@appsforartists
Copy link
Member Author

Good defaults are important.

I'd be open to using a literal to mark something as potentially missing, but string literals should be assumed to be real files. Optimize for the common case, not the outlier.

@deebloo
Copy link

deebloo commented Feb 22, 2024

makes sense. I was. thinking of situations where the output of one job is used as the input for another. I also was thinking about the error being a lint error not a runtime error (which re-reading the issue isn't correct). If that is the case swapping it around makes more sense

{
  "files": [
    "src/**", 
    { "path": "./some-generated-file.yml", "optional": true }
  ]
}

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

No branches or pull requests

3 participants