Skip to content

Commit 3a7644b

Browse files
committed
initial commit
0 parents  commit 3a7644b

File tree

10 files changed

+1255
-0
lines changed

10 files changed

+1255
-0
lines changed

.github/workflows/ci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 0 * * *'
8+
9+
jobs:
10+
node14:
11+
name: Node 14
12+
runs-on: ubuntu-20.04
13+
steps:
14+
- name: checkout
15+
uses: actions/checkout@v2
16+
- name: checkout node
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: '14'
20+
- run: npm install
21+
- run: npm run build
22+
- run: npm run cs
23+
- run: npm test -- --coverage --no-cache
24+
- run: npm run infection
25+
env:
26+
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
27+
node16:
28+
name: Node 16
29+
runs-on: ubuntu-20.04
30+
steps:
31+
- name: checkout
32+
uses: actions/checkout@v2
33+
- name: checkout node
34+
uses: actions/setup-node@v2
35+
with:
36+
node-version: '16'
37+
- run: npm install
38+
- run: npm run build
39+
- run: npm run cs
40+
- run: npm test -- --coverage --no-cache
41+
- run: npm run infection
42+
env:
43+
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
44+
node18:
45+
name: Node 18
46+
runs-on: ubuntu-20.04
47+
steps:
48+
- name: checkout
49+
uses: actions/checkout@v2
50+
- name: checkout node
51+
uses: actions/setup-node@v2
52+
with:
53+
node-version: '18'
54+
- run: npm install
55+
- run: npm run build
56+
- run: npm run cs
57+
- run: npm test -- --coverage --no-cache
58+
- run: npm run infection
59+
env:
60+
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
61+
- name: coveralls.io
62+
uses: coverallsapp/github-action@master
63+
with:
64+
github-token: ${{ secrets.GITHUB_TOKEN }}
65+
- name: sonarcloud.io
66+
uses: sonarsource/sonarcloud-github-action@master
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.stryker-tmp
2+
coverage
3+
dist
4+
node_modules
5+
package-lock.json

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2022 Dominik Zogg
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# chubbyts-http-error
2+
3+
[![CI](https://github.com/chubbyts/chubbyts-http-error/workflows/CI/badge.svg?branch=master)](https://github.com/chubbyts/chubbyts-http-error/actions?query=workflow%3ACI)
4+
[![Coverage Status](https://coveralls.io/repos/github/chubbyts/chubbyts-http-error/badge.svg?branch=master)](https://coveralls.io/github/chubbyts/chubbyts-http-error?branch=master)
5+
[![Infection MSI](https://badge.stryker-mutator.io/github.com/chubbyts/chubbyts-http-error/master)](https://dashboard.stryker-mutator.io/reports/github.com/chubbyts/chubbyts-http-error/master)
6+
[![npm-version](https://img.shields.io/npm/v/@chubbyts/chubbyts-http-error.svg)](https://www.npmjs.com/package/@chubbyts/chubbyts-http-error)
7+
8+
[![bugs](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-error&metric=bugs)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
9+
[![code_smells](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-error&metric=code_smells)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
10+
[![coverage](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-error&metric=coverage)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
11+
[![duplicated_lines_density](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-error&metric=duplicated_lines_density)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
12+
[![ncloc](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-error&metric=ncloc)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
13+
[![sqale_rating](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-error&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
14+
[![alert_status](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-error&metric=alert_status)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
15+
[![reliability_rating](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-error&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
16+
[![security_rating](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-error&metric=security_rating)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
17+
[![sqale_index](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-error&metric=sqale_index)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
18+
[![vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-error&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
19+
20+
## Description
21+
22+
Creates http error which can be catched and converted to error responses.
23+
24+
## Requirements
25+
26+
* node: 14
27+
28+
## Installation
29+
30+
Through [NPM](https://www.npmjs.com) as [@chubbyts/chubbyts-http-error][1].
31+
32+
```ts
33+
npm i @chubbyts/chubbyts-http-error@^1.0.0
34+
```
35+
36+
## Usage
37+
38+
```ts
39+
import { createNotFound } from '@chubbyts/chubbyts-http-error/dist/http-error';
40+
41+
try {
42+
throw createNotFound({ detail: 'Something went wrong', instance: 'server-1', otherKey: 'otherValue' });
43+
} catch (e) {
44+
console.log(e);
45+
}
46+
```
47+
48+
## Copyright
49+
50+
Dominik Zogg 2022
51+
52+
[1]: https://www.npmjs.com/package/@chubbyts/chubbyts-http-error
53+
[2]: https://web-frameworks-benchmark.netlify.app/result
54+
[3]: https://www.php-fig.org/psr/psr-15
55+
[4]: https://www.npmjs.com/package/@chubbyts/chubbyts-dic-types
56+
[5]: https://www.npmjs.com/package/@chubbyts/chubbyts-http-types
57+
[6]: https://www.npmjs.com/package/@chubbyts/chubbyts-log-types

package.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"name": "@chubbyts/chubbyts-http-error",
3+
"version": "1.0.0",
4+
"description": "Creates http error which can be catched and converted to error responses.",
5+
"keywords": [
6+
"chubbyts",
7+
"http error",
8+
"http-error"
9+
],
10+
"author": "Dominik Zogg",
11+
"license": "MIT",
12+
"repository": "chubbyts/chubbyts-http-error",
13+
"scripts": {
14+
"cs-fix": "prettier --write src tests",
15+
"cs": "prettier --check src tests",
16+
"test": "jest",
17+
"infection": "stryker run",
18+
"build": "tsc",
19+
"prepare": "rm -Rf dist && npm run build && npm run cs && npm run test"
20+
},
21+
"jest": {
22+
"preset": "ts-jest",
23+
"testEnvironment": "node",
24+
"collectCoverageFrom": [
25+
"src/**/*.ts"
26+
],
27+
"coverageThreshold": {
28+
"global": {
29+
"lines": 100
30+
}
31+
}
32+
},
33+
"prettier": {
34+
"printWidth": 120,
35+
"tabWidth": 2,
36+
"singleQuote": true,
37+
"trailingComma": "all"
38+
},
39+
"files": [
40+
"dist"
41+
],
42+
"engines": {
43+
"node": ">=14"
44+
},
45+
"dependencies": {
46+
},
47+
"devDependencies": {
48+
"@stryker-mutator/core": "^6.0.2",
49+
"@stryker-mutator/jest-runner": "^6.0.2",
50+
"@types/jest": "^27.5.1",
51+
"@types/node": "^14",
52+
"jest": "^28.1.0",
53+
"prettier": "^2.6.2",
54+
"ts-jest": "^28.0.3",
55+
"typescript": "^4.7.2"
56+
},
57+
"publishConfig": {
58+
"access": "public"
59+
}
60+
}

sonar-project.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
sonar.organization=chubbyts
2+
sonar.projectKey=chubbyts_chubbyts-http-error
3+
sonar.projectName=chubbyts-http-error
4+
5+
sonar.sources=src
6+
sonar.tests=tests
7+
sonar.language=typescript
8+
sonar.sourceEncoding=UTF-8
9+
sonar.javascript.lcov.reportPaths=coverage/lcov.info

0 commit comments

Comments
 (0)