You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using output, matching a directory implicitly includes all of the contents of that directory (though see #77 for a caveat with how that is currently broken with ! negations). That's because when we clean and cache, we use recursive operations like fs.rm and fs.cp.
However, with files, which is used for generating the cache key, we don't use recursive operations. We just read and hash the files that directly matched the glob.
files should be consistent with output. Matching a directory should implicitly match all of its contents. This is also consistent with the how the package.json files array, and .gitignore files work.
The text was updated successfully, but these errors were encountered:
### Before
Before this PR, if the input `files` array matched a directory, we would **not** implicitly include all recursive children of that directory, even though we **would** effectively do that for `output` files.
In this example, `files` would not match anything, but `output` would match all recursive children of `lib/`. That meant if you change a file inside `src/`, the script would still be considered fresh.
{
"ts": {
"command": "tsc",
"files": [
"src"
],
"output": [
"lib"
]
}
}
### After
After this PR, the `files` and `output` arrays behave the same. So, in the above example, `files` will now match all recursive children of `src/`.
### Explanation
The reason for the difference was that, while the globbing logic we did for `files` and `output` was more-or-less the same, the difference is in what we do with the results.
When we generate a script's state, we take each matched file, and hash it. If the file was not explicitly listed in the glob output, we would never see it.
When we clean or cache, however, we use recursive `fs.rm` and `fs.cp` operations, so it didn't matter that the glob results didn't explicitly list all recursive contents.
We now have an `expandDirectories` option, which modifies the given glob patterns to automatically include the recursive contents of every matching directory. We do this simply by adding a copy of each pattern with a `/**` suffix.
Fixes#83
### Also
- Factored the `glob` function out of `Executor` and into its own module, for organization and easier testing.
- Added checks for empty and blank strings in `Analyzer`.
When using
output
, matching a directory implicitly includes all of the contents of that directory (though see #77 for a caveat with how that is currently broken with!
negations). That's because when we clean and cache, we use recursive operations likefs.rm
andfs.cp
.However, with
files
, which is used for generating the cache key, we don't use recursive operations. We just read and hash the files that directly matched the glob.files
should be consistent withoutput
. Matching a directory should implicitly match all of its contents. This is also consistent with the how thepackage.json
files array, and.gitignore
files work.The text was updated successfully, but these errors were encountered: