added packages into dockploy 5

This commit is contained in:
2026-09-10 17:51:37 +03:30
parent 69017e785e
commit 24c24e03fb
6 changed files with 9608 additions and 2 deletions
+3 -1
View File
@@ -4,10 +4,12 @@ import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { json, urlencoded } from 'express';
import { AppModule } from './app.module';
import { applyPendingMigrations } from './apply-migrations';
import { runBundledSeed } from './run-seed';
async function bootstrap() {
if (process.env.NODE_ENV === 'production') {
await applyPendingMigrations();
await runBundledSeed();
}
const app = await NestFactory.create(AppModule);
@@ -42,7 +44,7 @@ async function bootstrap() {
const document = SwaggerModule.createDocument(app, swaggerConfig);
SwaggerModule.setup(`${globalPrefix}/docs`, app, document);
const port = process.env.PORT ?? 3000;
const port = Number(process.env.PORT) || 3000;
await app.listen(port);
console.log(
`Fabric Trade API listening on http://localhost:${port}/${globalPrefix}`,
+23
View File
@@ -0,0 +1,23 @@
import { existsSync } from 'node:fs'
import { spawn } from 'node:child_process'
import path from 'node:path'
export function runBundledSeed(): Promise<void> {
const seedFile = path.join(process.cwd(), 'runtime', 'seed.cjs')
if (!existsSync(seedFile)) {
console.log('No runtime/seed.cjs; skipping seed')
return Promise.resolve()
}
return new Promise((resolve, reject) => {
const child = spawn(process.execPath, [seedFile], {
stdio: 'inherit',
env: process.env,
})
child.on('exit', (code) => {
if (code === 0) resolve()
else reject(new Error(`seed exited ${code}`))
})
child.on('error', reject)
})
}