cool-easter-32542
04/24/2025, 6:49 PMnode_build_script also implements the package goal, so let say the CI pipeline runs something like pants package :: the defined node_build_script would be executed, e.g.
package_json(
name="package_json",
scripts=[
node_build_script(
entry_point="only-run",
output_directories=["foo"],
),
],
)
Describe the solution you'd like
Maybe a node_run_script could be created where just the run goal is implemented?
Also maybe theres no need to require output_directories or output_files on a node_run_script? The current node_build_script does require either:
pants/src/python/pants/backend/javascript/package/rules.py
Lines 138 to 150 in</pantsbuild/pants/commit/82b1bb82fd4b609856c2aeab7ebb929793d52427|82b1bb8>
| def __post_init__(self) -> None: |
| ----------------------------------------------------------------------- |
| if not (self.output_directories or self.output_files): |
| raise ValueError( |
| softwrap( |
| f""" |
| Neither the {NodeBuildScriptOutputDirectoriesField.alias} nor the |
| {NodeBuildScriptOutputFilesField.alias} field was provided. |
| |
| One of the fields have to be set, or else the {NodeBuildScript.alias} |
| output will not be captured for further use in the build. |
| """ |
| ) |
| ) |
We have use cases where we wanna run a yarn ... command but the output is not necessary, just the exit code != 0 would be enough.
pantsbuild/pants