Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript port #48

Merged
merged 1 commit into from
Oct 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
TestResults/
.vscode
dist/
31 changes: 22 additions & 9 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
{
"root": true,
"env": {
"node": true
},
"extends": "airbnb-base",
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "script"
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "import", "jest", "jsdoc"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier/@typescript-eslint",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:jsdoc/recommended",
"plugin:jest/recommended",
"plugin:prettier/recommended"
],
"rules": {
"linebreak-style": "off",
"no-use-before-define": [ "error", { "functions": false } ],
"strict": [ "error", "global" ],
"valid-jsdoc": "warn"
poveden marked this conversation as resolved.
Show resolved Hide resolved
"jsdoc/require-jsdoc": [
"warn",
{
"publicOnly": true
}
]
}
}
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,11 @@ jobs:
- name: Yarn install
run: yarn install

- name: Transpile
run: yarn build

- name: Lint and run tests
run: yarn test

- name: Pack
run: npm pack
poveden marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules/
TestResults/
.vscode
poveden marked this conversation as resolved.
Show resolved Hide resolved
.cache/
dist/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/
poveden marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"endOfLine": "auto",
"semi": true,
"singleQuote": true
}
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"recommendations": [
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner",
"redhat.vscode-yaml",
]
Expand Down
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": true
}
},
"editor.formatOnSave": true,
"typescript.tsdk": "./node_modules/typescript/lib"
}
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
collectCoverage: true,
coverageDirectory: 'TestResults/coverage',
Expand Down
140 changes: 0 additions & 140 deletions lib/jwk-store.js

This file was deleted.

44 changes: 34 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,71 @@
},
"license": "MIT",
"engines": {
"node": ">=10.0.0",
"node": "^10.13 || ^12.13",
poveden marked this conversation as resolved.
Show resolved Hide resolved
"yarn": "^1.15.2"
},
"repository": {
"type": "git",
"url": "https://github.com/axa-group/oauth2-mock-server.git"
},
"main": "index.js",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"bin": {
"oauth2-mock-server": "./bin/oauth2-mock-server.js"
"oauth2-mock-server": "./dist/oauth2-mock-server.js"
},
"files": [
"CHANGELOG.md",
"LICENSE.md",
"README.md",
"index.js",
"bin/",
"lib/"
"dist/**/*.*"
],
"scripts": {
"build:clean": "rimraf ./dist",
"prebuild": "yarn build:clean",
"build": "tsc -p ./tsconfig.build.json",
"cleanup:testresults": "rimraf TestResults",
"eslint": "eslint .",
"pretest": "yarn cleanup:testresults && yarn eslint",
"prelint": "tsc --noEmit",
"lint": "eslint --cache --cache-location .cache/ --ext=.js,.ts src test --max-warnings 0",
"pretest": "yarn cleanup:testresults && yarn lint",
"test": "yarn jest"
},
"dependencies": {
"@types/node-jose": "^1.1.5",
poveden marked this conversation as resolved.
Show resolved Hide resolved
"basic-auth": "^2.0.1",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1",
"lodash.isplainobject": "^4.0.6",
"node-jose": "^2.0.0",
"uuid": "^8.3.0"
},
"devDependencies": {
"@types/basic-auth": "^1.1.3",
"@types/body-parser": "^1.19.0",
"@types/cors": "^2.8.7",
"@types/express": "^4.17.8",
"@types/jest": "^26.0.14",
"@types/jsonwebtoken": "^8.5.0",
"@types/lodash.isplainobject": "^4.0.6",
"@types/node": "^10.17.35",
"@types/supertest": "^2.0.10",
"@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^4.3.0",
"@typescript-eslint/parser": "^4.3.0",
"eslint": "^7.10.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-prettier": "^6.12.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.0.2",
"eslint-plugin-jsdoc": "^30.6.3",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.4.2",
"jest-junit": "^11.1.0",
"prettier": "^2.1.2",
"rimraf": "^3.0.2",
"supertest": "^5.0.0"
"supertest": "^5.0.0",
"ts-jest": "^26.4.1",
"ts-node": "^9.0.0",
"typescript": "^4.0.3"
}
}
14 changes: 3 additions & 11 deletions index.js → src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@
* limitations under the License.
*/

'use strict';

const JWKStore = require('./lib/jwk-store');
const OAuth2Issuer = require('./lib/oauth2-issuer');
const OAuth2Server = require('./lib/oauth2-server');

module.exports = {
JWKStore,
OAuth2Issuer,
OAuth2Server,
};
export { JWKStore } from './lib/jwk-store';
export { OAuth2Issuer } from './lib/oauth2-issuer';
export { OAuth2Server } from './lib/oauth2-server';
Loading