remove: manager package

Signed-off-by: MiaoWoo <admin@yumc.pw>
backup
MiaoWoo 2020-03-02 21:00:54 +08:00
parent f28a1e3c66
commit d7061c0c9d
4 changed files with 0 additions and 105 deletions

View File

@ -1,39 +0,0 @@
{
"private": true,
"name": "@ms/manager",
"version": "0.3.0",
"description": "MiaoScript manager package",
"keywords": [
"miaoscript",
"minecraft",
"bukkit",
"sponge"
],
"author": "MiaoWoo <admin@yumc.pw>",
"homepage": "https://github.com/circlecloud/ms.git",
"license": "ISC",
"main": "dist/index.js",
"publishConfig": {
"registry": "https://repo.yumc.pw/repository/npm-hosted/"
},
"scripts": {
"dev": "ts-node-dev --respawn --debounce=1500 src/index.ts",
"clean": "rimraf dist",
"watch": "tsc --watch",
"build": "yarn clean && tsc",
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"@cc-server/core": "^0.7.0",
"mongodb": "^3.5.4"
},
"devDependencies": {
"@types/express": "^4.17.2",
"@types/mongodb": "^3.3.16",
"@types/socket.io": "^2.1.4",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"ts-node-dev": "^1.0.0-pre.44",
"typescript": "^3.8.3"
}
}

View File

@ -1,37 +0,0 @@
import { DBClient } from '@cc-server/db'
import { lazyInjectNamed } from '@cc-server/ioc'
import { controller, get, post, requestParam, requestBody, Vaild, NotBlank } from '@cc-server/binding'
class Plugins {
@NotBlank()
name?: string;
author?: string;
version?: string;
source?: string;
type?: string;
dist?: string;
}
type distType = 'npm' | 'git' | 'src'
@controller('/plugin')
class PluginController {
@lazyInjectNamed(DBClient, Plugins.name.toLocaleLowerCase())
private client: DBClient<Plugins>
@get('/')
index() {
return this.client.find({});
}
@get('/:id')
details(@requestParam("id") id: string) {
return this.client.findOneById(id);
}
@post('/')
add(@requestBody() @Vaild() model: Plugins) {
return this.client.insertOne(model);
}
}

View File

@ -1,22 +0,0 @@
import * as path from 'path'
import { Db, MongoClient } from 'mongodb'
import { DBClient } from '@cc-server/db'
import { interfaces } from '@cc-server/ioc'
import { CcServerBoot } from '@cc-server/core'
import { MongoCollection, TYPE } from '@cc-server/db-mongo';
async function main() {
let server = new CcServerBoot();
let collectionCache = {};
server.container.bind(DBClient).toDynamicValue((context: interfaces.Context) => {
let name = context.currentRequest.target.getNamedTag().value;
if (!name) { return null }
if (!collectionCache[name]) { collectionCache[name] = new MongoCollection(context.container.get<Db>(TYPE.DB).collection(name)) }
return collectionCache[name];
})
let client = await MongoClient.connect("mongodb://192.168.2.5:27017", { useNewUrlParser: true, connectTimeoutMS: 10000 })
server.container.bind("MONGO_DB").toConstantValue(client.db("mspc"));
server.scan(path.join(__dirname, "controller")).start()
}
main()

View File

@ -1,7 +0,0 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": "src",
"outDir": "dist"
}
}