Skip to content

Commit 31fcea6

Browse files
authored
Merge pull request #24 from storyofams/fix/codecov
[feat] added codecov to test action
2 parents f2c48f1 + fe65ee9 commit 31fcea6

File tree

2 files changed

+64
-30
lines changed

2 files changed

+64
-30
lines changed

.github/workflows/test.yaml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,49 @@
11
name: CI
2-
on: [pull_request]
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
pull_request:
9+
310
jobs:
4-
test:
5-
name: 'Test'
11+
run-tests:
612
runs-on: ubuntu-latest
13+
714
steps:
815
- name: Checkout repo
916
uses: actions/checkout@v2
17+
1018
- name: Setup Node.js
1119
uses: actions/setup-node@v2
1220
with:
1321
node-version: 12
22+
23+
- name: Get yarn cache directory path
24+
id: yarn-cache-dir-path
25+
run: echo "::set-output name=dir::$(yarn cache dir)"
26+
27+
- name: Cache yarn dependencies
28+
uses: actions/cache@v2
29+
id: yarn-cache
30+
with:
31+
path: |
32+
${{ steps.yarn-cache-dir-path.outputs.dir }}
33+
node_modules
34+
*/*/node_modules
35+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
36+
restore-keys: |
37+
${{ runner.os }}-yarn-
38+
1439
- name: Install modules
1540
run: yarn
41+
1642
- name: Run tests
17-
run: yarn test --silent
43+
run: yarn test --silent --coverage
44+
45+
- name: Upload coverage to Codecov
46+
uses: codecov/codecov-action@v1
47+
with:
48+
# project specific codecov token
49+
token: ${{ secrets.CODECOV_TOKEN }}

README.md

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
1-
<p align="center">
1+
<div align="center">
22
<a aria-label="Story of AMS logo" href="https://storyofams.com/" target="_blank" align="center">
33
<img src="https://storyofams.com/public/[email protected]" alt="Story of AMS" width="120">
44
</a>
55
<h1 align="center">@storyofams/next-api-decorators</h1>
6-
</p>
7-
8-
<p align="center">Collection of decorators to create typed Next.js API routes, with easy request validation and transformation.</p>
9-
10-
<p align="center">
11-
<a aria-label="releases" href="https://GitHub.com/storyofams/next-api-decorators/releases/">
12-
<img src="https://github.com/storyofams/next-api-decorators/workflows/Release/badge.svg">
13-
</a>
14-
<a aria-label="npm" href="https://www.npmjs.com/package/@storyofams/next-api-decorators">
15-
<img src="https://img.shields.io/npm/v/@storyofams/next-api-decorators">
16-
</a>
17-
<a aria-label="stars" href="https://github.com/storyofams/next-api-decorators/stargazers/">
18-
<img src="https://img.shields.io/github/stars/storyofams/next-api-decorators.svg?style=social&label=Star&maxAge=86400" />
19-
</a>
20-
</p>
6+
<p align="center">
7+
<a aria-label="releases" href="https://GitHub.com/storyofams/next-api-decorators/releases/" target="_blank">
8+
<img src="https://github.com/storyofams/next-api-decorators/workflows/Release/badge.svg">
9+
</a>
10+
<a aria-label="npm" href="https://www.npmjs.com/package/@storyofams/next-api-decorators" target="_blank">
11+
<img src="https://img.shields.io/npm/v/@storyofams/next-api-decorators">
12+
</a>
13+
<a aria-label="codecov" href="https://codecov.io/gh/storyofams/nextjs-api-decorators" target="_blank">
14+
<img src="https://codecov.io/gh/storyofams/nextjs-api-decorators/branch/master/graph/badge.svg?token=AXW3QH19YI">
15+
</a>
16+
<a aria-label="stars" href="https://github.com/storyofams/next-api-decorators/stargazers/" target="_blank">
17+
<img src="https://img.shields.io/github/stars/storyofams/next-api-decorators.svg?style=social&label=Star&maxAge=86400" />
18+
</a>
19+
</p>
20+
</div>
2121

2222
---
2323

24+
Collection of decorators to create typed Next.js API routes, with easy request validation and transformation.
25+
2426
## Installation
2527

2628
Add the package to your project:
@@ -121,14 +123,14 @@ export default createHandler(User);
121123

122124
### Method decorators
123125

124-
| | Description |
125-
| ----------------------------------------- | -------------------------------------------------- |
126-
| `@Get()` | Marks the method as `GET` handler. |
127-
| `@Post()` | Marks the method as `POST` handler. |
128-
| `@Put()` | Marks the method as `PUT` handler. |
129-
| `@Delete()` | Marks the method as `DELETE` handler. |
130-
| `@SetHeader(name: string, value: string)` | Sets a header name/value into the route response. |
131-
| `@HttpCode(code: number)` | Sets the http code in the route response. |
126+
| | Description |
127+
| ----------------------------------------- | ------------------------------------------------- |
128+
| `@Get()` | Marks the method as `GET` handler. |
129+
| `@Post()` | Marks the method as `POST` handler. |
130+
| `@Put()` | Marks the method as `PUT` handler. |
131+
| `@Delete()` | Marks the method as `DELETE` handler. |
132+
| `@SetHeader(name: string, value: string)` | Sets a header name/value into the route response. |
133+
| `@HttpCode(code: number)` | Sets the http code in the route response. |
132134

133135
### Parameter decorators
134136

@@ -151,8 +153,8 @@ Pipes are being used to validate and transform incoming values. The pipes can be
151153

152154
⚠️ Beware that they throw when the value is invalid.
153155

154-
| | Description | Remarks |
155-
| ------------------ | -------------------------------------------- | --------------------------------------------- |
156+
| | Description | Remarks |
157+
| ------------------ | ------------------------------------------- | --------------------------------------------- |
156158
| `ParseNumberPipe` | Validates and transforms `Number` strings. | Uses `parseFloat` under the hood |
157159
| `ParseBooleanPipe` | Validates and transforms `Boolean` strings. | Allows `'true'` and `'false'` as valid values |
158160

0 commit comments

Comments
 (0)