google / google/wireit

environmentalDependencyCommands

Open
#1,081 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
6.4k
Forks
128
Avg merge
4d 10h
Merged PRs (30d)
4

Description

Sometimes metadata about the environment is an important input to the build process (for instance, to include a `Built at c9e6ee2` comment at the top of a bundled file).

Presently, wireit will return a cached output if the input files haven't changed, even if the environment has. There's no way to declare an explicit dependency on the environment. I propose we change that, with something like this:

```json
{
"wireit": {
"build": {
"command": "vite build",
"files": [
"dist/**/index.html",
"dist/**/*.js",
"vite.config.ts"
],
"environmentalDependencyCommands": [
"git rev-parse HEAD"
]
}
}
}
```

where the results of each entry in `environmentalDependencyCommands` would be cached, and a rebuild would be triggered if any of them changed (just like any other `dependency`).

In this case, making a git commit would change `HEAD`, which would invalidate the build even if the enumerated files haven't changed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.