Skip to content

Commit 3c783ff

Browse files
committed
Assume one format
1 parent 02a627c commit 3c783ff

1 file changed

Lines changed: 15 additions & 17 deletions

File tree

‎.github/scripts/js-stack-build.sh‎

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
# Build @processmaker/* packages in dependency order, cascading downstream.
3-
# Reads processmaker.downstream from each package.json (source of truth).
3+
# Reads processmaker.downstream and processmaker.command from each package.json (source of truth).
44
set -euo pipefail
55

66
STACK_DIR="${STACK_DIR:-js-stack}"
@@ -57,21 +57,21 @@ resolve_ref() {
5757
}
5858

5959
get_downstream() {
60-
jq -r '(.processmaker.downstream // .processmaker.build.downstream // [])[]?'
60+
if ! jq -e '.processmaker | has("downstream")' >/dev/null; then
61+
echo "::error::processmaker.downstream is required in package.json" >&2
62+
exit 1
63+
fi
64+
jq -r '.processmaker.downstream[]?'
6165
}
6266

6367
get_build_command() {
6468
local cmd
65-
cmd=$(jq -r '.processmaker.build.command // empty')
66-
if [[ -n "$cmd" && "$cmd" != "null" ]]; then
67-
echo "$cmd"
68-
return
69-
fi
70-
if jq -e '.scripts["build-bundle"]' >/dev/null; then
71-
echo "build-bundle"
72-
elif jq -e '.scripts["build"]' >/dev/null; then
73-
echo "build"
69+
cmd=$(jq -r '.processmaker.command // empty')
70+
if [[ -z "$cmd" || "$cmd" == "null" ]]; then
71+
echo "::error::processmaker.command is required in package.json" >&2
72+
exit 1
7473
fi
74+
echo "$cmd"
7575
}
7676

7777
get_pm_deps() {
@@ -216,12 +216,10 @@ build_package() {
216216
local build_cmd
217217
build_cmd=$(get_build_command)
218218

219-
if [[ -n "$build_cmd" ]]; then
220-
if uses_yarn; then
221-
yarn run "$build_cmd"
222-
else
223-
npm run "$build_cmd"
224-
fi
219+
if uses_yarn; then
220+
yarn run "$build_cmd"
221+
else
222+
npm run "$build_cmd"
225223
fi
226224

227225
local pkg_name tarball dest

0 commit comments

Comments
 (0)