-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rename koa plugin and support nestjs
- Loading branch information
Showing
63 changed files
with
1,091 additions
and
33 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
packages/apps/artusx-legacy/package.json → packages/apps/artusx-express/package.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions
10
packages/apps/artusx-web/package.json → packages/apps/artusx-koa/package.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,27 @@ | ||
# ArtusX-API | ||
|
||
> undefined project with web-server powered by ArtusX. | ||
## Usage | ||
|
||
### Development | ||
|
||
```bash | ||
pnpm i | ||
pnpm run dev | ||
``` | ||
|
||
### Production | ||
|
||
```bash | ||
pnpm run start | ||
|
||
# nohup | ||
nohup pnpm run start & | ||
``` | ||
|
||
### Requirement | ||
|
||
- Docker | ||
- Node.js 18.x | ||
- Typescript 4.x+ |
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,29 @@ | ||
{ | ||
"name": "artusx-nest", | ||
"version": "1.0.0", | ||
"description": "nest for artusx", | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "", | ||
"dev": "npx nodemon src/bootstrap.ts" | ||
}, | ||
"dependencies": { | ||
"@artus/core": "^2.x", | ||
"@artusx/plugin-nest": "workspace:*", | ||
"@artusx/utils": "workspace:*", | ||
"@nestjs/common": "~10.3.0", | ||
"@nestjs/core": "~10.3.0", | ||
"@nestjs/platform-express": "~10.3.0", | ||
"nodemon": "~3.0.2", | ||
"reflect-metadata": "^0.1.13", | ||
"rxjs": "~7.8.1" | ||
}, | ||
"devDependencies": { | ||
"@artus/tsconfig": "~1.0.1", | ||
"@types/node": "~20.10.6", | ||
"nodemon": "~3.0.2", | ||
"ts-node": "~10.9.2", | ||
"tslib": "~2.6.2", | ||
"typescript": "~5.3.3" | ||
} | ||
} |
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,9 @@ | ||
import path from 'path'; | ||
import { Application } from '@artusx/utils'; | ||
|
||
(async () => { | ||
await Application.start({ | ||
root: path.resolve(__dirname), | ||
configDir: 'config' | ||
}); | ||
})(); |
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,7 @@ | ||
import { AppModule } from '../root/app.module'; | ||
|
||
export default { | ||
nest: { | ||
rootModule: 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,6 @@ | ||
export default { | ||
nest: { | ||
enable: true, | ||
package: '@artusx/plugin-nest' | ||
} | ||
}; |
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 } from '@nestjs/common'; | ||
import { AppService } from './app.service'; | ||
|
||
@Controller() | ||
export class AppController { | ||
constructor(private appService: AppService) {} | ||
|
||
@Get() | ||
async getHome(): Promise<string> { | ||
const message = await this.appService.getHome(); | ||
return message; | ||
} | ||
} |
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,16 @@ | ||
import { Module, DynamicModule } from '@nestjs/common'; | ||
import { AppController } from './app.controller'; | ||
import { AppService } from './app.service'; | ||
import { BaseModule } from './base/base.module'; | ||
|
||
@Module({}) | ||
export class AppModule { | ||
static registerAsync(options: any): DynamicModule { | ||
return { | ||
module: AppModule, | ||
imports: [BaseModule.register(options)], | ||
controllers: [AppController], | ||
providers: [AppService] | ||
}; | ||
} | ||
} |
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 { Inject, Injectable } from '@nestjs/common'; | ||
import { BaseService } from './base/base.service'; | ||
|
||
@Injectable() | ||
export class AppService { | ||
@Inject(BaseService) | ||
baseService: BaseService; | ||
|
||
async getHome(): Promise<string> { | ||
const message = await this.baseService.getWelcomeMessage(); | ||
return message; | ||
} | ||
} |
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,25 @@ | ||
import { DynamicModule, Module } from '@nestjs/common'; | ||
import { BaseService } from './base.service'; | ||
|
||
export const BASE_MODULE_OPTIONS = 'BASE_MODULE_OPTIONS'; | ||
|
||
export interface BaseModuleOptions { | ||
container?: any; | ||
} | ||
|
||
@Module({}) | ||
export class BaseModule { | ||
static register(options: BaseModuleOptions): DynamicModule { | ||
return { | ||
module: BaseModule, | ||
providers: [ | ||
{ | ||
provide: BASE_MODULE_OPTIONS, | ||
useValue: options | ||
}, | ||
BaseService | ||
], | ||
exports: [BaseService] | ||
}; | ||
} | ||
} |
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,19 @@ | ||
import { Container } from '@artus/core'; | ||
import { Inject, Injectable } from '@nestjs/common'; | ||
import { BASE_MODULE_OPTIONS, BaseModuleOptions } from './base.module'; | ||
import InfoService from '../../service/info'; | ||
|
||
@Injectable() | ||
export class BaseService { | ||
container: Container; | ||
|
||
constructor(@Inject(BASE_MODULE_OPTIONS) options: BaseModuleOptions) { | ||
this.container = options.container; | ||
} | ||
|
||
async getWelcomeMessage(): Promise<string> { | ||
const infoService = this.container.get(InfoService) as InfoService; | ||
const info = await infoService.getName(); | ||
return info; | ||
} | ||
} |
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 @@ | ||
import { Inject, Injectable, ArtusInjectEnum, ArtusApplication } from '@artus/core'; | ||
|
||
@Injectable() | ||
export default class InfoService { | ||
@Inject(ArtusInjectEnum.Application) | ||
app: ArtusApplication; | ||
|
||
async getName(): Promise<string> { | ||
console.log('app.config', this.app.config); | ||
return 'InfoService'; | ||
} | ||
} |
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,2 @@ | ||
export * from '@artusx/plugin-nest'; | ||
export { default as INestClient } from '@artusx/plugin-nest/client'; |
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 @@ | ||
{ | ||
"extends": "@artus/tsconfig", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"strictNullChecks": true, | ||
"resolveJsonModule": true, | ||
"module": "NodeNext", | ||
"moduleResolution": "NodeNext", | ||
"outDir": "dist" | ||
}, | ||
"include": ["src/**/*.ts", "src/**/*.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
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,6 +1,6 @@ | ||
export default { | ||
'application-http': { | ||
koa: { | ||
enable: true, | ||
package: '@artusx/plugin-application-http' | ||
package: '@artusx/plugin-koa' | ||
} | ||
}; |
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
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 +1 @@ | ||
export * from '@artusx/plugin-application-http'; | ||
export * from '@artusx/plugin-koa'; |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
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 @@ | ||
{ | ||
"name": "koa" | ||
} |
4 changes: 2 additions & 2 deletions
4
...ges/plugins/application-http/package.json → packages/plugins/koa/package.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 @@ | ||
lib |
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 @@ | ||
# ArtusX plugin redis | ||
|
||
> https://github.com/thonatos/artusx |
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 @@ | ||
{ | ||
"name": "nest" | ||
} |
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,56 @@ | ||
{ | ||
"name": "@artusx/plugin-nest", | ||
"version": "1.0.1-dev.16", | ||
"description": "nest plugin for artusx", | ||
"keywords": [ | ||
"artus.js" | ||
], | ||
"license": "MIT", | ||
"author": "Suyi <[email protected]>", | ||
"exports": { | ||
".": { | ||
"types": "./lib/index.d.ts", | ||
"default": "./lib/index.js" | ||
}, | ||
"./constants": { | ||
"types": "./lib/constants.d.ts", | ||
"default": "./lib/constants.js" | ||
}, | ||
"./client": { | ||
"types": "./lib/client.d.ts", | ||
"default": "./lib/client.js" | ||
}, | ||
"./lifecycle": { | ||
"types": "./lib/lifecycle.d.ts", | ||
"default": "./lib/lifecycle.js" | ||
} | ||
}, | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.js", | ||
"files": [ | ||
"lib" | ||
], | ||
"scripts": { | ||
"build": "npm run tsc && npm run build:metadata", | ||
"build:metadata": "cp meta.json ./lib/meta.json", | ||
"tsc": "rm -rf lib && tsc" | ||
}, | ||
"dependencies": { | ||
"@artus/core": "^2.x", | ||
"@artus/pipeline": "^0.2", | ||
"@nestjs/common": "~10.3.0", | ||
"@nestjs/core": "~10.3.0" | ||
}, | ||
"devDependencies": { | ||
"@artus/tsconfig": "^1.0.1", | ||
"@types/node": "^18.11.17", | ||
"tslib": "^2.5.0", | ||
"typescript": "^4.9.4" | ||
}, | ||
"peerDependencies": { | ||
"reflect-metadata": "^0.1.13" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
Oops, something went wrong.