Skip to content

Commit

Permalink
refactor: remove mocah and chai package and change directory gland
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mdy-m committed Aug 23, 2024
1 parent 16c8d4a commit 0f702dc
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 682 deletions.
4 changes: 0 additions & 4 deletions .mocharc.jsonc

This file was deleted.

2 changes: 1 addition & 1 deletion examples/CRUD/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import gland, { Context } from '../../gland';
import gland, { Context } from '../../';
const app = new gland();

// Define a dynamic route with `all` method
Expand Down
2 changes: 1 addition & 1 deletion examples/CRUD/router/crud.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { exposed, Get, Route, Delete, Post, Put, Context } from '../../../gland/router';
import { exposed, Get, Route, Delete, Post, Put, Context } from '../../../index';
import p from 'path';
import * as fs from 'fs';
const db = p.join(__dirname, '..', 'db', 'db.json');
Expand Down
16 changes: 0 additions & 16 deletions gland/index.ts

This file was deleted.

6 changes: 0 additions & 6 deletions gland/router.ts

This file was deleted.

19 changes: 19 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { WebServer } from './lib/core/server';
import { Qiu } from './lib/cli/Qiu';
import { DbTypes, Context } from './lib/types/types';
import { Logger } from './lib/helper/logger';
import { exposed, Route } from './lib/core/decorators';
import { Delete, Get, Head, Options, Patch, Post, Put } from './lib/core/router/index';
export { Context };
export default class gland extends WebServer {
constructor() {
super();
}
Qiu(types: DbTypes, user: string, password: string) {
return Qiu.getInstance(types, user, password);
}
lg() {
return Logger;
}
}
export { Get, Post, Put, Delete, Patch, Head, Options, Route,exposed };
6 changes: 3 additions & 3 deletions lib/core/decorators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Reflect from '../../metadata/metadata';
import { MidsFn, RouteHandler } from '../../types/types';
import { routes } from '../router';
const classes: Set<any> = new Set();
function exposeds(t?: any): any {
function exposed(t?: any): any {
const attach = (target: any = t) => {
classes.add(target);
};
Expand All @@ -25,7 +25,7 @@ function exposeds(t?: any): any {
function getEx(): any[] {
return Array.from(classes);
}
export { exposeds, getEx };
export { exposed, getEx };
export function mid(middleware: MidsFn | MidsFn[]): MethodDecorator | any {
return (target: object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void => {
const existingMids = Reflect.get('middlewares', target.constructor.prototype, propertyKey) || [];
Expand All @@ -41,7 +41,7 @@ export function mids(middlewareArray: MidsFn[] | MidsFn): ClassDecorator {
};
}

export function Routes(path: string): ClassDecorator {
export function Route(path: string): ClassDecorator {
return (target: Function): void => {
Reflect.init('route', path, target.prototype);
routes.set(path, target as RouteHandler);
Expand Down
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"example": "examples"
},
"scripts": {
"test": "mocha --require ts-node/register test/**/*.spec.ts --config ./.mocharc.jsonc",
"build": "tsc"
},
"repository": {
Expand All @@ -33,10 +32,6 @@
},
"homepage": "https://github.com/medishen/gland#readme",
"devDependencies": {
"@types/chai": "^4.3.17",
"@types/mocha": "^10.0.7",
"chai": "^4.3.7",
"mocha": "^10.4.0",
"ts-node": "^10.9.2"
},
"dependencies": {
Expand Down
Loading

0 comments on commit 0f702dc

Please sign in to comment.