From fbe96ea9f8215a8f374e89326b6fc1980c06eb16 Mon Sep 17 00:00:00 2001 From: GW_MC <72297530+GWMCwing@users.noreply.github.com> Date: Fri, 23 Jan 2026 18:31:16 +0800 Subject: [PATCH] update build process and environment configuration --- .gitignore | 2 ++ ecosystem.config.js | 12 ++++++++++++ package.json | 4 ++-- src/config.ts | 4 +++- 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 ecosystem.config.js diff --git a/.gitignore b/.gitignore index 840b328..51bc292 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ node_modules/ .env +*.env .discord-token.json +build/ diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 0000000..77a25fd --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,12 @@ +module.exports = { + apps: [ + { + name: 'IotDis', + script: './build/index.js', + env: { + NODE_ENV: 'production', + }, + watch: ['./build', './ecosystem.config.js', './.env'], + }, + ], +}; diff --git a/package.json b/package.json index 8d853d4..1bfd0a6 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dev": "tsx src/index.ts", - "build": "tsc src/index.ts --outDir dist --esModuleInterop", - "start": "node dist/index.js" + "build": "tsc src/index.ts --outDir build --esModuleInterop", + "start": "node build/index.js" }, "keywords": [], "author": "", diff --git a/src/config.ts b/src/config.ts index ddf47fe..aad8a3e 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,6 +1,8 @@ import { config as dotenvConfig } from 'dotenv'; -dotenvConfig(); +dotenvConfig({ + path: process.env.NODE_ENV === 'production' ? './.env' : './.dev.env', +}); export const CONFIG: { CLIENT_ID: string;