import "vite-plus/test/config";import { defineConfig, mergeConfig } from "vite-plus"; import baseConfig from "../../vite.config.ts";import { loadRepoEnv } from "../../scripts/lib/public-config.ts";import packageJson from "./package.json" with { type: "json" }; // The bundle used to inline only workspace packages, leaving every third-party// runtime dep external. External deps must exist on the real filesystem (the WSL// backend runs plain `wsl.exe -- node`, which cannot read inside an asar), so the// desktop build unpacked `**\/node_modules\/**` wholesale: 13,875 loose files to// support 20 native binaries. NSIS install time tracks file count, not bytes.//// Inverted here — bundle everything except the packages that genuinely cannot be// inlined. See scripts/lib/cli-external-packages.ts for what earns an exemption.import { isExternalCliDependency, shouldBundleCliDependency,} from "../../scripts/lib/cli-external-packages.ts"; export { shouldBundleCliDependency }; const repoEnv = loadRepoEnv();const cliBuildChannel = packageJson.version.includes("-nightly.") ? "nightly" : "latest"; export default mergeConfig( baseConfig, defineConfig({ run: { tasks: { build: { command: "node scripts/cli.ts build", dependsOn: ["@t3tools/web#build"], cache: false, }, }, }, pack: { entry: ["src/bin.ts"], outDir: "dist", sourcemap: true, clean: true, deps: { // Both halves are required. `alwaysBundle` forces the JS dependencies in // (declared deps are external by default, which is what this change is // undoing). `neverBundle` forces the native packages out: returning // false from `alwaysBundle` only means "no opinion", so a transitive // dependency would still be bundled — which silently inlined // msgpackr-extract and its loader, losing native acceleration. alwaysBundle: shouldBundleCliDependency, neverBundle: (id: string) => isExternalCliDependency(id), onlyBundle: false, }, banner: { js: "#!/usr/bin/env node\n", }, define: { __T3CODE_BUILD_CHANNEL__: JSON.stringify(cliBuildChannel), __T3CODE_BUILD_RELAY_URL__: JSON.stringify(repoEnv.T3CODE_RELAY_URL?.trim() ?? ""), __T3CODE_BUILD_CLERK_PUBLISHABLE_KEY__: JSON.stringify( repoEnv.T3CODE_CLERK_PUBLISHABLE_KEY?.trim() ?? "", ), __T3CODE_BUILD_CLERK_CLI_OAUTH_CLIENT_ID__: JSON.stringify( repoEnv.T3CODE_CLERK_CLI_OAUTH_CLIENT_ID?.trim() ?? "", ), __T3CODE_BUILD_RELAY_CLIENT_OTLP_TRACES_URL__: JSON.stringify( repoEnv.T3CODE_RELAY_CLIENT_OTLP_TRACES_URL?.trim() ?? "", ), __T3CODE_BUILD_RELAY_CLIENT_OTLP_TRACES_DATASET__: JSON.stringify( repoEnv.T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET?.trim() ?? "", ), __T3CODE_BUILD_RELAY_CLIENT_OTLP_TRACES_TOKEN__: JSON.stringify( repoEnv.T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN?.trim() ?? "", ), }, }, test: { // The server suite exercises sqlite, git, temp worktrees, and orchestration // runtimes heavily. Running files in parallel introduces load-sensitive flakes. fileParallelism: false, // Appended to the root setup, which mergeConfig concatenates. setupFiles: ["./src/testUtils/gitConfig.setup.ts"], // Server integration tests exercise sqlite, git, and orchestration together. // Under package-wide runs they can exceed the default budget on loaded CI hosts. hookTimeout: 120_000, testTimeout: 120_000, }, }),);
import "vite-plus/test/config";
import { defineConfig, mergeConfig } from "vite-plus";
import baseConfig from "../../vite.config.ts";
import { loadRepoEnv } from "../../scripts/lib/public-config.ts";
import packageJson from "./package.json" with { type: "json" };
// The bundle used to inline only workspace packages, leaving every third-party
// runtime dep external. External deps must exist on the real filesystem (the WSL
// backend runs plain `wsl.exe -- node`, which cannot read inside an asar), so the
// desktop build unpacked `**\/node_modules\/**` wholesale: 13,875 loose files to
// support 20 native binaries. NSIS install time tracks file count, not bytes.
//
// Inverted here — bundle everything except the packages that genuinely cannot be
// inlined. See scripts/lib/cli-external-packages.ts for what earns an exemption.
import {
isExternalCliDependency,
shouldBundleCliDependency,
} from "../../scripts/lib/cli-external-packages.ts";
export { shouldBundleCliDependency };
const repoEnv = loadRepoEnv();
const cliBuildChannel = packageJson.version.includes("-nightly.") ? "nightly" : "latest";
export default mergeConfig(
baseConfig,
defineConfig({
run: {
tasks: {
build: {
command: "node scripts/cli.ts build",
dependsOn: ["@t3tools/web#build"],
cache: false,
},
},
},
pack: {
entry: ["src/bin.ts"],
outDir: "dist",
sourcemap: true,
clean: true,
deps: {
// Both halves are required. `alwaysBundle` forces the JS dependencies in
// (declared deps are external by default, which is what this change is
// undoing). `neverBundle` forces the native packages out: returning
// false from `alwaysBundle` only means "no opinion", so a transitive
// dependency would still be bundled — which silently inlined
// msgpackr-extract and its loader, losing native acceleration.
alwaysBundle: shouldBundleCliDependency,
neverBundle: (id: string) => isExternalCliDependency(id),
onlyBundle: false,
},
banner: {
js: "#!/usr/bin/env node\n",
},
define: {
__T3CODE_BUILD_CHANNEL__: JSON.stringify(cliBuildChannel),
__T3CODE_BUILD_RELAY_URL__: JSON.stringify(repoEnv.T3CODE_RELAY_URL?.trim() ?? ""),
__T3CODE_BUILD_CLERK_PUBLISHABLE_KEY__: JSON.stringify(
repoEnv.T3CODE_CLERK_PUBLISHABLE_KEY?.trim() ?? "",
),
__T3CODE_BUILD_CLERK_CLI_OAUTH_CLIENT_ID__: JSON.stringify(
repoEnv.T3CODE_CLERK_CLI_OAUTH_CLIENT_ID?.trim() ?? "",
),
__T3CODE_BUILD_RELAY_CLIENT_OTLP_TRACES_URL__: JSON.stringify(
repoEnv.T3CODE_RELAY_CLIENT_OTLP_TRACES_URL?.trim() ?? "",
),
__T3CODE_BUILD_RELAY_CLIENT_OTLP_TRACES_DATASET__: JSON.stringify(
repoEnv.T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET?.trim() ?? "",
),
__T3CODE_BUILD_RELAY_CLIENT_OTLP_TRACES_TOKEN__: JSON.stringify(
repoEnv.T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN?.trim() ?? "",
),
},
},
test: {
// The server suite exercises sqlite, git, temp worktrees, and orchestration
// runtimes heavily. Running files in parallel introduces load-sensitive flakes.
fileParallelism: false,
// Appended to the root setup, which mergeConfig concatenates.
setupFiles: ["./src/testUtils/gitConfig.setup.ts"],
// Server integration tests exercise sqlite, git, and orchestration together.
// Under package-wide runs they can exceed the default budget on loaded CI hosts.
hookTimeout: 120_000,
testTimeout: 120_000,
},
}),
);