Thanks to visit codestin.com
Credit goes to github.com

Skip to content

refactor: switch to tsdown #938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"stylexjs",
"sxzz",
"tada",
"tsdown",
"twoslash",
"unconfig",
"undefinedable",
Expand Down
16 changes: 10 additions & 6 deletions monoman.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
noDuplicatedPnpmLockfile,
} from 'monoman'
import { docsLink, githubLink } from './macros/repo'
import type { BuildConfig } from './tsdown.config'
import type { PackageJson } from 'pkg-types'
import type { Options } from 'tsup'

const jiti = createJiti(import.meta.url)

Expand Down Expand Up @@ -117,13 +117,17 @@ export default unplugin.${entry} as typeof unplugin.${entry}\n`,
data.publishConfig.access = 'public'
data.publishConfig.tag = 'next'

const tsupFile = path.resolve(pkgRoot, 'tsup.config.ts')
if (!data.meta?.skipExports && (await exists(tsupFile))) {
const tsupConfig: Options = (
await jiti.import<{ default: Options }>(tsupFile)
const tsdownFile = path.resolve(pkgRoot, 'tsdown.config.ts')
if (!data.meta?.skipExports && (await exists(tsdownFile))) {
const tsdownConfig = (
await jiti.import<{ default: BuildConfig }>(tsdownFile)
).default
const entry = tsdownConfig?.onlyIndex
? ['./src/index.ts']
: ['./src/*.ts', '!./**.d.ts']

const entries = (
await fg(tsupConfig.entry as string[], {
await fg(entry, {
cwd: pkgRoot,
absolute: true,
})
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"author": "三咲智子 Kevin Deng <[email protected]>",
"funding": "https://github.com/sponsors/vue-macros",
"scripts": {
"build": "pnpm run --filter=\"./packages/*\" --parallel build",
"dev": "pnpm run --filter=\"./packages/*\" --parallel dev",
"build": "pnpm run --filter=\"./packages/*\" --parallel build && tsdown",
"dev": "DEV=true tsdown",
"clean": "rimraf -g dist coverage \"packages/*/dist\" && pnpm run -r --parallel clean",
"docs:dev": "pnpm run -C ./docs dev",
"docs:preview": "pnpm run -C ./docs preview",
Expand Down Expand Up @@ -63,7 +63,7 @@
"rollup": "catalog:",
"rollup-plugin-dts": "catalog:",
"taze": "catalog:",
"tsup": "catalog:",
"tsdown": "catalog:",
"tsx": "catalog:",
"typescript": "catalog:",
"unocss": "catalog:",
Expand Down
5 changes: 1 addition & 4 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@
},
"tag": "next"
},
"scripts": {
"build": "tsup",
"dev": "DEV=true tsup"
},
"scripts": {},
"dependencies": {
"@vue-macros/common": "workspace:*",
"neverthrow": "catalog:",
Expand Down
6 changes: 6 additions & 0 deletions packages/api/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineBuildConfig } from '../../tsdown.config.ts'

export default defineBuildConfig({
onlyIndex: true,
platform: 'node',
})
6 changes: 0 additions & 6 deletions packages/api/tsup.config.ts

This file was deleted.

5 changes: 1 addition & 4 deletions packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@
},
"tag": "next"
},
"scripts": {
"build": "tsup",
"dev": "DEV=true tsup"
},
"scripts": {},
"peerDependencies": {
"astro": "^2.0.0 || ^3.0.0 || ^4.0.0"
},
Expand Down
5 changes: 5 additions & 0 deletions packages/astro/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineBuildConfig } from '../../tsdown.config.ts'

export default defineBuildConfig({
onlyIndex: true,
})
5 changes: 0 additions & 5 deletions packages/astro/tsup.config.ts

This file was deleted.

5 changes: 1 addition & 4 deletions packages/better-define/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,7 @@
},
"tag": "next"
},
"scripts": {
"build": "tsup",
"dev": "DEV=true tsup"
},
"scripts": {},
"dependencies": {
"@vue-macros/api": "workspace:*",
"@vue-macros/common": "workspace:*",
Expand Down
5 changes: 5 additions & 0 deletions packages/better-define/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineBuildConfig } from '../../tsdown.config.ts'

export default defineBuildConfig({
platform: 'node',
})
5 changes: 0 additions & 5 deletions packages/better-define/tsup.config.ts

This file was deleted.

5 changes: 1 addition & 4 deletions packages/boolean-prop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@
},
"tag": "next"
},
"scripts": {
"build": "tsup",
"dev": "DEV=true tsup"
},
"scripts": {},
"dependencies": {
"@vue-macros/common": "workspace:*",
"@vue/compiler-core": "catalog:"
Expand Down
3 changes: 3 additions & 0 deletions packages/boolean-prop/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { defineBuildConfig } from '../../tsdown.config.ts'

export default defineBuildConfig()
3 changes: 0 additions & 3 deletions packages/boolean-prop/tsup.config.ts

This file was deleted.

5 changes: 1 addition & 4 deletions packages/chain-call/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@
},
"tag": "next"
},
"scripts": {
"build": "tsup",
"dev": "DEV=true tsup"
},
"scripts": {},
"dependencies": {
"@vue-macros/common": "workspace:*",
"unplugin": "catalog:"
Expand Down
3 changes: 3 additions & 0 deletions packages/chain-call/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { defineBuildConfig } from '../../tsdown.config.ts'

export default defineBuildConfig()
3 changes: 0 additions & 3 deletions packages/chain-call/tsup.config.ts

This file was deleted.

5 changes: 1 addition & 4 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@
},
"tag": "next"
},
"scripts": {
"build": "tsup",
"dev": "DEV=true tsup"
},
"scripts": {},
"peerDependencies": {
"vue": "^2.7.0 || ^3.2.25"
},
Expand Down
6 changes: 6 additions & 0 deletions packages/common/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineBuildConfig } from '../../tsdown.config.ts'

export default defineBuildConfig({
onlyIndex: true,
external: ['node:module'],
})
7 changes: 0 additions & 7 deletions packages/common/tsup.config.ts

This file was deleted.

5 changes: 1 addition & 4 deletions packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@
},
"tag": "next"
},
"scripts": {
"build": "tsup",
"dev": "DEV=true tsup"
},
"scripts": {},
"dependencies": {
"@vue-macros/common": "workspace:*",
"quansync": "catalog:",
Expand Down
5 changes: 5 additions & 0 deletions packages/config/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineBuildConfig } from '../../tsdown.config.ts'

export default defineBuildConfig({
platform: 'node',
})
6 changes: 0 additions & 6 deletions packages/config/tsup.config.ts

This file was deleted.

5 changes: 1 addition & 4 deletions packages/define-emit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@
},
"tag": "next"
},
"scripts": {
"build": "tsup",
"dev": "DEV=true tsup"
},
"scripts": {},
"peerDependencies": {
"vue": "^2.7.0 || ^3.2.25"
},
Expand Down
5 changes: 5 additions & 0 deletions packages/define-emit/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineBuildConfig } from '../../tsdown.config.ts'

export default defineBuildConfig({
platform: 'node',
})
5 changes: 0 additions & 5 deletions packages/define-emit/tsup.config.ts

This file was deleted.

5 changes: 1 addition & 4 deletions packages/define-models/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@
},
"tag": "next"
},
"scripts": {
"build": "tsup",
"dev": "DEV=true tsup"
},
"scripts": {},
"peerDependencies": {
"@vueuse/core": ">=9.0.0"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/define-models/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineBuildConfig } from '../../tsdown.config.ts'

export default defineBuildConfig({
ignoreDeps: {
peerDependencies: ['@vueuse/core'],
},
})
7 changes: 0 additions & 7 deletions packages/define-models/tsup.config.ts

This file was deleted.

5 changes: 1 addition & 4 deletions packages/define-options/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@
},
"tag": "next"
},
"scripts": {
"build": "tsup",
"dev": "DEV=true tsup"
},
"scripts": {},
"dependencies": {
"@vue-macros/common": "workspace:*",
"ast-walker-scope": "catalog:",
Expand Down
3 changes: 3 additions & 0 deletions packages/define-options/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { defineBuildConfig } from '../../tsdown.config.ts'

export default defineBuildConfig()
3 changes: 0 additions & 3 deletions packages/define-options/tsup.config.ts

This file was deleted.

5 changes: 1 addition & 4 deletions packages/define-prop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@
},
"tag": "next"
},
"scripts": {
"build": "tsup",
"dev": "DEV=true tsup"
},
"scripts": {},
"peerDependencies": {
"vue": "^2.7.0 || ^3.2.25"
},
Expand Down
5 changes: 5 additions & 0 deletions packages/define-prop/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineBuildConfig } from '../../tsdown.config.ts'

export default defineBuildConfig({
platform: 'node',
})
5 changes: 0 additions & 5 deletions packages/define-prop/tsup.config.ts

This file was deleted.

5 changes: 1 addition & 4 deletions packages/define-props-refs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@
},
"tag": "next"
},
"scripts": {
"build": "tsup",
"dev": "DEV=true tsup"
},
"scripts": {},
"peerDependencies": {
"vue": "^2.7.0 || ^3.2.25"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/define-props-refs/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { defineBuildConfig } from '../../tsdown.config.ts'

export default defineBuildConfig()
3 changes: 0 additions & 3 deletions packages/define-props-refs/tsup.config.ts

This file was deleted.

5 changes: 1 addition & 4 deletions packages/define-props/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@
},
"tag": "next"
},
"scripts": {
"build": "tsup",
"dev": "DEV=true tsup"
},
"scripts": {},
"peerDependencies": {
"@vue-macros/reactivity-transform": "workspace:^",
"vue": "^2.7.0 || ^3.2.25"
Expand Down
7 changes: 7 additions & 0 deletions packages/define-props/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineBuildConfig } from '../../tsdown.config.ts'

export default defineBuildConfig({
ignoreDeps: {
peerDependencies: ['vue', '@vue-macros/reactivity-transform'],
},
})
7 changes: 0 additions & 7 deletions packages/define-props/tsup.config.ts

This file was deleted.

5 changes: 1 addition & 4 deletions packages/define-render/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@
},
"tag": "next"
},
"scripts": {
"build": "tsup",
"dev": "DEV=true tsup"
},
"scripts": {},
"peerDependencies": {
"vue": "^2.7.0 || ^3.0.0"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/define-render/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { defineBuildConfig } from '../../tsdown.config.ts'

export default defineBuildConfig()
3 changes: 0 additions & 3 deletions packages/define-render/tsup.config.ts

This file was deleted.

Loading