mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
feat: added dev and prod setup using esbuild
This commit is contained in:
1
backend-pg/.gitignore
vendored
Normal file
1
backend-pg/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
dist
|
||||
20
backend-pg/esbuild.config.js
Normal file
20
backend-pg/esbuild.config.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// final prod build
|
||||
const { build } = require("esbuild");
|
||||
|
||||
build({
|
||||
entryPoints: ["./src/app.ts"],
|
||||
minify: true,
|
||||
format: "cjs",
|
||||
platform: "node",
|
||||
target: "node20",
|
||||
bundle: true,
|
||||
outfile: "dist/index.js",
|
||||
plugins: [],
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
})
|
||||
.then(() => {
|
||||
console.log("Finished bundling server..");
|
||||
});
|
||||
7
backend-pg/nodemon.json
Normal file
7
backend-pg/nodemon.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"watch": "./src",
|
||||
"verbose": true,
|
||||
"ignore": [".git", "node_modules"],
|
||||
"exec": "node esbuild.config.js && node dist/index.js",
|
||||
"ext": "ts json"
|
||||
}
|
||||
1616
backend-pg/package-lock.json
generated
Normal file
1616
backend-pg/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
24
backend-pg/package.json
Normal file
24
backend-pg/package.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "backend-pg",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"build": "node esbuild.config.js",
|
||||
"dev": "nodemon"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.9.1",
|
||||
"esbuild": "^0.19.5",
|
||||
"nodemon": "^3.0.1",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"fastify": "^4.24.3",
|
||||
"ora": "^7.0.1"
|
||||
}
|
||||
}
|
||||
22
backend-pg/src/app.ts
Normal file
22
backend-pg/src/app.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import Fasitfy from "fastify";
|
||||
|
||||
const fastify = Fasitfy({
|
||||
logger: true,
|
||||
});
|
||||
|
||||
// Declare a route
|
||||
fastify.get("/", async function handler(_request, _reply) {
|
||||
return { hello: "world changed" };
|
||||
});
|
||||
|
||||
// Run the server!
|
||||
const main = async () => {
|
||||
try {
|
||||
await fastify.listen({ port: 8000 });
|
||||
} catch (err) {
|
||||
fastify.log.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
main();
|
||||
31
backend-pg/tsconfig.json
Normal file
31
backend-pg/tsconfig.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"allowJs": true,
|
||||
"removeComments": true,
|
||||
"resolveJsonModule": true,
|
||||
"typeRoots": [
|
||||
"./node_modules/@types"
|
||||
],
|
||||
"sourceMap": true,
|
||||
"outDir": "dist",
|
||||
"strict": true,
|
||||
"lib": [
|
||||
"esnext"
|
||||
],
|
||||
"baseUrl": ".",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"moduleResolution": "Node",
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user