Skip to content

Commit

Permalink
chore: release version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mdy-m committed Sep 15, 2024
1 parent c7a2ee0 commit bb76660
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 46 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@

# Environment variables
.env
# npm pack
*.tgz
6 changes: 2 additions & 4 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ node_modules/
lib/
test/
__test__/
*.spec*
dist/**/__test__/
__test__/*
examples/
docs/
.git/
Expand All @@ -13,4 +10,5 @@ docs/
.prettierrc
tsconfig.json
scripts/
benchmark/
benchmark/
*.tgz
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"name": "@medishn/gland",
"version": "1.0.1",
"version": "1.0.0",
"description": "Glands is a lightweight framework for Node.js designed for simplicity.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist/**/*"
"dist/",
"LICENSE",
"README.md"
],
"directories": {
"doc": "docs",
Expand All @@ -15,7 +17,7 @@
},
"scripts": {
"test": "npm run test:unit & npm run test:e2e & npm run test:performance",
"test:unit": "mocha --require ts-node/register lib/**/__test__/*.spec.ts",
"test:unit": "mocha --require ts-node/register test/unit/**/*.spec.ts",
"test:e2e": "mocha --require ts-node/register test/e2e/*.spec.ts",
"test:performance": "mocha --require ts-node/register test/performance/*.spec.ts",
"benchmark": "ts-node ./benchmark/gland.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import sinon from 'sinon';
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { WebContext } from '../context';
import { WebContext } from '../../../lib/core/context';
import { IncomingMessage } from 'http';
import { ServerResponse } from 'http';
import { RQ, RS } from '../../types';
import { RQ, RS } from '../../../lib/types';
describe('CONTEXT', () => {
let webContext: WebContext;
let mockRequest: sinon.SinonStubbedInstance<IncomingMessage & RQ>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect } from 'chai';
import * as sinon from 'sinon';
import { mid, mids, Route, getEx } from '../decorators';
import { ServerUtils } from '../../helper';
import Reflect from '../../metadata';
import { routes } from '../router';
import { mid, mids, Route, getEx } from '../../../lib/core/decorators';
import { ServerUtils } from '../../../lib/helper';
import Reflect from '../../../lib/metadata';
import { routes } from '../../../lib/core/router';

describe('Decorators', () => {
let reflectInitStub: sinon.SinonStub;
Expand All @@ -19,21 +19,21 @@ describe('Decorators', () => {
});

describe('mid decorator', () => {
it('should add middleware to the method using Reflect', () => {
const middleware = sinon.stub();
const target = {};
const propertyKey = 'someMethod';
const descriptor = {};
const mockGet = sinon.stub(Reflect, 'get').returns([]);
it('should add middleware to the method using Reflect', () => {
const middleware = sinon.stub();
const target = {};
const propertyKey = 'someMethod';
const descriptor = {};
const mockGet = sinon.stub(Reflect, 'get').returns([]);

mid(middleware)(target, propertyKey, descriptor as PropertyDescriptor);
mid(middleware)(target, propertyKey, descriptor as PropertyDescriptor);

expect(mockGet.calledOnceWith('middlewares', target.constructor.prototype, propertyKey)).to.be.true;
expect(serverUtilsNormalizeStub.calledOnceWith(middleware)).to.be.true;
expect(reflectInitStub.calledOnceWith('middlewares', [middleware], target.constructor.prototype, propertyKey)).to.be.true;
expect(mockGet.calledOnceWith('middlewares', target.constructor.prototype, propertyKey)).to.be.true;
expect(serverUtilsNormalizeStub.calledOnceWith(middleware)).to.be.true;
expect(reflectInitStub.calledOnceWith('middlewares', [middleware], target.constructor.prototype, propertyKey)).to.be.true;

mockGet.restore();
});
mockGet.restore();
});
});
describe('mids decorator', () => {
it('should add class-level middleware using Reflect', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from 'chai';
import * as sinon from 'sinon';
import { Gmids, midManager } from '../middleware';
import { ServerUtils } from '../../helper';
import { Gland } from '../../types/index';
import { Gmids, midManager } from '../../../lib/core/middleware';
import { ServerUtils } from '../../../lib/helper';
import { Gland } from '../../../lib/types/index';

describe('Gmids and midManager', () => {
let serverUtilsNormalizeStub: sinon.SinonStub;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { expect } from 'chai';
import sinon from 'sinon';
import { WebServer } from '../server'; // Adjust the path as necessary
import { WebServer } from '../../../lib/core/server'; // Adjust the path as necessary
import { METHODS } from 'http';
import { Parser } from '../../helper/Parser';
import { Router } from '../router';
import { LoadModules } from '../../helper/load';
import { Context, Gland, NxtFunction } from '../../types';
import { midManager } from '../middleware';
import { ServerUtils } from '../../helper/';
import { Parser } from '../../../lib/helper/Parser';
import { Router } from '../../../lib/core/router';
import { LoadModules } from '../../../lib/helper/load';
import { Context, Gland, NxtFunction } from '../../../lib/types';
import { midManager } from '../../../lib/core/middleware';
import { ServerUtils } from '../../../lib/helper';

describe('WebServer', () => {
let server: WebServer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from 'chai';
import sinon from 'sinon';
import * as fs from 'fs';
import path from 'path';
import { LoadModules } from '../load';
import { LoadModules } from '../../../lib/helper/load';

describe('LoadModules', () => {
let readFileStub: sinon.SinonStub;
Expand Down Expand Up @@ -101,7 +101,7 @@ describe('LoadModules', () => {
`;

readFileStub.resolves(mockConfig);
readdirStub.resolves(['file1.ts', 'file2.ts']);
readdirStub.resolves(['file1.ts', 'file2.ts']);
statStub.resolves({ isDirectory: () => false, isFile: () => true });

// Mock the dynamic imports
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import { IncomingMessage } from 'http';
import { TLSSocket } from 'tls';
import { Parser } from '../Parser';
import { Parser } from '../../../lib/helper/Parser';

describe('Parser', function () {
describe('URI class', function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { METHODS } from 'http';
import { ServerUtils } from '../';
import { Gland, MidsFn } from '../../types';
import { ServerUtils } from '../../../lib/helper';
import { Gland, MidsFn } from '../../../lib/types';

describe('ServerUtils', () => {
describe('getMethod()', () => {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import Reflect from '../';
import { MetadataKey, MetadataValue } from '../../types';
import Reflect from '../../../lib/metadata';
import { MetadataKey, MetadataValue } from '../../../lib/types';
type TestTarget = object;
const testTarget: TestTarget = {};

Expand Down
5 changes: 1 addition & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,5 @@
"typeRoots": ["node_modules/@types", "lib/types"]
},
"include": ["lib/**/*.ts", "lib/types/*.d.ts"],
"exclude": [
"node_modules",
"dist",
]
"exclude": ["node_modules", "dist"]
}

0 comments on commit bb76660

Please sign in to comment.