-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c8247e
commit 813c7ca
Showing
24 changed files
with
455 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
permissions: | ||
actions: read | ||
contents: read | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
|
||
- uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
|
||
|
||
# Connect your workspace on nx.app and uncomment this to enable task distribution. | ||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested | ||
# - run: bunx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" | ||
|
||
|
||
- run: bun install --no-cache | ||
- uses: nrwl/nx-set-shas@v4 | ||
|
||
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud | ||
# - run: bun nx-cloud record -- echo Hello World | ||
- run: bun nx affected -t lint test build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
echo "Checking with commitlint...." | ||
bun run commitlint --edit $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
echo "Formatting code...." | ||
bun run format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{ | ||
"recommendations": [ | ||
|
||
"nrwl.angular-console", | ||
"esbenp.prettier-vscode" | ||
"esbenp.prettier-vscode", | ||
"oven.bun-vscode", | ||
"biomejs.biome" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "bun", | ||
"request": "launch", | ||
"name": "Debug Bun", | ||
"program": "${file}", | ||
|
||
// The arguments to pass to the program, if any. | ||
"args": [], | ||
|
||
// The working directory of the program. | ||
"cwd": "${workspaceFolder}", | ||
|
||
// The environment variables to pass to the program. | ||
"env": {}, | ||
|
||
// If the environment variables should not be inherited from the parent process. | ||
"strictEnv": false, | ||
|
||
// If the program should be run in watch mode. | ||
// This is equivalent to passing `--watch` to the `bun` executable. | ||
// You can also set this to "hot" to enable hot reloading using `--hot`. | ||
"watchMode": false, | ||
|
||
// If the debugger should stop on the first line of the program. | ||
"stopOnEntry": false, | ||
|
||
// If the debugger should be disabled. (for example, breakpoints will not be hit) | ||
"noDebug": false, | ||
|
||
// The path to the `bun` executable, defaults to your `PATH` environment variable. | ||
"runtime": "bun", | ||
|
||
// The arguments to pass to the `bun` executable, if any. | ||
// Unlike `args`, these are passed to the executable itself, not the program. | ||
"runtimeArgs": [], | ||
}, | ||
{ | ||
"type": "bun", | ||
"request": "attach", | ||
"name": "Attach to Bun", | ||
// This value can be retrieved by using `bun --inspect`. | ||
"url": "ws://localhost:6499/", | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"bun.runtime": "$HOME/.bun/bin/bun", | ||
"bun.debugTerminal.enabled": true, | ||
"bun.debugTerminal.stopOnEntry": false, | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": "explicit", | ||
"quickfix.biome": "explicit", | ||
"source.organizeImports.biome": "explicit" | ||
}, | ||
"editor.defaultFormatter": "biomejs.biome" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"$schema": "../../node_modules/@biomejs/biome/configuration_schema.json", | ||
"extends": ["../../biome.json"], | ||
"linter": { | ||
"rules": { | ||
"nursery": { | ||
"noRestrictedImports": { | ||
"options": { | ||
"paths": {} | ||
}, | ||
"level": "error" | ||
} | ||
} | ||
} | ||
}, | ||
"overrides": [{}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "bewoak-api", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "apps/bewoak-api/src", | ||
"projectType": "application", | ||
"tags": ["bewoak-api"], | ||
"targets": { | ||
"serve": { | ||
"executor": "@nx/js:node", | ||
"defaultConfiguration": "development", | ||
"options": { | ||
"buildTarget": "bewoak-api:build" | ||
}, | ||
"configurations": { | ||
"development": { | ||
"buildTarget": "bewoak-api:build:development" | ||
}, | ||
"production": { | ||
"buildTarget": "bewoak-api:build:production" | ||
} | ||
} | ||
}, | ||
"lint": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"command": "bun run biome check --write {projectRoot} --config-path={projectRoot}/biome.json" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Test, type TestingModule } from '@nestjs/testing'; | ||
import { beforeAll, describe, expect, test } from 'bun:test'; | ||
|
||
import { AppController } from './app.controller'; | ||
import { AppService } from './app.service'; | ||
|
||
describe('AppController', () => { | ||
let app: TestingModule; | ||
|
||
beforeAll(async () => { | ||
app = await Test.createTestingModule({ | ||
controllers: [AppController], | ||
providers: [AppService], | ||
}).compile(); | ||
}); | ||
|
||
describe('getData', () => { | ||
test('should return "Hello API"', () => { | ||
const appController = app.get<AppController>(AppController); | ||
expect(appController.getData()).toEqual({ message: 'Hello API' }); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Controller, Get, Inject } from '@nestjs/common'; | ||
|
||
import { AppService } from './app.service'; | ||
|
||
@Controller() | ||
export class AppController { | ||
constructor(@Inject(AppService) private readonly appService: AppService) {} | ||
|
||
@Get() | ||
getData() { | ||
return this.appService.getData(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Module } from '@nestjs/common'; | ||
|
||
import { AppController } from './app.controller'; | ||
import { AppService } from './app.service'; | ||
|
||
@Module({ | ||
imports: [], | ||
controllers: [AppController], | ||
providers: [AppService], | ||
}) | ||
export class AppModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Test } from '@nestjs/testing'; | ||
import { beforeAll, describe, expect, test } from 'bun:test'; | ||
|
||
import { AppService } from './app.service'; | ||
|
||
describe('AppService', () => { | ||
let service: AppService; | ||
|
||
beforeAll(async () => { | ||
const app = await Test.createTestingModule({ | ||
providers: [AppService], | ||
}).compile(); | ||
|
||
service = app.get<AppService>(AppService); | ||
}); | ||
|
||
describe('getData', () => { | ||
test('should return "Hello API"', () => { | ||
expect(service.getData()).toEqual({ message: 'Hello API' }); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class AppService { | ||
getData(): { message: string } { | ||
return { message: 'Hello API' }; | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* This is not a production server yet! | ||
* This is only a minimal backend to get started. | ||
*/ | ||
|
||
import { Logger } from '@nestjs/common'; | ||
import { NestFactory } from '@nestjs/core'; | ||
|
||
import { AppModule } from './app/app.module'; | ||
|
||
async function bootstrap() { | ||
const app = await NestFactory.create(AppModule); | ||
const globalPrefix = 'api'; | ||
app.setGlobalPrefix(globalPrefix); | ||
const port = process.env.PORT || 3000; | ||
await app.listen(port); | ||
Logger.log( | ||
`🚀 Application is running on: http://localhost:${port}/${globalPrefix}` | ||
); | ||
} | ||
|
||
bootstrap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"module": "commonjs", | ||
"types": ["node"], | ||
"emitDecoratorMetadata": true, | ||
"target": "es2021", | ||
"strictNullChecks": true, | ||
"noImplicitAny": true, | ||
"strictBindCallApply": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"], | ||
"include": ["src/**/*.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.app.json" | ||
} | ||
], | ||
"compilerOptions": { | ||
"esModuleInterop": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin'); | ||
const { join } = require('node:path'); | ||
|
||
module.exports = { | ||
output: { | ||
path: join(__dirname, '../../dist/apps/bewoak-api'), | ||
}, | ||
plugins: [ | ||
new NxAppWebpackPlugin({ | ||
target: 'node', | ||
compiler: 'swc', | ||
main: './src/main.ts', | ||
tsConfig: './tsconfig.app.json', | ||
assets: ['./src/assets'], | ||
optimization: process.env.BUN_ENV === 'production', | ||
outputHashing: | ||
process.env.BUN_ENV === 'production' ? 'all' : 'none', | ||
}), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json", | ||
"formatter": { | ||
"attributePosition": "auto", | ||
"enabled": true, | ||
"formatWithErrors": false, | ||
"ignore": [ | ||
"dist", | ||
"coverage", | ||
".nx", | ||
".vscode", | ||
"node_modules", | ||
"tmp", | ||
".angular" | ||
], | ||
"indentStyle": "space", | ||
"indentWidth": 4, | ||
"lineEnding": "lf", | ||
"lineWidth": 80 | ||
}, | ||
"linter": { | ||
"enabled": true, | ||
"ignore": [ | ||
"dist", | ||
"coverage", | ||
".nx", | ||
".vscode", | ||
"node_modules", | ||
"tmp", | ||
".angular" | ||
], | ||
"rules": { | ||
"recommended": true, | ||
"suspicious": { | ||
"noConsoleLog": "error" | ||
} | ||
} | ||
}, | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"arrowParentheses": "always", | ||
"attributePosition": "auto", | ||
"bracketSameLine": false, | ||
"bracketSpacing": true, | ||
"jsxQuoteStyle": "double", | ||
"quoteProperties": "asNeeded", | ||
"quoteStyle": "single", | ||
"semicolons": "always", | ||
"trailingCommas": "es5" | ||
}, | ||
"linter": { | ||
"enabled": true | ||
}, | ||
"parser": { | ||
"unsafeParameterDecoratorsEnabled": true | ||
} | ||
}, | ||
"json": { | ||
"parser": { | ||
"allowComments": false, | ||
"allowTrailingCommas": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = { extends: ['@commitlint/config-conventional'] }; |
Oops, something went wrong.