File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env bun
22import { $ } from "bun"
3+ import fs from "fs"
34import pkg from "../package.json"
45import { Script } from "@opencode-ai/script"
56import { fileURLToPath } from "url"
@@ -56,10 +57,16 @@ async function copyAssets(targetDir: string) {
5657 await $ `cp -r ./bin ${ targetDir } /bin`
5758 await $ `cp -r ../../.opencode/skills ${ targetDir } /skills`
5859 await $ `cp ./script/postinstall.mjs ${ targetDir } /postinstall.mjs`
59- // Bundle dbt-tools: copy its bin wrapper + built dist
60+ // Bundle dbt-tools: copy its bin wrapper + only the files it actually needs.
61+ // The full dist/ contains ~220 MB of .node native binaries from altimate-core
62+ // that bun copies as transitive build artifacts but dbt-tools never loads.
6063 await $ `mkdir -p ${ targetDir } /dbt-tools/bin`
6164 await $ `cp ../dbt-tools/bin/altimate-dbt ${ targetDir } /dbt-tools/bin/altimate-dbt`
62- await $ `cp -r ../dbt-tools/dist ${ targetDir } /dbt-tools/dist`
65+ await $ `mkdir -p ${ targetDir } /dbt-tools/dist`
66+ await $ `cp ../dbt-tools/dist/index.js ${ targetDir } /dbt-tools/dist/`
67+ if ( fs . existsSync ( "../dbt-tools/dist/altimate_python_packages" ) ) {
68+ await $ `cp -r ../dbt-tools/dist/altimate_python_packages ${ targetDir } /dbt-tools/dist/`
69+ }
6370 await Bun . file ( `${ targetDir } /LICENSE` ) . write ( await Bun . file ( "../../LICENSE" ) . text ( ) )
6471 await Bun . file ( `${ targetDir } /CHANGELOG.md` ) . write ( await Bun . file ( "../../CHANGELOG.md" ) . text ( ) )
6572}
Original file line number Diff line number Diff line change @@ -297,6 +297,15 @@ describe("Bundle Completeness", () => {
297297 expect ( publishScript ) . toContain ( "bun run build" )
298298 } )
299299
300+ test ( "publish.ts copies only needed dbt-tools dist files (not .node binaries)" , ( ) => {
301+ const publishScript = readFileSync ( join ( repoRoot , "packages/opencode/script/publish.ts" ) , "utf-8" )
302+ // Should copy index.js and altimate_python_packages selectively, not `cp -r dist`
303+ expect ( publishScript ) . toContain ( "dist/index.js" )
304+ expect ( publishScript ) . toContain ( "altimate_python_packages" )
305+ // Should NOT do a blanket `cp -r ../dbt-tools/dist` (would include ~220MB of .node files)
306+ expect ( publishScript ) . not . toMatch ( / c p - r \. \. \/ d b t - t o o l s \/ d i s t [ ^ / ] / )
307+ } )
308+
300309 test ( "postinstall.mjs sets up dbt-tools symlink" , ( ) => {
301310 const postinstall = readFileSync ( join ( repoRoot , "packages/opencode/script/postinstall.mjs" ) , "utf-8" )
302311 expect ( postinstall ) . toContain ( "setupDbtTools" )
You can’t perform that action at this time.
0 commit comments