Unverified Commit 8dc5e381 authored by Thierry Delafontaine's avatar Thierry Delafontaine
Browse files

opencode: refine build flags and remove unused tree-sitter dependency

Synchronize the build command with `packages/opencode/script/publish.ts` by:  
-  Adding `--define OPENCODE_TUI_PATH` to explicitly inject the TUI path during the build  
-  Removing the `--minify` flag from the bun build command

Removing the `--minify` flag resolves the error:  
"Cannot find module '/$bunfs/root/../../../tree-sitter-zw03zjvh.node' from '/$bunfs/root/opencode'"  
which occurred when letting the AI run bash commands.

Fixes #430293
parent 9021b82a
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@
  models-dev,
  nix-update-script,
  testers,
  tree-sitter,
  writableTmpDirAsHomeHook,
}:

@@ -108,8 +107,6 @@ stdenvNoCC.mkDerivation (finalAttrs: {
    outputHashMode = "recursive";
  };

  buildInputs = [ tree-sitter ];

  nativeBuildInputs = [
    bun
    models-dev
@@ -135,13 +132,12 @@ stdenvNoCC.mkDerivation (finalAttrs: {
    runHook preBuild

    bun build \
      --define OPENCODE_TUI_PATH="'${finalAttrs.tui}/bin/tui'" \
      --define OPENCODE_VERSION="'${finalAttrs.version}'" \
      --compile \
      --minify \
      --target=${bun-target.${stdenvNoCC.hostPlatform.system}} \
      --outfile=opencode \
      ./packages/opencode/src/index.ts \
      ${finalAttrs.tui}/bin/tui

    runHook postBuild
  '';