Skip to content

fix: unbreak build.sh in standalone mode#22

Merged
lobinuxsoft merged 4 commits into
mainfrom
fix/build-sh-detect-bun
Apr 20, 2026
Merged

fix: unbreak build.sh in standalone mode#22
lobinuxsoft merged 4 commits into
mainfrom
fix/build-sh-detect-bun

Conversation

@lobinuxsoft

Copy link
Copy Markdown
Owner

Summary

The Decky plugin's build.sh was broken end-to-end in standalone mode and relied on npm/pnpm/yarn being present locally — but the monorepo's build_all.sh already mandates bun, leaving the two scripts inconsistent. This PR makes build.sh work with bun and fixes two latent bugs that prevented the standalone build from ever completing.

Changes (4 atomic commits)

  1. fix: detect bun as package manager in build.sh — add bun as the first option in detect_pm(), matching the monorepo's requirement. Updated the error message to recommend bun over toolbox/rpm-ostree.

  2. fix: reorder build.sh steps to avoid dist being wiped by frontend buildpackage.json's build script runs shx rm -rf dist, which wiped $BUILD_DIR seconds after it was created. Moved the "clean plugin output" step after the frontend build so $BUILD_DIR survives for the copy phase.

  3. fix: use build/ dir for standalone plugin output to avoid self-copy loop — in standalone mode, $DIST_DIR collided with rollup's ./dist/, making cp -r dist "$BUILD_DIR/" try to copy ./dist into itself. Submodule mode keeps using $ROOT_DIR/dist (the monorepo's dist/), where the collision never existed.

  4. chore: ignore standalone build/ output dir — keep the new build/ dir out of version control.

Context

Ran ./build_all.sh from the monorepo: step [6/6] failed with ERROR: No package manager found yet the summary reported a false ✓ thanks to a stale ZIP in dist/decky/ from a previous build with npm. The failure had been masked by cached artifacts.

Test plan

  • ./build.sh from decky-capydeploy standalone produces build/decky/CapyDeploy-v1.0.2.zip successfully
  • ./build_all.sh from the monorepo completes step [6/6] with a fresh ZIP once the submodule pointer is bumped (follow-up PR)
  • ZIP installs cleanly on Steam Deck via Decky Settings → Install from URL

Align build.sh with the monorepo's build_all.sh which already requires
bun. Previously the script only checked for npm/pnpm/yarn, making local
builds fail on setups that only have bun installed.

Bun is now detected first (preferred), with npm/pnpm/yarn kept as
fallbacks. Updated the error message to recommend bun over Node.js.
The package.json build script runs `shx rm -rf dist && rollup -c`, which
wipes the entire dist/ directory. Previously, build.sh created
$BUILD_DIR (which lives under dist/ in standalone mode) *before*
invoking the frontend build, so it got deleted seconds later and the
subsequent cp calls failed.

Move the "clean previous plugin output" step to after the frontend
build, so $BUILD_DIR survives for the file-copy phase.
In standalone mode $DIST_DIR was $ROOT_DIR/dist, which collides with
the frontend bundle directory owned by rollup. This made the later
`cp -r dist "$BUILD_DIR/"` call try to copy ./dist into itself and abort
with "cannot copy a directory into itself".

Use $ROOT_DIR/build for standalone output so the plugin ZIP lives
outside rollup's territory. Submodule mode keeps using $ROOT_DIR/dist
(the monorepo's dist/) where the collision never existed.
The standalone build mode now writes to ./build/ (separate from
rollup's ./dist/). Keep it out of version control alongside the other
build artifact directories.
@lobinuxsoft
lobinuxsoft merged commit 15c8eab into main Apr 20, 2026
2 checks passed
@lobinuxsoft
lobinuxsoft deleted the fix/build-sh-detect-bun branch April 20, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant