diff --git a/packages/manager/package.json b/packages/manager/package.json deleted file mode 100644 index 2ae3e0dc..00000000 --- a/packages/manager/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "private": true, - "name": "@ms/manager", - "version": "0.3.0", - "description": "MiaoScript manager package", - "keywords": [ - "miaoscript", - "minecraft", - "bukkit", - "sponge" - ], - "author": "MiaoWoo ", - "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" - } -} diff --git a/packages/manager/src/controller/Index.ts b/packages/manager/src/controller/Index.ts deleted file mode 100644 index 521b13b6..00000000 --- a/packages/manager/src/controller/Index.ts +++ /dev/null @@ -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 - - @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); - } - -} \ No newline at end of file diff --git a/packages/manager/src/index.ts b/packages/manager/src/index.ts deleted file mode 100644 index df54c78c..00000000 --- a/packages/manager/src/index.ts +++ /dev/null @@ -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(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() diff --git a/packages/manager/tsconfig.json b/packages/manager/tsconfig.json deleted file mode 100644 index 7aae5d2b..00000000 --- a/packages/manager/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": "src", - "outDir": "dist" - } -} \ No newline at end of file