Skip to content
vxvx
GitHubBlueskydev.toRSS

Presets are just functions

Share task setups across projects with a TypeScript function, no new concept.

A preset function shared across configs.

Twenty libraries with the same build should not mean twenty copies of it. Write a function that returns the tasks and call it in each config.

It is plain TypeScript: parameters, imports and types all work, and the key sees the evaluated result.

// config

// packages/ui/vx.config.ts
import { defineProject } from '@vzn/vx/config'

const lib = (entry: string) => ({
  build: {
    exec: { command: `tsup ${entry}` },
    cache: { inputs: { files: ['src/**'] }, outputs: { files: ['dist/**'] } },
  },
})

export default defineProject({ tasks: { ...lib('src/index.ts') } })
Turborepo, Nx and other product names are trademarks of their owners. vx is not affiliated with or endorsed by them.