Skip to content

Commit ca88895

Browse files
authored
Merge pull request #2 from Bessonov/remove-ts-toolbelt
remove ts-toolbelt
2 parents 2e5ca30 + 1559f8f commit ca88895

File tree

12 files changed

+114
-52
lines changed

12 files changed

+114
-52
lines changed

.eslintrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module.exports = {
22
root: true,
3+
reportUnusedDisableDirectives: true,
34
env: {
45
node: true,
56
jest: true,
@@ -14,6 +15,14 @@ module.exports = {
1415
'@bessonovs/eslint-config/typescript',
1516
],
1617
parser: '@typescript-eslint/parser',
18+
parserOptions: {
19+
project: [
20+
'./tsconfig.json',
21+
],
22+
},
23+
ignorePatterns: [
24+
'.eslintrc.js',
25+
],
1726
rules: {
1827
'arrow-body-style': 'off',
1928
'lines-between-class-members': 'off',

.github/release-drafter.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# https://github.com/release-drafter/release-drafter/blob/v5.3.1/.github/release-drafter.yml
2+
name-template: "v$NEXT_PATCH_VERSION"
3+
tag-template: "v$NEXT_PATCH_VERSION"
4+
template: |
5+
# What's Changed
6+
7+
$CHANGES
8+
categories:
9+
- title: "🚀 Features"
10+
labels:
11+
- add
12+
- title: "🐛 Bug Fixes"
13+
labels:
14+
- fix
15+
- title: "♻️ Maintenance"
16+
labels:
17+
- update

.github/workflows/on-commit.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: On commit hook
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
name: test
8+
runs-on: ubuntu-20.04
9+
steps:
10+
- uses: actions/[email protected]
11+
- name: Read .nvmrc
12+
id: nvm
13+
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
14+
- name: Setup node
15+
uses: actions/setup-node@v2
16+
with:
17+
node-version: '${{ steps.nvm.outputs.NVMRC }}'
18+
- name: prepare dependencies
19+
run: npm install
20+
- name: test
21+
run: npm run precommit

.github/workflows/publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
publish:
10+
name: publish
11+
runs-on: ubuntu-20.04
12+
steps:
13+
- uses: actions/[email protected]
14+
- name: Read .nvmrc
15+
id: nvm
16+
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
17+
- name: Setup node
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: '${{ steps.nvm.outputs.NVMRC }}'
21+
- name: prepare dependencies
22+
run: npm install
23+
- name: test
24+
run: npm run precommit
25+
- name: publish
26+
run: |
27+
echo '//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}' >> .npmrc
28+
echo 'registry=https://registry.npmjs.org/' >> .npmrc
29+
echo 'always-auth=true' >> .npmrc
30+
npm publish
31+
env:
32+
CI: true
33+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# https://github.com/marketplace/actions/release-drafter
2+
name: Release Drafter
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
update_release_draft:
11+
runs-on: ubuntu-20.04
12+
steps:
13+
# Drafts your next Release notes as Pull Requests are merged into "master"
14+
- uses: release-drafter/[email protected]
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.travis.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

package.json

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"http",
1717
"server"
1818
],
19-
"version": "0.0.5",
19+
"version": "0.0.6",
2020
"author": "Anton Bessonov",
2121
"license": "MIT",
2222
"repository": "bessonov/node-http-router",
@@ -33,27 +33,26 @@
3333
"precommit": "$_ run test && $_ run lint && $_ run build"
3434
},
3535
"dependencies": {
36-
"fast-url-parser": "1.1.3",
37-
"ts-toolbelt": "6.7.7"
36+
"fast-url-parser": "1.1.3"
3837
},
3938
"devDependencies": {
40-
"@bessonovs/eslint-config": "0.0.6",
41-
"@types/express": "4.17.6",
39+
"@bessonovs/eslint-config": "0.0.7",
40+
"@types/express": "4.17.12",
4241
"@types/jest": "25.2.2",
4342
"@types/node": "14.0.1",
44-
"@typescript-eslint/eslint-plugin": "2.33.0",
45-
"@typescript-eslint/parser": "2.33.0",
46-
"eslint": "7.0.0",
47-
"eslint-config-airbnb": "18.1.0",
48-
"eslint-plugin-import": "2.20.2",
49-
"eslint-plugin-jsx-a11y": "6.2.3",
50-
"eslint-plugin-react": "7.20.0",
51-
"jest": "26.0.1",
43+
"@typescript-eslint/eslint-plugin": "4.28.1",
44+
"@typescript-eslint/parser": "4.28.1",
45+
"eslint": "7.29.0",
46+
"eslint-config-airbnb": "18.2.1",
47+
"eslint-plugin-import": "2.23.4",
48+
"eslint-plugin-jsx-a11y": "6.4.1",
49+
"eslint-plugin-react": "7.24.0",
50+
"jest": "27.0.6",
5251
"micro": "9.3.5-canary.3",
53-
"node-mocks-http": "1.8.1",
54-
"path-to-regexp": "6.1.0",
55-
"ts-jest": "26.0.0",
56-
"typescript": "3.9.2"
52+
"node-mocks-http": "1.10.1",
53+
"path-to-regexp": "6.2.0",
54+
"ts-jest": "27.0.3",
55+
"typescript": "4.3.4"
5756
},
5857
"publishConfig": {
5958
"access": "public"

src/__tests__/router.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
MethodMatcher,
1616
} from '../matchers'
1717

18-
1918
let router: Router
2019

2120
beforeEach(() => {

src/matchers/ExactQueryMatcher.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ implements Matcher<ExactQueryMatchResult<U>> {
4444
params = query.split(/&/).reduce((acc, parts) => {
4545
const part = parts.split(/=/)
4646
const [key, value] = part
47-
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
4847
// @ts-ignore
4948
acc[key] = value
5049
return acc

src/matchers/MatchResult.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { U } from 'ts-toolbelt'
2-
31
type MatchedResult = {
42
matched: true
53
}
@@ -8,12 +6,12 @@ type UnmatchedResult = {
86
matched: false
97
}
108

11-
export type MatchResult<T = {}> = UnmatchedResult | MatchedResult & T
9+
export type MatchResult<T = Record<string, unknown>> = UnmatchedResult | MatchedResult & T
1210

1311
/**
1412
* reperesent matcher result which is matched
1513
*/
16-
export type Matched<MR extends MatchResult> = U.Select<MR, MatchedResult>
14+
export type Matched<MR extends MatchResult> = Extract<MR, MatchedResult>
1715

1816
/**
1917
* check for matched result

0 commit comments

Comments
 (0)