/** * Base tsdown configuration for Task Master monorepo * Provides shared configuration that can be extended by individual packages */ import type { UserConfig } from 'tsdown'; const isProduction = process.env.NODE_ENV === 'production'; const isDevelopment = !isProduction; /** * Environment helpers */ export const env = { isProduction, isDevelopment, NODE_ENV: process.env.NODE_ENV || 'development' }; /** * Base tsdown configuration for all packages * Since everything gets bundled into root dist/ anyway, use consistent settings */ export const baseConfig: Partial = { sourcemap: isDevelopment, format: 'esm', platform: 'node', dts: isDevelopment, minify: isProduction, treeshake: isProduction, // Better debugging in development ...(isDevelopment && { keepNames: true, splitting: false // Disable code splitting for better stack traces }), // Keep all npm dependencies external (available via node_modules) external: [/^[^@./]/, /^@(?!tm\/)/] }; /** * Utility function to merge configurations * Simplified for tsdown usage */ export function mergeConfig( base: Partial, overrides: Partial ): UserConfig { return { ...base, ...overrides } as UserConfig; }