xiaohongshu
xiaohongshu
build-tools
Build tool configuration for tsup, tsx, and bundlers. Use when setting up build pipelines.
Full skill instructions
This skill covers build tool configuration for TypeScript projects.
Use this skill when:
RIGHT TOOL FOR THE JOB - Use tsup for libraries, tsx for scripts, Vite for apps.
| Use Case | Recommended Tool |
|---|---|
| Library/Package | tsup |
| CLI Application | tsup + tsx |
| Script Execution | tsx |
| React SPA | Vite |
| Full-Stack App | Next.js |
npm install -D tsup
// tsup.config.ts
import { defineConfig } from 'tsup';
export default defineConfig({
entry: ['src/index.ts'],
format: ['esm', 'cjs'],
dts: true,
clean: true,
splitting: false,
sourcemap: true,
minify: false,
treeshake: true,
});
{
"name": "my-library",
"version": "1.0.0",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
}
},
"files": ["dist"],
"scripts": {
"build": "tsup",
"dev": "tsup --watch"
}
}
// tsup.config.ts
export default defineConfig({
entry: {
index: 'src/index.ts',
utils: 'src/utils/index.ts',
cli: 'src/cli.ts',
},
format: ['esm', 'cjs'],
dts: true,
});
// tsup.config.ts
export default defineConfig({
entry: ['src/cli.ts'],
format: ['esm'],
banner: {
js: '#!/usr/bin/env node',
},
clean: true,
});
npm install -D tsx
# Run TypeScript file directly
npx tsx src/script.ts
# Watch mode
npx tsx watch src/server.ts
# With Node.js flags
npx tsx --inspect src/debug.ts
{
"scripts": {
"dev": "tsx watch src/index.ts",
"start": "tsx src/index.ts",
"script": "tsx scripts/migrate.ts"
}
}
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler",
"esModuleInterop": true
}
}
{
"compilerOptions": {
"outDir": "./dist",
"declaration": true,
"declarationMap": true,
"sourceMap": true
}
}
{
"scripts": {
"build": "tsc",
"build:watch": "tsc --watch"
}
}
npm create vite@latest
// vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
build: {
target: 'ES2022',
sourcemap: true,
outDir: 'dist',
},
resolve: {
alias: {
'@': '/src',
},
},
});
// vite.config.ts
import { defineConfig } from 'vite';
import { resolve } from 'node:path';
export default defineConfig({
build: {
lib: {
entry: resolve(__dirname, 'src/index.ts'),
name: 'MyLib',
fileName: 'my-lib',
formats: ['es', 'cjs'],
},
rollupOptions: {
external: ['react', 'react-dom'],
},
},
});
{
"scripts": {
"prebuild": "npm run clean",
"build": "tsup",
"postbuild": "npm run type-check",
"clean": "rm -rf dist",
"type-check": "tsc --noEmit"
}
}
{
"scripts": {
"dev": "tsup --watch",
"dev:run": "tsx watch src/index.ts"
}
}
// Output: dist/index.js
export function hello() { }
// Output: dist/index.cjs
module.exports.hello = function() { }
// tsup.config.ts
export default defineConfig({
format: ['esm', 'cjs'],
dts: true,
});
// tsup.config.ts
export default defineConfig({
dts: true, // Generate declaration files
});
{
"scripts": {
"build": "tsup && tsc --emitDeclarationOnly"
}
}
// tsup.config.ts
export default defineConfig({
sourcemap: true, // Generate source maps
});
// tsup.config.ts
export default defineConfig({
treeshake: true, // Remove unused code
});
// tsup.config.ts
export default defineConfig({
minify: true, // Minify output (production)
});
// tsup.config.ts
export default defineConfig({
external: ['react', 'react-dom'], // Don't bundle these
});
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience