update build process and environment configuration

This commit is contained in:
GW_MC
2026-01-23 18:31:16 +08:00
parent e782c5d8ac
commit fbe96ea9f8
4 changed files with 19 additions and 3 deletions

2
.gitignore vendored
View File

@@ -1,3 +1,5 @@
node_modules/ node_modules/
.env .env
*.env
.discord-token.json .discord-token.json
build/

12
ecosystem.config.js Normal file
View File

@@ -0,0 +1,12 @@
module.exports = {
apps: [
{
name: 'IotDis',
script: './build/index.js',
env: {
NODE_ENV: 'production',
},
watch: ['./build', './ecosystem.config.js', './.env'],
},
],
};

View File

@@ -6,8 +6,8 @@
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"dev": "tsx src/index.ts", "dev": "tsx src/index.ts",
"build": "tsc src/index.ts --outDir dist --esModuleInterop", "build": "tsc src/index.ts --outDir build --esModuleInterop",
"start": "node dist/index.js" "start": "node build/index.js"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",

View File

@@ -1,6 +1,8 @@
import { config as dotenvConfig } from 'dotenv'; import { config as dotenvConfig } from 'dotenv';
dotenvConfig(); dotenvConfig({
path: process.env.NODE_ENV === 'production' ? './.env' : './.dev.env',
});
export const CONFIG: { export const CONFIG: {
CLIENT_ID: string; CLIENT_ID: string;