Skip to content

Commit 9564c4e

Browse files
authored
Merge pull request #1 from acacode/develop
First release 0.0.1
2 parents 90a4058 + 5a26a9e commit 9564c4e

9 files changed

+3038
-2082
lines changed

.travis.yml

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ node_js:
44
- "node"
55

66
cache:
7-
yarn: true
87
directories:
98
- "node_modules"
109

@@ -18,44 +17,44 @@ before_install:
1817
- export RELEASE_BODY=$(node -p "'[Click here to see release changes](https://github.com/$PROJECT_NAME/blob/$TRAVIS_BRANCH/CHANGELOG.md#' + require('./bin/getLatestTag.js') + ')'")
1918

2019
install:
21-
- yarn install --frozen-lockfile
20+
- npm ci
2221

2322
jobs:
2423
include:
2524
- stage: lint
26-
script: yarn lint
25+
script: npm run lint
2726
- stage: test
2827
script:
29-
- yarn run build
30-
- yarn test
31-
# - stage: publish
32-
# if: env(BRANCH_IS_TAG) != true AND branch = master AND type = push
33-
# name: "Create Github Release"
34-
# before_deploy:
35-
# - git config --global user.email "builds@travis-ci.com"
36-
# - git config --global user.name "Travis CI"
37-
# - git tag $PACKAGE_VERSION -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER from $TRAVIS_BRANCH"
38-
# - git push -q https://$GITHUB_TOKEN@github.com/$PROJECT_NAME --tags
39-
# - zip -r release.zip dist lib es src index.d.ts LICENSE README.md package.json
40-
# - ls -l
41-
# deploy:
42-
# provider: releases
43-
# name: "Release ${PACKAGE_VERSION}"
44-
# body: "$RELEASE_BODY"
45-
# overwrite: true
46-
# skip_cleanup: true
47-
# api_key:
48-
# secure: ${GITHUB_TOKEN}
49-
# file:
50-
# - release.zip
51-
# on:
52-
# all_branches: true
53-
# repo: $PROJECT_NAME
54-
# after_deploy:
55-
# - echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
56-
# - npm publish
28+
- npm run build
29+
- npm run test
30+
- stage: publish
31+
if: env(BRANCH_IS_TAG) != true AND branch = master AND type = push
32+
name: "Create Github Release"
33+
before_deploy:
34+
- git config --global user.email "builds@travis-ci.com"
35+
- git config --global user.name "Travis CI"
36+
- git tag $PACKAGE_VERSION -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER from $TRAVIS_BRANCH"
37+
- git push -q https://$GITHUB_TOKEN@github.com/$PROJECT_NAME --tags
38+
- zip -r release.zip dist lib es src index.d.ts LICENSE README.md package.json
39+
- ls -l
40+
deploy:
41+
provider: releases
42+
name: "Release ${PACKAGE_VERSION}"
43+
body: "$RELEASE_BODY"
44+
overwrite: true
45+
skip_cleanup: true
46+
api_key:
47+
secure: ${GITHUB_TOKEN}
48+
file:
49+
- release.zip
50+
on:
51+
all_branches: true
52+
repo: $PROJECT_NAME
53+
after_deploy:
54+
- echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
55+
- npm publish
5756

