Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add durian.js #7751

Merged
merged 9 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions javascript/durian.js/cluster.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { bootstrap } from "./src/app";

bootstrap();
8 changes: 8 additions & 0 deletions javascript/durian.js/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
framework:
github: mario-huang/durian.js
version: 1.0.0
waghanza marked this conversation as resolved.
Show resolved Hide resolved
engines:
- bun

bootstrap:
- bun install
5 changes: 5 additions & 0 deletions javascript/durian.js/nest-cli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"entryFile": "app"
}
37 changes: 37 additions & 0 deletions javascript/durian.js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "durian.js",
"version": "1.0.0",
"description": "Run NestJS on Bun Blazingly Fast",
"author": "mario-huang",
"license": "MIT",
"keywords": [
"durian",
"durianjs",
"nest",
"nestjs",
"bun"
],
"scripts": {
"build": "durian build",
"start": "durian start",
"start:debug": "durian start:debug",
"start:dev": "durian start:dev",
"start:prod": "durian start:prod",
"compile": "durian compile",
"compile:linux-x64": "durian compile:linux-x64",
"compile:linux-arm64": "durian compile:linux-arm64",
"compile:windows-x64": "durian compile:windows-x64",
"compile:darwin-x64": "durian compile:darwin-x64",
"compile:darwin-arm64": "durian compile:darwin-arm64",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "durian test",
"test:watch": "durian test:watch",
"test:cov": "durian test:cov",
"test:debug": "durian test:debug",
"test:e2e": "durian test:e2e"
},
"dependencies": {
"durian.js": "~1.0.0"
}
}
19 changes: 19 additions & 0 deletions javascript/durian.js/src/app.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Controller, Get, Param, Post } from "@nestjs/common";

@Controller()
export class AppController {
@Get()
getHello(): string {
return "";
}

@Get("/user/:id")
getUserId(@Param("id") id: string): string {
return id;
}

@Post("/user")
postUser(): string {
return "";
}
}
9 changes: 9 additions & 0 deletions javascript/durian.js/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Module } from "@nestjs/common";
import { AppController } from "./app.controller";

@Module({
imports: [],
controllers: [AppController],
providers: [],
})
export class AppModule {}
9 changes: 9 additions & 0 deletions javascript/durian.js/src/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";

export async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(3000);
}


31 changes: 31 additions & 0 deletions javascript/durian.js/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"compilerOptions": {
/* nestjs */
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
/* bun */
// Enable latest features
"lib": ["ESNext"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
// Some stricter flags
"noUnusedLocals": true,
"noUnusedParameters": true,
"noPropertyAccessFromIndexSignature": true
}
}
Loading