generated from tailored/app-template
feat: add deploy for ai-provider
This commit is contained in:
parent
a225bd4f16
commit
ac207ff374
28
bun.config.mjs
Normal file
28
bun.config.mjs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// @ts-check
|
||||||
|
// https://bun.sh/docs/bundler
|
||||||
|
// @ts-ignore
|
||||||
|
import pkg from './package.json';
|
||||||
|
import { rollup } from 'rollup';
|
||||||
|
import rollupConfig from './rollup.config.mjs';
|
||||||
|
|
||||||
|
// bun run src/index.ts --
|
||||||
|
await Bun.build({
|
||||||
|
target: 'node',
|
||||||
|
format: 'esm',
|
||||||
|
entrypoints: ['./src/provider/index.ts'],
|
||||||
|
outdir: './dist',
|
||||||
|
naming: {
|
||||||
|
entry: 'ai-provider.mjs',
|
||||||
|
},
|
||||||
|
|
||||||
|
define: {
|
||||||
|
ENVISION_VERSION: JSON.stringify(pkg.version),
|
||||||
|
},
|
||||||
|
env: 'ENVISION_*',
|
||||||
|
});
|
||||||
|
|
||||||
|
// Rollup build for the CLI
|
||||||
|
const rollupBundle = await rollup(rollupConfig);
|
||||||
|
rollupBundle.write({
|
||||||
|
file: 'dist/ai-provider.d.ts',
|
||||||
|
});
|
68
package.json
68
package.json
@ -4,64 +4,66 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"watch": "rollup -c rollup.config.mjs -w",
|
"build": "npm run clean && bun bun.config.mjs",
|
||||||
"build": "rollup -c rollup.config.mjs",
|
"dev": "bun run --watch bun.config.mjs",
|
||||||
"dev": "cross-env NODE_ENV=development nodemon --delay 2.5 -e js,cjs,mjs --exec node dist/app.mjs",
|
|
||||||
"test": "tsx test/**/*.ts",
|
"test": "tsx test/**/*.ts",
|
||||||
"dev:watch": "cross-env NODE_ENV=development concurrently -n \"Watch,Dev\" -c \"green,blue\" \"npm run watch\" \"sleep 1 && npm run dev\" ",
|
|
||||||
"clean": "rm -rf dist",
|
"clean": "rm -rf dist",
|
||||||
"prepub": "envision switch root",
|
"pub": "envision pack -p -u"
|
||||||
"pub": "npm run build && envision pack -p -u"
|
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"packageManager": "pnpm@10.7.1",
|
"packageManager": "pnpm@10.9.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"publishConfig": {
|
||||||
|
"registry": "https://registry.npmjs.org/",
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./dist/ai-provider.mjs",
|
||||||
|
"types": "./dist/ai-provider.d.ts"
|
||||||
|
},
|
||||||
|
"./ai-provider": {
|
||||||
|
"import": "./dist/ai-provider.mjs",
|
||||||
|
"types": "./dist/ai-provider.d.ts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"dependencies": {},
|
||||||
|
"devDependencies": {
|
||||||
"@kevisual/code-center-module": "0.0.18",
|
"@kevisual/code-center-module": "0.0.18",
|
||||||
"@kevisual/mark": "0.0.7",
|
"@kevisual/mark": "0.0.7",
|
||||||
"@kevisual/router": "0.0.10",
|
"@kevisual/router": "0.0.13",
|
||||||
"cookie": "^1.0.2",
|
"cookie": "^1.0.2",
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"formidable": "^3.5.2",
|
"formidable": "^3.5.4",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"openai": "^4.91.1"
|
"openai": "^4.96.0",
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@kevisual/types": "^0.0.6",
|
"@kevisual/types": "^0.0.6",
|
||||||
"@kevisual/use-config": "^1.0.10",
|
"@kevisual/use-config": "^1.0.11",
|
||||||
"@rollup/plugin-alias": "^5.1.1",
|
"@types/bun": "^1.2.10",
|
||||||
"@rollup/plugin-commonjs": "^28.0.3",
|
|
||||||
"@rollup/plugin-json": "^6.1.0",
|
|
||||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
||||||
"@rollup/plugin-replace": "^6.0.2",
|
|
||||||
"@rollup/plugin-typescript": "^12.1.2",
|
|
||||||
"@types/crypto-js": "^4.2.2",
|
"@types/crypto-js": "^4.2.2",
|
||||||
"@types/formidable": "^3.4.5",
|
"@types/formidable": "^3.4.5",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/node": "^22.14.0",
|
"@types/node": "^22.15.2",
|
||||||
"@vitejs/plugin-basic-ssl": "^2.0.0",
|
"@vitejs/plugin-basic-ssl": "^2.0.0",
|
||||||
"concurrently": "^9.1.2",
|
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"dotenv": "^16.4.7",
|
"dotenv": "^16.5.0",
|
||||||
"ioredis": "^5.6.0",
|
"ioredis": "^5.6.1",
|
||||||
"jsrepo": "^1.45.3",
|
|
||||||
"nodemon": "^3.1.9",
|
|
||||||
"pino": "^9.6.0",
|
"pino": "^9.6.0",
|
||||||
"pm2": "^6.0.5",
|
"pm2": "^6.0.5",
|
||||||
"rimraf": "^6.0.1",
|
"rimraf": "^6.0.1",
|
||||||
"rollup": "^4.39.0",
|
"rollup": "^4.40.0",
|
||||||
"rollup-plugin-copy": "^3.5.0",
|
|
||||||
"rollup-plugin-dts": "^6.2.1",
|
"rollup-plugin-dts": "^6.2.1",
|
||||||
"rollup-plugin-esbuild": "^6.2.1",
|
|
||||||
"sequelize": "^6.37.7",
|
"sequelize": "^6.37.7",
|
||||||
"tape": "^5.9.0",
|
"tape": "^5.9.0",
|
||||||
"tiktoken": "^1.0.20",
|
"tiktoken": "^1.0.21",
|
||||||
"tsx": "^4.19.3",
|
"typescript": "^5.8.3",
|
||||||
"typescript": "^5.8.2",
|
"vite": "^6.3.3"
|
||||||
"vite": "^6.2.5"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
2017
pnpm-lock.yaml
generated
2017
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1,75 +1,9 @@
|
|||||||
import resolve from '@rollup/plugin-node-resolve';
|
import dts from 'rollup-plugin-dts';
|
||||||
import commonjs from '@rollup/plugin-commonjs';
|
|
||||||
import json from '@rollup/plugin-json';
|
|
||||||
import path from 'path';
|
|
||||||
import esbuild from 'rollup-plugin-esbuild';
|
|
||||||
import alias from '@rollup/plugin-alias';
|
|
||||||
import replace from '@rollup/plugin-replace';
|
|
||||||
import pkgs from './package.json' with {type: 'json'};
|
|
||||||
|
|
||||||
const isDev = process.env.NODE_ENV === 'development';
|
export default {
|
||||||
const input = isDev ? './src/dev.ts' : './src/index.ts';
|
input: 'src/provider/index.ts',
|
||||||
/**
|
|
||||||
* @type {import('rollup').RollupOptions}
|
|
||||||
*/
|
|
||||||
const config = {
|
|
||||||
input,
|
|
||||||
output: {
|
output: {
|
||||||
dir: './dist',
|
file: 'dist/ai-provider.d.ts',
|
||||||
entryFileNames: 'app.mjs',
|
|
||||||
chunkFileNames: '[name]-[hash].mjs',
|
|
||||||
format: 'esm',
|
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [dts()],
|
||||||
replace({
|
|
||||||
preventAssignment: true, // 防止意外赋值
|
|
||||||
DEV_SERVER: JSON.stringify(isDev), // 替换 process.env.NODE_ENV
|
|
||||||
VERSION: JSON.stringify(pkgs.version),
|
|
||||||
}),
|
|
||||||
alias({
|
|
||||||
// only esbuild needs to be configured
|
|
||||||
entries: [
|
|
||||||
{ find: '@', replacement: path.resolve('src') }, // 配置 @ 为 src 目录
|
|
||||||
{ find: 'http', replacement: 'node:http' },
|
|
||||||
{ find: 'https', replacement: 'node:https' },
|
|
||||||
{ find: 'fs', replacement: 'node:fs' },
|
|
||||||
{ find: 'path', replacement: 'node:path' },
|
|
||||||
{ find: 'crypto', replacement: 'node:crypto' },
|
|
||||||
{ find: 'zlib', replacement: 'node:zlib' },
|
|
||||||
{ find: 'stream', replacement: 'node:stream' },
|
|
||||||
{ find: 'net', replacement: 'node:net' },
|
|
||||||
{ find: 'tty', replacement: 'node:tty' },
|
|
||||||
{ find: 'tls', replacement: 'node:tls' },
|
|
||||||
{ find: 'buffer', replacement: 'node:buffer' },
|
|
||||||
{ find: 'timers', replacement: 'node:timers' },
|
|
||||||
// { find: 'string_decoder', replacement: 'node:string_decoder' },
|
|
||||||
{ find: 'dns', replacement: 'node:dns' },
|
|
||||||
{ find: 'domain', replacement: 'node:domain' },
|
|
||||||
{ find: 'os', replacement: 'node:os' },
|
|
||||||
{ find: 'events', replacement: 'node:events' },
|
|
||||||
{ find: 'url', replacement: 'node:url' },
|
|
||||||
{ find: 'assert', replacement: 'node:assert' },
|
|
||||||
{ find: 'util', replacement: 'node:util' },
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
resolve({
|
|
||||||
preferBuiltins: true, // 强制优先使用内置模块
|
|
||||||
}),
|
|
||||||
commonjs(),
|
|
||||||
esbuild({
|
|
||||||
target: 'node22', //
|
|
||||||
minify: false, // 启用代码压缩
|
|
||||||
tsconfig: 'tsconfig.json',
|
|
||||||
}),
|
|
||||||
json(),
|
|
||||||
],
|
|
||||||
external: [
|
|
||||||
/@kevisual\/router(\/.*)?/, //, // 路由
|
|
||||||
/@kevisual\/use-config(\/.*)?/, //
|
|
||||||
|
|
||||||
// 'sequelize', // 数据库 orm
|
|
||||||
// 'ioredis', // redis
|
|
||||||
// 'pg', // pg
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
export default config;
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user