58-
# notifications:
59-
# slack:
60-
# rooms:
61-
# secure: NmTpLAVX83pyyKJnTAyCy89XAJioG7dUM86CMl2V7u2Z3BdN4++Ee6pfTQkzrjZ6ITz+kil4Jpn8Vo5AHU18gmDwaqV+xrV2TX3Z58umPXY3tMR4s9STjDukUUhYn6H5m2cwcdScW+00s+aR8KUSkY49YtF3Kbha+EO1rA8/cpT8rINDz9ecUPH6AWuOIWbwpFiUQtrXUUxA9yKoGBRHRy5XX4r3GWuMRBKC4dTk0m1Z9kLgTmpi2ICrPmvzKyMtLspoqJWMO1n7d0saRW7mepJ34alCjaoUGi1lzHqwimCT87pCvwDIF4tXrRVmpCp4ZS1hTYeH/TedJcn+qw1abmmYaeC6fzSCB6DlWWQSJ4NI73pOzWKhQ1Q1SSd/x7ScWy+9K8CNY7jUoUVSMka1fBgeNeGxqezYl1A1GEa/iW6r0uiTOnQYC80UNtCnCbeB4kR6TeofECGWXMwuKOkT9gYnrvR0edGZmwmGqSFiLte86A1rxk3eoQr8NONMr11mkbeAe0hNbcG7TGojy4AwlY/q0VKpw7if0Wo9Hft/26sahFMawT7XvM9QmIs7+/QUnSEdVMDFy/qphQNlSUqNAMJX7U/5dtjc13WUAeNwg6gGAwoaAuE2mysFUYxbtD/KjlYStGFXhGJXilx2MVDZal2ZtDXGxKtIMV1xNF5QwaM=
57+
notifications:
58+
slack:
59+
rooms:
60+
secure: Pn2kH6U6NCsvGa4P0zEVl/TN+c9wrblBsbNicUVDM/HYFmiB+rPYfAgh6RT1oKxWZNZXl2jGVkBxnIDpNNXHdFRj4zTSbpz5iDNi38n1i70Ch7xfmXWblx4SrEwOVoR/RVS7Kd+IZCyjT5CEygnM/wO/uU5PZHUVsDqpaG/88EsF/gyMCVmaQQHlfDubBjFJ4VQ78RG3SlVv6lC+as9eLmscHO0Z0Bi7rRAs/zNJu11XEOG4Qc3BW1pZVpA6tm19HFdkljdi1YVL2NBgU+0wC/1URhYI5tGFiuXWI0sa7/3pqhKBoi6Mav1kH1ybfbTZwfiywI6MODIeeRa7jpgKg9S9wRu3UQLHI9J4hn+2I7G/6VwWxQTn/AXcqzRAvAqTuQ6KrNl/WgPnQXs5vOGJ2C/2UIKsecL/3W9ecbQNEhCUz13Y8xT5k8tSZDUr353AsvbGx8Y0F0fnzBYOm7kiCijYls22RNOK5/6G4cfNJiALQXwVgQUO1jBAEA2inJgxmkI73k2U4vC51V54EZBa5mr5W/KDBNuSHt7EOJvadqFOpEY5Wfg+aTO/8AH/Y5OOf+HT8GwhnUvYjQFrZ3HGJza6hcxqwx8b0pt9QPY5HM/YxRbbkqhNm08zrsh9HBLl2tZncDtjB+3tbtBMUTDXgP7eZzH93mGnwmkcKSQm7d0=

CHANGELOG.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,7 @@
1111
### Removed
1212
-->
1313

14-
15-
## [0.0.2](https://github.com/acacode/axios-serializy/releases/tag/0.0.2)
16-
17-
### Fixed
18-
- Problem with not serializing server side structures (BREAKING FIX)
19-
- Typings in `index.d.ts` file
20-
2114
## [0.0.1](https://github.com/acacode/axios-serializy/releases/tag/0.0.1)
2215

2316
### Added
2417
- Created project
25-
- Added ability to attach error model for serializing server side error messages

README.md

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22

3-
<h1>kinka + serializy</h1>
3+
<h1>axios + serializy</h1>
44

55
[![](https://img.shields.io/badge/license-MIT-red.svg)](./LICENSE)
66
[![](https://img.shields.io/npm/v/axios-serializy.svg)](https://www.npmjs.com/package/axios-serializy)
@@ -21,18 +21,13 @@
2121
# or using yarn
2222
$ yarn add axios-serializy
2323

24-
<!-- ## 📚 Usage -->
25-
26-
<!-- ```js
27-
import kinka from 'kinka'
28-
import KinkaSerializy from 'axios-serializy'
24+
## 📚 Usage
2925

26+
```js
27+
import axios from 'axios-serializy'
3028

31-
const api = kinka.create({
32-
baseURL: 'https://your-api.com',
33-
middlewares: [
34-
KinkaSerializy
35-
]
29+
const api = axios.create({
30+
baseURL: 'https://your-api.com'
3631
})
3732

3833
// ...
@@ -44,20 +39,17 @@ const { data } = await api.get('/client/1234', {
4439
console.log(data) // your serialized client model
4540
```
4641

47-
Also if you want to serialize error messages from server you need to:
42+
Also if you want to serialize error messages from server you need to call `axios.setErrorModel(Model)`
43+
Before creating axios instance
4844

4945
```js
46+
axios.setErrorModel(YourPrettifiedErrorModel)
5047

51-
const api = kinka.create({
52-
baseURL: 'https://your-api.com',
53-
middlewares: [
54-
KinkaSerializy({
55-
errorModel: YourPrettifiedErrorModel
56-
})
57-
]
48+
const api = axios.create({
49+
baseURL: 'https://your-api.com'
5850
})
5951

60-
``` -->
52+
```
6153

6254

6355
## 📝 License

index.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { AxiosStatic } from 'axios'
2+
import { SerializyInstance } from 'http-helpers-serializy'
3+
4+
// TODO: added typings for 'model' property
5+
6+
export interface AxiosSerializy extends AxiosStatic {
7+
setErrorModel(errorModel: SerializyInstance): void;
8+
}
9+
10+
declare const Axios: AxiosSerializy;
11+
12+
export default Axios;

0 commit comments

Comments
 (0)