Skip to content

Commit

Permalink
chore: 修改wrangler直接部署脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
TBXark committed Nov 14, 2024
1 parent 061a0d4 commit 384de4b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"author": "tbxark <[email protected]>",
"license": "MIT",
"repository": "[email protected]:TBXark/ChatGPT-Telegram-Workers.git",
"main": "./packages/lib/core/dist/index.js",
"module": "./packages/lib/core/dist/index.js",
"types": "./packages/lib/core/dist/index.d.ts",
"scripts": {
"lint": "eslint --fix *.js *.ts packages plugins scripts",
"version": "tsx scripts/gen-version.ts",
Expand All @@ -21,6 +24,8 @@
"build:dockerx": "pnpm -r run build:all && docker buildx build --platform linux/amd64,linux/arm64 -t chatgpt-telegram-workers:latest .",
"build:dist": "pnpm run version && pnpm -r run build:all && cp -r packages/apps/workers/dist/* dist/",
"deploy:dist": "pnpm run build:dist && wrangler deploy",
"deploy:workers": "TOML_PATH=$INIT_CWD/wrangler.toml pnpm run --filter @chatgpt-telegram-workers/workers deploy",
"deploy:workersnext": "TOML_PATH=$INIT_CWD/wrangler.toml pnpm run --filter @chatgpt-telegram-workers/workers-next deploy",
"start:local": "CONFIG_PATH=$INIT_CWD/config.json TOML_PATH=$INIT_CWD/wrangler.toml pnpm run --filter @chatgpt-telegram-workers/local start",
"clean": "pnpm -r run clean",
"wrangler": "wrangler"
Expand Down
3 changes: 2 additions & 1 deletion packages/apps/workers-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"types": "./dist/index.d.ts",
"scripts": {
"build": "pnpm vite build",
"clean": "rm -rf dist"
"clean": "rm -rf dist",
"deploy": "wrangler deploy --config=${TOML_PATH}"
},
"dependencies": {
"@chatgpt-telegram-workers/core": "workspace:*",
Expand Down
3 changes: 2 additions & 1 deletion packages/apps/workers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"types": "./dist/index.d.ts",
"scripts": {
"build": "pnpm vite build",
"clean": "rm -rf dist"
"clean": "rm -rf dist",
"deploy": "wrangler deploy --config=${TOML_PATH}"
},
"dependencies": {
"@chatgpt-telegram-workers/core": "workspace:*"
Expand Down
6 changes: 0 additions & 6 deletions vite.config.shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ export function createShareConfig(options: Options): UserConfig {
},
minify: false,
outDir: path.resolve(options.root, 'dist'),
rollupOptions: {
external: [],
output: {
preserveModules: false,
},
},
},
});
}
10 changes: 7 additions & 3 deletions wrangler-example.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# 这里的 name 改成你自己的workers 的名字
name = 'chatgpt-telegram-workers'
compatibility_date = '2023-10-07'
main = './dist/index.js' # 先使用vite编译 然后再使用编译产物部署
#main = './src/entry/core/gen-vercel-env.ts' # 直接编译core 不使用vite编译
#main = './src/entry/next/gen-vercel-env.ts' # 直接编译实现性质的版本
main = './dist/index.js' # 先使用vite编译 然后再使用编译产物部署

# 修改 main = './dist/index.js' 为对应模块index.ts
# 然后在对应目录下执行 pnpm run deploy:workers 或者 pnpm run deploy:workersnext
# 即可直接使用wrangler编译部署,不使用vite编译
#main = './packages/apps/workers/src/index.ts'
#main = './packages/apps/workers-next/src/index.ts'

workers_dev = true
compatibility_flags = [ "nodejs_compat" ]
Expand Down

0 comments on commit 384de4b

Please sign in to comment.