master
well 2025-03-11 09:22:09 +08:00
parent e1dbfb010d
commit d385cce944
25 changed files with 3860 additions and 387 deletions

56
apps/nestapp/.gitignore vendored 100644
View File

@ -0,0 +1,56 @@
# compiled output
/dist
/node_modules
/build
# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# OS
.DS_Store
# Tests
/coverage
/.nyc_output
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# temp directory
.temp
.tmp
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

View File

@ -0,0 +1,2 @@
import config from '@3rapp/core/prettierrc';
export default config;

View File

@ -0,0 +1,23 @@
public
node_modules
ui
pnpm-lock.yaml
package-lock.json
docker
Dockerfile*
LICENSE
yarn-error.log
.next
.history
.dockerignore
.DS_Store
.eslintignore
.editorconfig
.gitignore
.prettierignore
.eslintcache
*.lock
*.png
*.eot
*.ttf
*.woff

View File

@ -0,0 +1,98 @@
<p align="center">
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
</p>
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
</p>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
## Description
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
## Project setup
```bash
$ pnpm install
```
## Compile and run the project
```bash
# development
$ pnpm run start
# watch mode
$ pnpm run start:dev
# production mode
$ pnpm run start:prod
```
## Run tests
```bash
# unit tests
$ pnpm run test
# e2e tests
$ pnpm run test:e2e
# test coverage
$ pnpm run test:cov
```
## Deployment
When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.
If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:
```bash
$ pnpm install -g mau
$ mau deploy
```
With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.
## Resources
Check out a few resources that may come in handy when working with NestJS:
- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
## Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
## Stay in touch
- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
- Website - [https://nestjs.com](https://nestjs.com/)
- Twitter - [@nestframework](https://twitter.com/nestframework)
## License
Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).

View File

@ -0,0 +1,2 @@
import eslint from '@3rapp/core/eslintrc';
export default eslint;

View File

@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"deleteOutDir": true
}
}

View File

