refactor: use publish config with tsup (#70)

* refactor: use publish config with tsup

* fix(tsup): set tsconfig

* fix(tsup): find workspace dir

* fix(docs): remove references

* docs: update references link

* fix: lint errors
This commit is contained in:
藍+85CD authored and GitHub committed 2025-02-20 21:10:58 +08:00
1 parent bce8ce99ed
commit f680fdfef9
58 files changed
+529 -551

No files matched your search

-4
View File
@@ -33,7 +33,3 @@ build
.env*.local
.vercel
next-env.d.ts
# docs:references
docs/content/docs/references/*.mdx
!docs/content/docs/references/*.model.mdx
-1
View File
@@ -34,7 +34,6 @@ words:
- Novita
- ollama
- openrouter
- pkgroll
- Plateforme
- qwen
- reranker
+1 -1
View File
@@ -45,4 +45,4 @@ const { embeddings } = await embedMany({
## References
- [`@xsai/embed`](../references/embed)
- [`@xsai/embed`](https://tsdocs.dev/search/docs/@xsai/embed)
@@ -23,5 +23,5 @@ npm i @xsai/stream-object
## References
- [`@xsai/generate-object`](../../references/generate-object)
- [`@xsai/stream-object`](../../references/stream-object)
- [`@xsai/generate-object`](https://tsdocs.dev/search/docs/@xsai/generate-object)
- [`@xsai/stream-object`](https://tsdocs.dev/search/docs/@xsai/stream-object)
@@ -13,4 +13,4 @@ npm i @xsai/generate-speech
## References
- [`@xsai/generate-speech`](../../references/generate-speech)
- [`@xsai/generate-speech`](https://tsdocs.dev/search/docs/@xsai/generate-speech)
@@ -82,5 +82,5 @@ console.log(text)
## References
- [`@xsai/generate-text`](../../references/generate-text)
- [`@xsai/stream-text`](../../references/stream-text)
- [`@xsai/generate-text`](https://tsdocs.dev/search/docs/@xsai/generate-text)
- [`@xsai/stream-text`](https://tsdocs.dev/search/docs/@xsai/stream-text)
@@ -13,4 +13,4 @@ npm i @xsai/generate-transcription
## References
- [`@xsai/generate-transcription`](../../references/generate-transcription)
- [`@xsai/generate-transcription`](https://tsdocs.dev/search/docs/@xsai/generate-transcription)
+1 -1
View File
@@ -64,4 +64,4 @@ const model = await retrieveModel({
## References
- [`@xsai/model`](../references/model)
- [`@xsai/model`](https://tsdocs.dev/search/docs/@xsai/model)
+1 -1
View File
@@ -152,4 +152,4 @@ Other supported providers can be viewed at [References](#references).
## References
see [`@xsai/providers`](../references/providers)
see [`@xsai/providers`](https://tsdocs.dev/search/docs/@xsai/providers)
@@ -17,4 +17,4 @@ npm i @xsai/stream-text
## References
see [`@xsai/stream-text`](../references/stream-text)
see [`@xsai/stream-text`](https://tsdocs.dev/search/docs/@xsai/stream-text)
+1 -1
View File
@@ -98,4 +98,4 @@ const { text } = await generateText({
## References
- [`@xsai/tool`](../references/tool)
- [`@xsai/tool`](https://tsdocs.dev/search/docs/@xsai/tool)
@@ -1,8 +0,0 @@
---
title: "@xsai/embed"
description: https://npmjs.com/package/@xsai/embed
---
---type-table---
../../../lib/references/embed.ts
---end---
@@ -1,8 +0,0 @@
---
title: "@xsai/generate-object"
description: https://npmjs.com/package/@xsai/generate-object
---
---type-table---
../../../lib/references/generate-object.ts
---end---
@@ -1,8 +0,0 @@
---
title: "@xsai/generate-speech"
description: https://npmjs.com/package/@xsai/generate-speech
---
---type-table---
../../../lib/references/generate-speech.ts
---end---
@@ -1,8 +0,0 @@
---
title: "@xsai/generate-text"
description: https://npmjs.com/package/@xsai/generate-text
---
---type-table---
../../../lib/references/generate-text.ts
---end---
@@ -1,8 +0,0 @@
---
title: "@xsai/generate-transcription"
description: https://npmjs.com/package/@xsai/generate-transcription
---
---type-table---
../../../lib/references/generate-transcription.ts
---end---
@@ -1,8 +0,0 @@
---
title: "@xsai/providers"
description: https://npmjs.com/package/@xsai/providers
---
---type-table---
../../../lib/references/providers.ts
---end---
@@ -1,8 +0,0 @@
---
title: "@xsai/shared-chat"
description: https://npmjs.com/package/@xsai/shared-chat
---
---type-table---
../../../lib/references/shared-chat.ts
---end---
@@ -1,8 +0,0 @@
---
title: "@xsai/stream-object"
description: https://npmjs.com/package/@xsai/stream-object
---
---type-table---
../../../lib/references/stream-object.ts
---end---
@@ -1,8 +0,0 @@
---
title: "@xsai/stream-text"
description: https://npmjs.com/package/@xsai/stream-text
---
---type-table---
../../../lib/references/stream-text.ts
---end---
@@ -1,8 +0,0 @@
---
title: "@xsai/tool"
description: https://npmjs.com/package/@xsai/tool
---
---type-table---
../../../lib/references/tool.ts
---end---
@@ -1,8 +0,0 @@
---
title: xsai
description: https://npmjs.com/package/xsai
---
---type-table---
../../../lib/references/xsai.ts
---end---
-13
View File
@@ -1,13 +0,0 @@
import { generateFiles } from 'fumadocs-typescript'
import * as path from 'node:path'
// eslint-disable-next-line @masknet/no-top-level
void generateFiles({
input: ['./content/docs/**/*.model.mdx'],
// Rename x.model.mdx to x.mdx
output: file =>
path.resolve(
path.dirname(file),
`${path.basename(file).split('.')[0]}.mdx`,
),
})
-1
View File
@@ -1 +0,0 @@
export * from '@xsai/embed'
-1
View File
@@ -1 +0,0 @@
export * from '@xsai/generate-object'
-1
View File
@@ -1 +0,0 @@
export * from '@xsai/generate-speech'
-1
View File
@@ -1 +0,0 @@
export * from '@xsai/generate-text'
@@ -1 +0,0 @@
export * from '@xsai/generate-transcription'
-1
View File
@@ -1 +0,0 @@
export * from '@xsai/providers'
-1
View File
@@ -1 +0,0 @@
export * from '@xsai/shared-chat'
-1
View File
@@ -1 +0,0 @@
export * from '@xsai/stream-object'
-1
View File
@@ -1 +0,0 @@
export * from '@xsai/stream-text'
-1
View File
@@ -1 +0,0 @@
export * from '@xsai/tool'
-1
View File
@@ -1 +0,0 @@
export * from 'xsai'
+2 -4
View File
@@ -4,9 +4,8 @@
"version": "0.1.0-beta.5",
"private": true,
"scripts": {
"build": "tsx generate-files.ts && next build",
"dev": "tsx generate-files.ts && next dev --turbo",
"generate-files": "tsx generate-files.ts",
"build": "next build",
"dev": "next dev --turbo",
"postinstall": "fumadocs-mdx",
"start": "next start"
},
@@ -19,7 +18,6 @@
"fumadocs-docgen": "^1.3.5",
"fumadocs-mdx": "^11.1.2",
"fumadocs-twoslash": "^3.0.0",
"fumadocs-typescript": "^3.0.3",
"fumadocs-ui": "^15.0.0",
"lucide-react": "^0.474.0",
"next": "15.0.3",
+2 -2
View File
@@ -7,7 +7,6 @@
"repository": "github:moeru-ai/xsai",
"scripts": {
"build": "corepack pnpm -r build",
"build:watch": "corepack pnpm -r build:watch",
"bump": "bumpp",
"docs:dev": "corepack pnpm -rF @xsai/docs dev",
"docs:generate-files": "corepack pnpm -rF @xsai/docs generate-files",
@@ -18,6 +17,7 @@
"@antfu/eslint-config": "^4.1.0",
"@importantimport/eslint-config": "^1.0.0-beta.0",
"@importantimport/tsconfig": "^1.0.0-beta.0",
"@pnpm/find-workspace-dir": "^1000.0.2",
"@types/eslint": "^9.6.1",
"@types/node": "^22.12.0",
"@vitest/coverage-v8": "3.0.4",
@@ -25,7 +25,7 @@
"bumpp": "^10.0.1",
"eslint": "^9.19.0",
"jiti": "^2.4.2",
"pkgroll": "^2.6.1",
"tsup": "^8.3.6",
"tsx": "^4.19.2",
"vitest": "^3.0.4"
}
+13 -10
View File
@@ -18,20 +18,23 @@
"ai"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./src/index.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch",
"build": "tsup",
"test": "vitest run",
"test:watch": "vitest"
},
+13 -10
View File
@@ -18,20 +18,23 @@
"ai"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./src/index.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch",
"build": "tsup",
"test": "vitest run",
"test:watch": "vitest"
},
+13 -10
View File
@@ -18,20 +18,23 @@
"ai"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./src/index.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch",
"build": "tsup",
"test": "vitest run",
"test:watch": "vitest"
},
+13 -10
View File
@@ -18,20 +18,23 @@
"ai"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./src/index.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch",
"build": "tsup",
"test": "vitest run",
"test:watch": "vitest"
},
+13 -10
View File
@@ -18,20 +18,23 @@
"ai"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./src/index.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch",
"build": "tsup",
"test": "vitest run",
"test:watch": "vitest"
},
+13 -10
View File
@@ -18,20 +18,23 @@
"ai"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./src/index.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch",
"build": "tsup",
"test": "vitest run",
"test:watch": "vitest"
},
+18 -12
View File
@@ -19,23 +19,29 @@
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./list": {
"types": "./dist/list.d.ts",
"default": "./dist/list.js"
}
".": "./src/index.ts",
"./list": "./src/list.ts"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./list": {
"types": "./dist/list.d.ts",
"default": "./dist/list.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch"
"build": "tsup"
},
"dependencies": {
"@xsai/shared": "workspace:"
+11
View File
@@ -0,0 +1,11 @@
import { defineConfig } from 'tsup'
import defaults from '../../tsup.config'
export default defineConfig({
...defaults,
entry: [
'src/index.ts',
'src/list.ts',
],
})
+13 -10
View File
@@ -18,20 +18,23 @@
"ai"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./src/index.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch"
"build": "tsup"
},
"dependencies": {
"@xsai/shared": "workspace:"
+13 -10
View File
@@ -14,19 +14,22 @@
"bugs": "https://github.com/moeru-ai/xsai/issues",
"keywords": ["xsai", "openai", "ai"],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./src/index.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch"
"build": "tsup"
}
}
+13 -10
View File
@@ -18,20 +18,23 @@
"ai"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./src/index.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch",
"build": "tsup",
"test": "vitest run",
"test:watch": "vitest"
},
+14 -11
View File
@@ -18,21 +18,24 @@
"ai"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./src/index.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch",
"test": "vitest run --coverage",
"build": "tsup",
"test": "vitest run",
"test:watch": "vitest"
},
"dependencies": {
+13 -10
View File
@@ -18,20 +18,23 @@
"ai"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./src/index.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch",
"build": "tsup",
"test": "vitest run",
"test:watch": "vitest"
},
+13 -10
View File
@@ -18,20 +18,23 @@
"ai"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./src/index.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch"
"build": "tsup"
},
"dependencies": {
"@xsai/shared-chat": "workspace:"
+13 -10
View File
@@ -14,19 +14,22 @@
"bugs": "https://github.com/moeru-ai/xsai/issues",
"keywords": ["xsai", "openai", "ai"],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./src/index.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch"
"build": "tsup"
}
}
+20 -12
View File
@@ -19,23 +19,31 @@
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./providers": {
"types": "./dist/providers.d.ts",
"default": "./dist/providers.js"
}
".": "./src/index.ts",
"./provider": "./src/provider.ts"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./providers": {
"types": "./dist/providers.d.ts",
"default": "./dist/providers.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch"
"build": "tsup",
"test": "vitest run",
"test:watch": "vitest"
},
"dependencies": {
"@xsai/embed": "workspace:",
+11
View File
@@ -0,0 +1,11 @@
import { defineConfig } from 'tsup'
import defaults from '../../tsup.config'
export default defineConfig({
...defaults,
entry: [
'src/index.ts',
'src/providers.ts',
],
})
+13 -10
View File
@@ -17,19 +17,22 @@
"fetch"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./src/index.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch"
"build": "tsup"
}
}
+13 -10
View File
@@ -18,20 +18,23 @@
"typeschema"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./src/index.ts",
"files": [
"dist"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "pkgroll",
"build:watch": "pkgroll --watch"
"build": "tsup"
},
"peerDependencies": {
"@valibot/to-json-schema": "catalog:",
+244 -241
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -2,5 +2,5 @@
"extends": [
"@importantimport/tsconfig/node.json"
],
"include": ["*.config.ts"]
"include": ["**/*.config.ts"]
}
+13
View File
@@ -0,0 +1,13 @@
import { findWorkspaceDir } from '@pnpm/find-workspace-dir'
import { resolve } from 'node:path'
import { cwd } from 'node:process'
import { defineConfig } from 'tsup'
const workspaceDir = await findWorkspaceDir(cwd())
export default defineConfig({
dts: true,
entry: ['src/index.ts'],
format: 'esm',
tsconfig: resolve(workspaceDir!, 'tsconfig.lib.json'),
})