Skip to content

Commit

Permalink
Update Speakers List (#21)
Browse files Browse the repository at this point in the history
* chore: Bakend setup rework (#10)

* chore: Bakend setup rework

* 🐞 fix: Satisfy typescript compiler

* 🔵 other: satisfy linter

* ✨feature: Add CI mode for backend run to test server start in CICD

* 🐞 fix: Esbuild set production env at build time

* 🐞 fix: Make disconnect db only run when db initialized

* 🐞 fix: Make github action not fail on expected timeout

* 🐞 fix: Gh action

* 🐞 fix: gh action

* 🐞 fix: gh action

* 🐞 fix: gh action

* Merge backend rework and ci actions into main (#12)

* chore: Bakend setup rework

* 🐞 fix: Satisfy typescript compiler

* 🔵 other: satisfy linter

* ✨feature: Add CI mode for backend run to test server start in CICD

* 🐞 fix: Esbuild set production env at build time

* 🐞 fix: Make disconnect db only run when db initialized

* 🐞 fix: Make github action not fail on expected timeout

* 🐞 fix: Gh action

* 🐞 fix: gh action

* 🐞 fix: gh action

* 🐞 fix: gh action

* Setup 2 (#13)

* chore: Bakend setup rework

* 🐞 fix: Satisfy typescript compiler

* 🔵 other: satisfy linter

* ✨feature: Add CI mode for backend run to test server start in CICD

* 🐞 fix: Esbuild set production env at build time

* 🐞 fix: Make disconnect db only run when db initialized

* 🐞 fix: Make github action not fail on expected timeout

* 🐞 fix: Gh action

* 🐞 fix: gh action

* 🐞 fix: gh action

* 🐞 fix: gh action

* Setup i18n (#14)

* chore: Bakend setup rework

* 🐞 fix: Satisfy typescript compiler

* 🔵 other: satisfy linter

* ✨feature: Add CI mode for backend run to test server start in CICD

* 🐞 fix: Esbuild set production env at build time

* 🐞 fix: Make disconnect db only run when db initialized

* 🐞 fix: Make github action not fail on expected timeout

* 🐞 fix: Gh action

* 🐞 fix: gh action

* 🐞 fix: gh action

* 🐞 fix: gh action

* 🖥️ wip: Setup i18n solution

* 🐞 fix: Make linter compatible with i18n

* 🐞 fix: Metadata & use Client Directive

* 🐞 fix: Remove harming lines from nested layout.tsx files

* 🐞 temp fix: Metadata, i18n & use Client Directive

* Added TODO i18n support for country names

Co-authored-by: Felix <[email protected]>

---------

Co-authored-by: Felix <[email protected]>
  • Loading branch information
Strehk and m1212e authored Jun 14, 2023
1 parent bd9e5de commit e948e07
Show file tree
Hide file tree
Showing 30 changed files with 2,887 additions and 583 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,11 @@ jobs:
run: npm ci

- name: Run build
run: npm run build
run: npm run build

- name: Run the server
id: run
env:
CI: "true"
run: |
timeout 20s node ./build/main.js || true
2 changes: 0 additions & 2 deletions chase/backend/.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
PORT=3001
SESSION_SECRET=fFcteW8N2d2hMxMvd8EEy8CtDpvXR4cpDMgEE
SERVE_DOCUMENTATION=true
SECURE_COOKIE=false
REDIS_URL=redis://localhost:6379
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres"
90 changes: 47 additions & 43 deletions chase/backend/build.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,62 @@
const { build } = require("esbuild");
const {build} = require("esbuild");
const path = require("path");
const {definePlugin} = require('esbuild-plugin-define');
const fs = require("fs");

const OUTDIR = path.join(__dirname, "build");

// ╔══════════════════════════════╗
// ║ Build the server entry point ║
// ╚══════════════════════════════╝
//TODO document that the built server only correctly registers routes on unix platforms

build({
entryPoints: ["src/main.ts"],
bundle: true,
platform: "node",
minify: true,
outdir: OUTDIR,
}).catch((error) => {
console.error(error);
process.exit(1);
});
const OUTDIR = path.join(__dirname, "build");

// ╔══════════════════╗
// ║ Build each route ║
// ╚══════════════════╝
fs.rmSync(OUTDIR, {recursive: true, force: true});

const routesPath = path.join(__dirname, "src", "routes");
const outputRoutesPath = path.join(OUTDIR, "routes");
/**
* @param {string} dir The start directory to traverse
* @returns An array of files recursively in the start directory
*/
function listFiles(dir) {
let fileArray = [];

function processDirectory(dirPath) {
const files = fs.readdirSync(dirPath);
const files = fs.readdirSync(dir);

files.forEach((file) => {
const filepath = path.join(dirPath, file);
const stats = fs.statSync(filepath);
files.forEach(file => {
const filePath = path.join(dir, file);
const stats = fs.statSync(filePath);

if (stats.isDirectory()) {
processDirectory(filepath);
const subdirectoryFiles = listFiles(filePath); // Recursive call for subdirectories
fileArray = fileArray.concat(subdirectoryFiles);
} else {
const options = {
entryPoints: [filepath],
bundle: true,
platform: "node",
minify: true,
outdir: path.join(
outputRoutesPath,
path.dirname(path.relative(routesPath, filepath)),
),
};

build(options).catch((error) => {
console.error(error);
process.exit(1);
});
fileArray.push(filePath); // Add file path to array
}
});

return fileArray;
}

processDirectory(routesPath);
// ╔══════════════════╗
// ║ Build the server ║
// ╚══════════════════╝

const entryPoints = [path.join(__dirname, "src", "main.ts"), ...listFiles(path.join(__dirname, "src", "routes"))];

build({
entryPoints,
bundle: true,
platform: "node",
format: "cjs",
target: "es2022",
// minify: true,
outdir: OUTDIR,
plugins: [
definePlugin({
process: {
env: {
PRODUCTION: "true",
},
},
}),
]
}).catch((error) => {
console.error(error);
process.exit(1);
});
Loading

0 comments on commit e948e07

Please sign in to comment.