Skip to content

Commit

Permalink
chore: Use tsup for building backend
Browse files Browse the repository at this point in the history
  • Loading branch information
mohebifar committed Dec 22, 2024
1 parent 2acd600 commit abafd53
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 19 deletions.
2 changes: 1 addition & 1 deletion apps/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ WORKDIR /app
COPY --from=installer /app/apps/backend ./apps/backend
COPY --from=installer /app/packages/database ./packages/database

CMD cd packages/database && pnpm dlx prisma@latest migrate deploy && cd - && node apps/backend/build/index.js
CMD node apps/backend/build/index.js
2 changes: 1 addition & 1 deletion apps/backend/esbuild.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ esbuild
minify: false,
platform: "node",
outfile: "build/index.js",
format: "esm",
format: "cjs",
})
.catch(() => process.exit(1));
1 change: 1 addition & 0 deletions apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"nodemon": "3.0.2",
"supertest": "catalog:",
"ts-node": "10.9.2",
"tsup": "^8.3.5",
"tsx": "^4.7.1",
"vitest": "1.1.0"
},
Expand Down
2 changes: 0 additions & 2 deletions apps/backend/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import "dotenv/config";

import { startCronJobs } from "./cron.js";
import { runServer } from "./server.js";

Expand Down
15 changes: 15 additions & 0 deletions apps/backend/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from "tsup";

export default defineConfig({
entryPoints: ["src/index.ts"],
format: ["cjs"],
dts: false,
sourcemap: true,
clean: true,
minify: false,
splitting: false,
target: "node20",
bundle: true,
outDir: "build",
noExternal: [/(.*)/],
});
Loading

0 comments on commit abafd53

Please sign in to comment.