Skip to content

Commit a49e867

Browse files
committed
Merge remote-tracking branch 'origin/master' into renovate/major-9-dotnet-monorepo
2 parents 488f94d + 275d2d8 commit a49e867

File tree

9 files changed

+142
-1
lines changed

9 files changed

+142
-1
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ jobs:
1212
fetch-depth: 0
1313
- id: file_changes
1414
uses: trilom/[email protected]
15-
steps:
1615
- uses: actions/checkout@v4
1716
- uses: ruby/setup-ruby@v1
1817
with:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import cluster from 'cluster';
2+
import os from 'node:os';
3+
import { bootstrap } from './src/app';
4+
5+
if (cluster.isPrimary) {
6+
console.log(`Master ${process.pid} is running`);
7+
for (let i = 0; i < os.cpus().length; i++) {
8+
cluster.fork();
9+
}
10+
cluster.on('exit', (worker, code, signal) => {
11+
console.log(`Worker ${worker.process.pid} died with code ${code} and signal ${signal}`);
12+
console.log('Starting a new worker...');
13+
cluster.fork();
14+
});
15+
} else {
16+
bootstrap();
17+
console.log(`Worker ${process.pid} started`);
18+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
framework:
2+
github: mario-huang/durian.js
3+
version: 1.0
4+
engines:
5+
- bun
6+
bootstrap:
7+
- bun install
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"collection": "@nestjs/schematics",
3+
"sourceRoot": "src",
4+
"entryFile": "app"
5+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "durian.js",
3+
"version": "1.0.0",
4+
"description": "Run NestJS on Bun Blazingly Fast",
5+
"author": "mario-huang",
6+
"license": "MIT",
7+
"keywords": [
8+
"durian",
9+
"durianjs",
10+
"nest",
11+
"nestjs",
12+
"bun"
13+
],
14+
"scripts": {
15+
"build": "durian build",
16+
"start": "durian start",
17+
"start:debug": "durian start:debug",
18+
"start:dev": "durian start:dev",
19+
"start:prod": "durian start:prod",
20+
"compile": "durian compile",
21+
"compile:linux-x64": "durian compile:linux-x64",
22+
"compile:linux-arm64": "durian compile:linux-arm64",
23+
"compile:windows-x64": "durian compile:windows-x64",
24+
"compile:darwin-x64": "durian compile:darwin-x64",
25+
"compile:darwin-arm64": "durian compile:darwin-arm64",
26+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
27+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
28+
"test": "durian test",
29+
"test:watch": "durian test:watch",
30+
"test:cov": "durian test:cov",
31+
"test:debug": "durian test:debug",
32+
"test:e2e": "durian test:e2e"
33+
},
34+
"dependencies": {
35+
"durian.js": "~1.0.0",
36+
"@nestjs/platform-fastify": "~10.4.0"
37+
}
38+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Controller, Get, Param, Post } from "@nestjs/common";
2+
3+
@Controller()
4+
export class AppController {
5+
@Get()
6+
getHello(): string {
7+
return "";
8+
}
9+
10+
@Get("/user/:id")
11+
getUserId(@Param("id") id: string): string {
12+
return id;
13+
}
14+
15+
@Post("/user")
16+
postUser(): string {
17+
return "";
18+
}
19+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Module } from "@nestjs/common";
2+
import { AppController } from "./app.controller";
3+
4+
@Module({
5+
imports: [],
6+
controllers: [AppController],
7+
providers: [],
8+
})
9+
export class AppModule {}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { NestFactory } from "@nestjs/core";
2+
import {
3+
FastifyAdapter,
4+
NestFastifyApplication,
5+
} from "@nestjs/platform-fastify";
6+
import { AppModule } from "./app.module";
7+
8+
export async function bootstrap() {
9+
const app = await NestFactory.create<NestFastifyApplication>(
10+
AppModule,
11+
new FastifyAdapter()
12+
);
13+
await app.listen(3000, "0.0.0.0");
14+
}
15+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"compilerOptions": {
3+
/* nestjs */
4+
"removeComments": true,
5+
"emitDecoratorMetadata": true,
6+
"experimentalDecorators": true,
7+
"allowSyntheticDefaultImports": true,
8+
"forceConsistentCasingInFileNames": true,
9+
/* bun */
10+
// Enable latest features
11+
"lib": ["ESNext"],
12+
"target": "ESNext",
13+
"module": "ESNext",
14+
"moduleDetection": "force",
15+
"jsx": "react-jsx",
16+
"allowJs": true,
17+
// Bundler mode
18+
"moduleResolution": "bundler",
19+
"allowImportingTsExtensions": true,
20+
"verbatimModuleSyntax": true,
21+
"noEmit": true,
22+
// Best practices
23+
"strict": true,
24+
"skipLibCheck": true,
25+
"noFallthroughCasesInSwitch": true,
26+
// Some stricter flags
27+
"noUnusedLocals": true,
28+
"noUnusedParameters": true,
29+
"noPropertyAccessFromIndexSignature": true
30+
}
31+
}

0 commit comments

Comments
 (0)