Skip to content

Commit

Permalink
Merge 15c0863 into e6a56c7
Browse files Browse the repository at this point in the history
  • Loading branch information
knor-el-snor committed Sep 1, 2018
2 parents e6a56c7 + 15c0863 commit 20ebab9
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 5,136 deletions.
7 changes: 1 addition & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@ node_js:

sudo: false

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"

cache:
yarn: true
directories:
- "node_modules"

script:
- yarn run test:coverage
- npm run test:coverage

# Send coverage data to Coveralls
after_script: "cat coverage/lcov.info | node_modules/coveralls/bin/coveralls.js"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ app.post('/my-endpoint', treehouse.validateSchema(schema), ...);
## Tests
- You can run `yarn test` to run all tests
- You can run `yarn test:coverage` to run all tests with coverage report
- You can run `npm run test` to run all tests
- You can run `npm run test:coverage` to run all tests with coverage report
## Bugs
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {
"json"
],
transform: {
"\\.(ts|tsx)$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
"\\.(ts|tsx)$": "ts-jest"
},
testRegex: "/tests/.*\\.(ts|tsx|js)$",
coveragePathIgnorePatterns: [
Expand Down
54 changes: 27 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,51 @@
"types": "build/index.d.ts",
"scripts": {
"clean": "rm -rf ./build/*",
"build": "yarn clean && tsc",
"start": "yarn build && node build/index.js",
"build": "npm run clean && tsc",
"start": "npm run build && node build/index.js",
"lint": "tslint 'src/**/*.ts'",
"test": "jest --forceExit",
"test:coverage": "jest --coverage --collectCoverageFrom=src/**/*.ts --forceExit",
"test": "jest --detectOpenHandles",
"test:coverage": "jest --coverage --collectCoverageFrom=src/**/*.ts --detectOpenHandles",
"test:watch": "jest --watchAll",
"pretest": "yarn build",
"prepublish": "yarn build",
"pretest": "npm run build",
"prepublish": "npm run build",
"release": "node_modules/np/cli.js --no-cleanup"
},
"precommit": [
"lint"
],
"dependencies": {
"body-parser": "~1.18.2",
"body-parser": "~1.18.3",
"cors": "~2.8.4",
"express": "~4.16.2",
"express-brute": "~1.0.1",
"express-brute-redis": "~0.0.1",
"express-validation": "~1.0.2",
"helmet": "~3.12.0",
"helmet": "~3.13.0",
"https": "~1.0.0",
"js-yaml": "~3.11.0",
"swagger-ui-express": "~3.0.8"
"js-yaml": "~3.12.0",
"swagger-ui-express": "~4.0.1"
},
"devDependencies": {
"@types/cors": "~2.8.3",
"@types/express": "~4.11.1",
"@types/express-brute": "~0.0.36",
"@types/cors": "~2.8.4",
"@types/express": "~4.16.0",
"@types/express-brute": "~0.0.37",
"@types/express-brute-redis": "~0.0.1",
"@types/helmet": "~0.0.37",
"@types/jest": "~22.2.3",
"@types/joi": "~13.0.7",
"@types/supertest": "~2.0.4",
"coveralls": "^3.0.0",
"jest": "^22.4.3",
"joi": "~13.2.0",
"np": "^2.20.1",
"@types/helmet": "~0.0.40",
"@types/jest": "~23.3.1",
"@types/joi": "~13.4.4",
"@types/supertest": "~2.0.5",
"coveralls": "^3.0.2",
"jest": "^23.5.0",
"joi": "~13.6.0",
"np": "^3.0.4",
"pre-commit": "^1.2.2",
"redis-mock": "0.21.0",
"supertest": "^3.0.0",
"ts-jest": "~22.4.4",
"tslint": "^5.9.1",
"tslint-config-airbnb": "^5.8.0",
"typescript": "^2.8.1"
"redis-mock": "0.32.0",
"supertest": "^3.1.0",
"ts-jest": "~23.1.4",
"tslint": "^5.11.0",
"tslint-config-airbnb": "^5.11.0",
"typescript": "^3.0.3"
},
"engines": {
"node": ">=4.0.0"
Expand Down
4 changes: 0 additions & 4 deletions src/lib/express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import * as bodyParser from 'body-parser';
import * as defaults from '../config/app.config';
const redisStore = require('express-brute-redis');


/**
* Set some basic security measurements
*/
Expand All @@ -16,7 +15,6 @@ export function setBasicSecurity(app: Application, route: string, options: Secur
app.use(route, cors(Object.assign({}, defaults.corsOptions, options.cors)));
}


/**
* Set a body parser for all specific types at once
*/
Expand All @@ -29,7 +27,6 @@ export function setBodyParser(app: Application, route: string, options: BodyPars
if (allOptions.urlEncoded) app.use(route, bodyParser.urlencoded(allOptions.urlEncoded));
}


/**
* Get a rate limiter instance
* Current support for: built-in memory and Redis
Expand All @@ -48,7 +45,6 @@ export function getRateLimiter(options: RateLimiterOptions = {}): ExpressBrute {
return new ExpressBrute(store, bruteOptions);
}


// Interfaces
export interface RateLimiterOptions extends ExpressBrute.Options {
redis?: RedisOptions;
Expand Down
2 changes: 0 additions & 2 deletions src/lib/responder.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { RequestHandler, Request, Response, NextFunction } from 'express';


/**
* Wrap an express function to handle unhandled exceptions
*/
Expand All @@ -13,4 +12,3 @@ export function handleAsyncFn(fnToExecute: (request: Request, response: Response
}
};
}

7 changes: 0 additions & 7 deletions src/lib/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as http from 'http';
import * as https from 'https';
import * as fs from 'fs';


/**
* Start an http/https server from the given Express instance
*/
Expand All @@ -30,7 +29,6 @@ export async function startServer(app: Application, options: ServerOptions): Pro
}
}


/**
* Execute a pre-hook function
*/
Expand All @@ -43,7 +41,6 @@ export async function preHook(fn) {
}
}


/**
* Execute a post-hook function
*/
Expand All @@ -56,7 +53,6 @@ export async function postHook(fn) {
}
}


/**
* Get HTTPS credentials
* Read out the private key and certificate
Expand All @@ -71,7 +67,6 @@ function getHttpsCredentials(certificate: string, privateKey: string): { key: st
}
}


export interface ServerOptions {
port: number;
title?: string;
Expand All @@ -83,5 +78,3 @@ export interface ServerOptions {
pre?: Function;
post?: Function;
}


2 changes: 0 additions & 2 deletions src/lib/swagger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as swaggerUi from 'swagger-ui-express';
import * as yaml from 'js-yaml';
import * as fs from 'fs';


/**
* Serve swagger documentation
*/
Expand All @@ -20,7 +19,6 @@ export function setSwagger(app: Application, route: string, filePath: string, op
}
}


// Interfaces
export interface SwaggerOptions {
swaggerUrl?: string;
Expand Down
1 change: 0 additions & 1 deletion src/lib/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ export function validateSchema(schema, options = {}) {
expressValidation(schema)(req, res, next);
};
}

Loading

0 comments on commit 20ebab9

Please sign in to comment.