@ -0,0 +1,75 @@
{
"name": "nestapp",
"version": "0.0.1",
"private": true,
"description": "",
"author": "",
"license": "UNLICENSED",
"scripts": {
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@3rapp/utils": "workspace:*",
"@nestjs/common": "^11.0.1",
"@nestjs/core": "^11.0.1",
"@nestjs/platform-fastify": "^11.0.11",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.1"
},
"devDependencies": {
"@3rapp/core": "workspace:*",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.18.0",
"@nestjs/cli": "^11.0.0",
"@nestjs/schematics": "^11.0.0",
"@nestjs/testing": "^11.0.1",
"@swc/cli": "^0.6.0",
"@swc/core": "^1.10.7",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.7",
"@types/supertest": "^6.0.2",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-prettier": "^5.2.2",
"globals": "^16.0.0",
"jest": "^29.7.0",
"prettier": "^3.4.2",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
"ts-jest": "^29.2.5",
"ts-loader": "^9.5.2",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.7.3",
"typescript-eslint": "^8.20.0"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}

View File

@ -0,0 +1,8 @@
http://60.204.131.99:3000/ : suimeng;da-hong-pao@hotmail.com;psd : sd7-9Pqm!rY8RJP
http://60.204.131.99:3000/admin/applications/oauth2
clientID: 16cb0878-d368-4d5d-87ee-5e5bc8deb576
clientSecret: gto_4fcki6zo5p3z7xc77s5cjk4luhwr257pimxctjl5ekojf4nh4cva

View File

@ -0,0 +1,15 @@
import { Controller, Get, Req, UseGuards } from '@nestjs/common';
import { RolesGuard } from './app.roles.guard';
import { AppService } from './app.service';
@Controller()
@UseGuards(RolesGuard)
export class AppController {
constructor(private readonly appService: AppService) {}
@Get()
getHello(@Req() req: any) {
return `${this.appService.getHello()}${req.count}`;
}
}

View File

@ -0,0 +1,19 @@
import { DynamicModule, Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
@Module({
imports: [],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {
static forRoot(): DynamicModule {
return {
module: AppModule,
providers: [AppService],
controllers: [AppController],
};
}
}

View File

@ -0,0 +1,9 @@
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';
import { Observable } from 'rxjs';
@Injectable()
export class RolesGuard implements CanActivate {
canActivate(context: ExecutionContext): boolean | Promise<boolean> | Observable<boolean> {
return true;
}
}

View File

@ -0,0 +1,8 @@
import { Injectable } from '@nestjs/common';
@Injectable()
export class AppService {
getHello(): string {
return 'Hello World!';
}
}

View File

@ -0,0 +1,44 @@
version: "3.9"
services:
drone:
image: drone/drone:2
volumes:
- /data/drone:/data
- /var/run/docker.sock:/var/run/docker.sock
restart: always
ports:
- 8000:80
networks:
- cicd_net
environment:
- DRONE_GITEA_SERVER=http://60.204.131.99:3000
- DRONE_GITEA_CLIENT_ID=16cb0878-d368-4d5d-87ee-5e5bc8deb576
- DRONE_GITEA_CLIENT_SECRET=gto_4fcki6zo5p3z7xc77s5cjk4luhwr257pimxctjl5ekojf4nh4cva
- DRONE_RPC_SECRET=b4d49500d9b90769d51883fea0c697ff
- DRONE_SERVER_HOST=http://60.204.131.99:8000
- DRONE_SERVER_PROTO=https
- DRONE_TLS_AUTOCERT=false
- DRONE_USER_CREATE=username:suimeng,admin:true
drone-runner:
image: drone/drone-runner-docker:1
restart: always
depends_on:
- drone
ports:
- 3333:3000
networks:
- cicd_net
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- DRONE_RPC_PROTO=http
- DRONE_RPC_HOST=drone
- DRONE_RPC_SECRET="b4d49500d9b90769d51883fea0c697ff"
- DRONE_LIMIT_TRUSTED=false
- RONE_RUNNER_CAPACITY=2
- DRONE_RUNNER_NETWORKS=cicd_net
- DRONE_RUNNER_NAME=drone-cli
networks:
cicd_net:
name: cicd_net

View File

@ -0,0 +1,13 @@
import type { NestFastifyApplication } from '@nestjs/platform-fastify';
import { AppModule } from '@/app.module';
import { NestFactory } from '@nestjs/core';
import { FastifyAdapter } from '@nestjs/platform-fastify';
(async () => {
const app = await NestFactory.create<NestFastifyApplication>(
AppModule.forRoot(),
new FastifyAdapter(),
);
await app.listen(process.env.PORT ?? 3000, '0.0.0.0');
})();

View File

@ -0,0 +1,25 @@
import type { INestApplication } from '@nestjs/common';
import type { TestingModule } from '@nestjs/testing';
import type { App } from 'supertest/types';
import { Test } from '@nestjs/testing';
import request from 'supertest';
import { AppModule } from './../src/app.module';
describe('AppController (e2e)', () => {
let app: INestApplication<App>;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
it('/ (GET)', () => {
return request(app.getHttpServer()).get('/').expect(200).expect('Hello World!');
});
});

View File

@ -0,0 +1,9 @@
{
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testEnvironment": "node",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
}
}

View File

@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["node_modules", "test", "dist", "**/*spec.ts", "**.js"]
}

View File

@ -0,0 +1,39 @@
{
"compilerOptions": {
"strict": true,
"alwaysStrict": true,
"target": "esnext",
"module": "commonjs",
"moduleResolution": "Node",
"declaration": true,
"declarationMap": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": false,
"noImplicitAny": true,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": false,
"isolatedModules": true,
"esModuleInterop": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"pretty": true,
"resolveJsonModule": true,
"allowJs": true,
"importsNotUsedAsValues": "remove",
"noEmit": false,
"lib": ["esnext", "DOM", "ScriptHost", "WebWorker"],
"baseUrl": ".",
"outDir": "./dist",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src", "test", "typings/**/*.d.ts", "**.js"]
}

View File

@ -15,7 +15,7 @@ const nextConfig = {
transpilePackages: ['@3rapp/store'],
pageExtensions: ['js', 'jsx', 'mdx', 'ts', 'tsx'],
env: {
NEXTAUTH_URL: 'http://localhost:3000',
NEXTAUTH_URL: 'http://0.0.0.0:3000',
},
webpack: (config, { isServer }) => {
config.resolve.alias = {

View File

@ -1,7 +1,7 @@
import { AuthLoginForm } from '@/app/_components/auth/loginForm';
const AuthPage = () => {
return (
const AuthPage = () => {:q
return (
<div
style={{ background: 'url(/uploads/thumb/post-1.png) no-repeat center center fixed' }}
className=" tw-flex tw-min-h-svh tw-w-full tw-items-center tw-justify-center tw-p-6 md:tw-p-12"

View File

@ -1,6 +1,9 @@
import type { AppConfig } from '@/lib/types';
export const appConfig: AppConfig = {
baseUrl: process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000',
baseUrl: process.env.NEXT_PUBLIC_APP_URL || 'http://0.0.0.0:3000',
apiUrl: process.env.NEXT_PUBLIC_APi_URL || `${process.env.NEXT_PUBLIC_APP_URL}/api`,
};
export const testConfig = {
testName: 'test',
};

View File

@ -0,0 +1,7 @@
import { log } from 'node:console';
import { testConfig } from './app';
const aaa = testConfig;
const bbb = aaa.testName;
log(bbb);

View File

@ -12,10 +12,6 @@
"import": {
"types": "./dist/es/index.d.ts",
"default": "./dist/es/index.js"
},
"require": {
"types": "./dist/cjs/index.d.cts",
"default": "./dist/cjs/index.cjs"
}
},
"scripts": {

View File

@ -1,6 +1,33 @@
{
"extends": "@3rapp/core/tsconfig/node.json",
"compilerOptions": {
"incremental": true,
"target": "esnext",
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext"],
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"allowJs": true,
"strict": true,
"strictBindCallApply": false,
"strictNullChecks": true,
"alwaysStrict": true,
"module": "commonjs",
"moduleResolution": "Node",
"noFallthroughCasesInSwitch": false,
"noImplicitAny": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"importsNotUsedAsValues": "remove",
"noEmit": true,
"removeComments": true,
"sourceMap": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"skipLibCheck": true,
"pretty": true,
"baseUrl": ".",
"outDir": "./dist",
"paths": {

File diff suppressed because it is too large Load Diff