cool-easter-32542
04/24/2025, 6:29 PMnode_build_script, I need to specify them as a dependency of the package_json target itself, which is not exactly good for caching purposes, as if any the dependencies changes, all node_build_script result caches would be invalidated.
e.g.
package_json(
name="package_json",
dependencies=[
"//:my_dep_target"
],
scripts=[
node_build_script(
entry_point="build",
output_directories=["dist"],
),
node_build_script(
entry_point="some-other-script",
output_directories=["foo"],
),
],
)
Lets say my_dep_target is just necessary for the build script, it would still be included on the sandbox when running some-other-script, and if that target changes, the cache of some-other-script would be invalidated.
Describe the solution you'd like
I think we could have a dependencies field on the node_build_script where we could set specific dependencies for certain scripts.
The above use case could be changed to something like:
package_json(
name="package_json",
scripts=[
node_build_script(
entry_point="build",
output_directories=["dist"],
dependencies=[
"//:my_dep_target"
],
),
node_build_script(
entry_point="some-other-script",
output_directories=["foo"],
),
],
)
pantsbuild/pants