041a19f060
* feat: add service-managed self-update * chore: add temporary self-update test scripts * chore: simplify temporary script markdown fences * chore: run frontend in temporary self-update scripts * fix: show self-update job progress after apply * chore: add real npm self-update test script * fix: isolate npm self-update prefix * fix: detect npm service installs from bin shim * chore: reset service before real npm update test * chore: expand real npm status diagnostics * fix: preserve service home during self-update * fix(cli): tee self-update helper output to a log file * fix(cli): avoid launchd bootstrap race when reloading the macOS service * fix(backend): run macOS self-update helper once via transient launchd plist * fix(web): show self-update progress and lock the apply button until the update lands * fix(cli): reinstall via the kandev wrapper on Homebrew self-update * chore: remove temp self-update test scripts * fix(web): drop unused apply path from useUpdates hook * fix(backend): snapshot install state once in apply preflight * docs: align self-update docs with transient LaunchAgent flow * chore(release): run cli bundle from apps workspace root * fix(backend): guard against concurrent self-update applies * fix(backend): check scheme and helper paths in self-update apply * fix(backend): drop duplicate binary name from npx manual command * fix(cli): allow --help for service self-update without --intent * fix(cli): harden self-update dir perms and darwin uid resolution * fix(web): set required POST fields last in applyUpdate * docs: use JSON body notation for the apply endpoint * fix(backend): expire self-update guard so a stuck helper cannot wedge apply * refactor(cli): collapse redundant writeSync branch in self-update log
50 lines
1.9 KiB
Bash
Executable File
50 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build the CLI and copy artifacts into dist/kandev/cli/ for inclusion in release bundles.
|
|
#
|
|
# The CLI bundle (dist/cli.bundle.js) is a single-file esbuild output with all Node
|
|
# dependencies inlined. This is required for Homebrew installs where there is no
|
|
# node_modules directory in the Cellar.
|
|
#
|
|
# Output layout inside dist/kandev/cli/:
|
|
# bin/cli.js - Node entrypoint (requires #!/usr/bin/env node shebang + chmod +x)
|
|
# dist/cli.bundle.js - Self-contained bundle with inlined deps (used by Homebrew)
|
|
# package.json - Package metadata (used to read version at runtime)
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
CLI_DIR="$ROOT_DIR/apps/cli"
|
|
OUT_DIR="$ROOT_DIR/dist/kandev/cli"
|
|
|
|
echo "Building CLI for release bundle..."
|
|
|
|
# Build TypeScript
|
|
(cd "$ROOT_DIR/apps" && pnpm --filter kandev build)
|
|
echo " TypeScript build complete"
|
|
|
|
# Bundle with esbuild (inlines tree-kill and all other deps)
|
|
(cd "$ROOT_DIR/apps" && pnpm --filter kandev bundle)
|
|
echo " esbuild bundle complete"
|
|
|
|
# Copy artifacts into dist/kandev/cli/
|
|
rm -rf "$OUT_DIR"
|
|
mkdir -p "$OUT_DIR/bin" "$OUT_DIR/dist"
|
|
|
|
# Write a bin/cli.js that points at the bundled dist (for Homebrew/manual installs
|
|
# where there is no node_modules to resolve the unbundled dist/cli.js's deps).
|
|
# The npm package's bin/cli.js is different — it requires the unbundled dist/cli.js
|
|
# because tree-kill etc. are installed normally via npm.
|
|
cat > "$OUT_DIR/bin/cli.js" <<'EOF'
|
|
#!/usr/bin/env node
|
|
|
|
require("../dist/cli.bundle.js");
|
|
EOF
|
|
chmod +x "$OUT_DIR/bin/cli.js"
|
|
|
|
cp "$CLI_DIR/dist/cli.bundle.js" "$OUT_DIR/dist/cli.bundle.js"
|
|
cp "$CLI_DIR/package.json" "$OUT_DIR/package.json"
|
|
|
|
echo "CLI artifacts packaged at $OUT_DIR"
|
|
echo " bin/cli.js (entrypoint, requires dist/cli.bundle.js, chmod +x)"
|
|
echo " dist/cli.bundle.js (self-contained bundle, deps inlined)"
|
|
echo " package.json"
|