fix
This commit is contained in:
@@ -85,7 +85,7 @@ The default deploy flow is:
|
||||
|
||||
```sh
|
||||
git pull --ff-only
|
||||
npm install --include=dev
|
||||
npm install --production=false --include=dev --omit=optional
|
||||
npm run build
|
||||
pm2 reload tssbot-web --update-env
|
||||
```
|
||||
@@ -94,6 +94,13 @@ Only processes listed in `PM2_RESTART_TARGETS` are reloaded. The default is
|
||||
`tssbot-web`, so unrelated PM2 processes are left alone. The webhook exits after
|
||||
24 hours so PM2 restarts it cleanly.
|
||||
|
||||
When webhook code changes are deployed, restart the webhook process once so PM2
|
||||
loads the updated listener:
|
||||
|
||||
```sh
|
||||
pm2 reload tssbot-webhook --update-env
|
||||
```
|
||||
|
||||
The webhook listener reads `.env` on startup. To send a Discord notification
|
||||
whenever the listener starts or restarts, set:
|
||||
|
||||
|
||||
+18
-5
@@ -97,6 +97,23 @@ function run(command, args, options = {}) {
|
||||
})
|
||||
}
|
||||
|
||||
async function ensureBuildDependencies() {
|
||||
await run('npm', ['install', '--production=false', '--include=dev', '--omit=optional'], {
|
||||
env: {
|
||||
NODE_ENV: 'development',
|
||||
npm_config_include: 'dev',
|
||||
npm_config_omit: 'optional',
|
||||
npm_config_production: 'false',
|
||||
},
|
||||
})
|
||||
|
||||
try {
|
||||
require.resolve('@vitejs/plugin-react')
|
||||
} catch {
|
||||
throw new Error('@vitejs/plugin-react is missing after npm install; dev dependencies were not installed')
|
||||
}
|
||||
}
|
||||
|
||||
function postDiscordWebhook(payload) {
|
||||
if (!DISCORD_WEBHOOK_URL) return Promise.resolve()
|
||||
|
||||
@@ -162,11 +179,7 @@ function notifyDiscordRestart() {
|
||||
|
||||
async function deploy() {
|
||||
await run('git', ['pull', '--ff-only'])
|
||||
await run('npm', ['install', '--include=dev'], {
|
||||
env: {
|
||||
npm_config_production: 'false',
|
||||
},
|
||||
})
|
||||
await ensureBuildDependencies()
|
||||
await run('npm', ['run', 'build'])
|
||||
|
||||
for (const target of RESTART_TARGETS) {
|
||||
|
||||
Reference in New Issue
Block a user