mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 12:26:13 +00:00
feat: added dev and prod setup using esbuild
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
dist
|
||||||
@@ -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..");
|
||||||
|
});
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"watch": "./src",
|
||||||
|
"verbose": true,
|
||||||
|
"ignore": [".git", "node_modules"],
|
||||||
|
"exec": "node esbuild.config.js && node dist/index.js",
|
||||||
|
"ext": "ts json"
|
||||||
|
}
|
||||||
Generated
+1616
File diff suppressed because it is too large
Load Diff
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
@@ -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