mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
build: migrate to tsdown (#595)
This commit is contained in:
parent
aaa473572c
commit
b4c139bc72
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -79,6 +79,7 @@
|
||||
"taze",
|
||||
"Tongji",
|
||||
"tsbuildinfo",
|
||||
"tsdown",
|
||||
"twoslash",
|
||||
"vite",
|
||||
"vuepress",
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
"templates"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup"
|
||||
"build": "tsdown"
|
||||
},
|
||||
"dependencies": {
|
||||
"@clack/prompts": "catalog:prod",
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { defineConfig } from 'tsup'
|
||||
import type { Options } from 'tsdown'
|
||||
import { defineConfig } from 'tsdown'
|
||||
import { version } from './package.json'
|
||||
|
||||
export default defineConfig({
|
||||
@ -7,9 +8,8 @@ export default defineConfig({
|
||||
dts: true,
|
||||
format: 'esm',
|
||||
sourcemap: false,
|
||||
splitting: false,
|
||||
clean: true,
|
||||
define: {
|
||||
__CLI_VERSION__: JSON.stringify(version),
|
||||
},
|
||||
})
|
||||
}) as Options
|
||||
@ -69,7 +69,7 @@
|
||||
"stylelint": "catalog:dev",
|
||||
"stylus": "catalog:dev",
|
||||
"tsconfig-vuepress": "catalog:dev",
|
||||
"tsup": "catalog:dev",
|
||||
"tsdown": "catalog:dev",
|
||||
"typescript": "catalog:dev",
|
||||
"vitest": "catalog:dev",
|
||||
"wait-on": "catalog:dev"
|
||||
|
||||
@ -27,10 +27,10 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "pnpm run copy && pnpm run tsup",
|
||||
"build": "pnpm run tsdown && pnpm run copy",
|
||||
"clean": "rimraf --glob ./lib",
|
||||
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png,woff2}\" lib",
|
||||
"tsup": "tsup --config tsup.config.ts"
|
||||
"tsdown": "tsdown"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vuepress": "catalog:vuepress"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { Options } from 'tsup'
|
||||
import { defineConfig } from 'tsup'
|
||||
import type { Options } from 'tsdown'
|
||||
import { defineConfig } from 'tsdown'
|
||||
import { argv } from '../../scripts/tsup-args.js'
|
||||
|
||||
const clientExternal: (string | RegExp)[] = [
|
||||
@ -11,7 +11,6 @@ export default defineConfig(() => {
|
||||
const DEFAULT_OPTIONS: Options = {
|
||||
dts: true,
|
||||
sourcemap: false,
|
||||
splitting: false,
|
||||
format: 'esm',
|
||||
}
|
||||
const options: Options[] = []
|
||||
@ -31,13 +31,13 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"dev": "pnpm '/(copy|tsup):watch/'",
|
||||
"build": "pnpm copy && pnpm tsup",
|
||||
"dev": "pnpm '/(copy|tsdown):watch/'",
|
||||
"build": "pnpm tsdown && pnpm copy",
|
||||
"clean": "rimraf --glob ./lib",
|
||||
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
|
||||
"copy:watch": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib -w",
|
||||
"tsup": "tsup --config tsup.config.ts",
|
||||
"tsup:watch": "tsup --config tsup.config.ts --watch -- -c"
|
||||
"tsdown": "tsdown",
|
||||
"tsdown:watch": "tsdown --watch -- -c"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"artplayer": "catalog:peer",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { Options } from 'tsup'
|
||||
import { defineConfig } from 'tsup'
|
||||
import type { Options } from 'tsdown'
|
||||
import { defineConfig } from 'tsdown'
|
||||
import { argv } from '../../scripts/tsup-args.js'
|
||||
|
||||
const config = [
|
||||
@ -16,12 +16,12 @@ const clientExternal = [
|
||||
/shared\/index\.js$/,
|
||||
]
|
||||
|
||||
export default defineConfig(() => {
|
||||
export default defineConfig((cli) => {
|
||||
const DEFAULT_OPTIONS: Options = {
|
||||
dts: true,
|
||||
sourcemap: false,
|
||||
splitting: false,
|
||||
format: 'esm',
|
||||
clean: !cli.watch,
|
||||
}
|
||||
const options: Options[] = []
|
||||
|
||||
@ -27,8 +27,8 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "pnpm run tsup",
|
||||
"tsup": "tsup --config tsup.config.ts"
|
||||
"build": "pnpm run tsdown",
|
||||
"tsdown": "tsdown"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vuepress": "catalog:vuepress"
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
import type { Options } from 'tsup'
|
||||
import { defineConfig } from 'tsup'
|
||||
import type { Options } from 'tsdown'
|
||||
import { defineConfig } from 'tsdown'
|
||||
import { argv } from '../../scripts/tsup-args.js'
|
||||
|
||||
export default defineConfig(() => {
|
||||
const DEFAULT_OPTIONS: Options = {
|
||||
dts: true,
|
||||
sourcemap: false,
|
||||
splitting: false,
|
||||
format: 'esm',
|
||||
}
|
||||
const options: Options[] = []
|
||||
@ -31,10 +31,10 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "pnpm run copy && pnpm run tsup",
|
||||
"build": "pnpm run tsdown && pnpm run copy",
|
||||
"clean": "rimraf --glob ./lib",
|
||||
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
|
||||
"tsup": "tsup --config tsup.config.ts"
|
||||
"tsdown": "tsdown"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vuepress": "catalog:vuepress"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { Options } from 'tsup'
|
||||
import { defineConfig } from 'tsup'
|
||||
import type { Options } from 'tsdown'
|
||||
import { defineConfig } from 'tsdown'
|
||||
import { argv } from '../../scripts/tsup-args.js'
|
||||
|
||||
const sharedExternal: (string | RegExp)[] = [
|
||||
@ -17,7 +17,6 @@ export default defineConfig(() => {
|
||||
const DEFAULT_OPTIONS: Options = {
|
||||
dts: true,
|
||||
sourcemap: false,
|
||||
splitting: false,
|
||||
format: 'esm',
|
||||
}
|
||||
|
||||
651
pnpm-lock.yaml
generated
651
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -47,7 +47,7 @@ catalogs:
|
||||
stylelint: ^16.19.1
|
||||
stylus: ^0.64.0
|
||||
tsconfig-vuepress: ^7.0.0
|
||||
tsup: ^8.4.0
|
||||
tsdown: ^0.11.5
|
||||
typescript: ^5.8.3
|
||||
vitest: ^3.1.3
|
||||
vue-router: ^4.5.1
|
||||
|
||||
@ -56,13 +56,13 @@
|
||||
"node": "^20.6.0 || >=22.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "pnpm '/(copy|tsup):watch/'",
|
||||
"build": "pnpm run copy && pnpm run tsup",
|
||||
"dev": "pnpm '/(copy|tsdown):watch/'",
|
||||
"build": "pnpm run tsdown && pnpm run copy",
|
||||
"clean": "rimraf --glob ./lib",
|
||||
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png,woff2}\" lib",
|
||||
"copy:watch": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png,woff2}\" lib -w",
|
||||
"tsup": "tsup --config tsup.config.ts",
|
||||
"tsup:watch": "tsup --config tsup.config.ts --watch -- -c"
|
||||
"tsdown": "tsdown",
|
||||
"tsdown:watch": "tsdown --watch -- -c"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@iconify/json": "catalog:peer",
|
||||
|
||||
@ -13,3 +13,5 @@ export type {
|
||||
GitChangelogInfo as GitChangelog,
|
||||
GitContributorInfo as GitContributor,
|
||||
} from '@vuepress/plugin-git'
|
||||
|
||||
export {}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import type { Options } from 'tsup'
|
||||
import type { Options } from 'tsdown'
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import process from 'node:process'
|
||||
import { defineConfig } from 'tsup'
|
||||
import { defineConfig } from 'tsdown'
|
||||
import { argv } from '../scripts/tsup-args.js'
|
||||
|
||||
const sharedExternal: (string | RegExp)[] = [
|
||||
@ -26,10 +26,10 @@ export default defineConfig((cli) => {
|
||||
const DEFAULT_OPTIONS: Options = {
|
||||
dts: true,
|
||||
sourcemap: false,
|
||||
splitting: false,
|
||||
watch: cli.watch,
|
||||
format: 'esm',
|
||||
silent: !!cli.watch,
|
||||
clean: !cli.watch,
|
||||
}
|
||||
const options: Options[] = []
|
||||
|
||||
@ -38,7 +38,7 @@ export default defineConfig((cli) => {
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/shared/index.ts'],
|
||||
outDir: './lib/shared',
|
||||
dts: true,
|
||||
external: ['sax'],
|
||||
})
|
||||
|
||||
if (argv.node) {
|
||||
@ -58,6 +58,7 @@ export default defineConfig((cli) => {
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/client/utils/index.ts'],
|
||||
outDir: './lib/client/utils',
|
||||
platform: 'browser',
|
||||
external: clientExternal,
|
||||
},
|
||||
// client/composables/index.js
|
||||
@ -65,6 +66,7 @@ export default defineConfig((cli) => {
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/client/composables/index.ts'],
|
||||
outDir: './lib/client/composables',
|
||||
platform: 'browser',
|
||||
external: [
|
||||
...clientExternal,
|
||||
'../utils/index.js',
|
||||
@ -76,6 +78,7 @@ export default defineConfig((cli) => {
|
||||
entry: ['./src/client/config.ts'],
|
||||
outDir: './lib/client',
|
||||
dts: false,
|
||||
platform: 'browser',
|
||||
external: [
|
||||
...clientExternal,
|
||||
'./composables/index.js',
|
||||
@ -87,6 +90,7 @@ export default defineConfig((cli) => {
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/client/index.ts'],
|
||||
outDir: './lib/client',
|
||||
platform: 'browser',
|
||||
external: [
|
||||
...clientExternal,
|
||||
'./composables/index.js',
|
||||
@ -98,6 +102,7 @@ export default defineConfig((cli) => {
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: [`./src/client/features/composables/${file}`],
|
||||
outDir: `./lib/client/features/composables/`,
|
||||
platform: 'browser',
|
||||
external: [
|
||||
...clientExternal,
|
||||
'../../composables/index.js',
|
||||
@ -105,7 +110,7 @@ export default defineConfig((cli) => {
|
||||
...featuresComposables.map(file => `./${file.replace('.ts', '.js')}`),
|
||||
],
|
||||
})),
|
||||
])
|
||||
] as Options[])
|
||||
}
|
||||
return options
|
||||
}) as Options[]
|
||||
Loading…
x
Reference in New Issue
Block a user