Skip to content

Commit

Permalink
Merge pull request #1 from acacode/develop
Browse files Browse the repository at this point in the history
First release 0.0.1
  • Loading branch information
js2me authored Aug 1, 2019
2 parents 90a4058 + 5a26a9e commit 9564c4e
Show file tree
Hide file tree
Showing 9 changed files with 3,038 additions and 2,082 deletions.
69 changes: 34 additions & 35 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ node_js:
- "node"

cache:
yarn: true
directories:
- "node_modules"

Expand All @@ -18,44 +17,44 @@ before_install:
- 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') + ')'")

install:
- yarn install --frozen-lockfile
- npm ci

jobs:
include:
- stage: lint
script: yarn lint
script: npm run lint
- stage: test
script:
- yarn run build
- yarn test
# - stage: publish
# if: env(BRANCH_IS_TAG) != true AND branch = master AND type = push
# name: "Create Github Release"
# before_deploy:
# - git config --global user.email "[email protected]"
# - git config --global user.name "Travis CI"
# - git tag $PACKAGE_VERSION -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER from $TRAVIS_BRANCH"
# - git push -q https://[email protected]/$PROJECT_NAME --tags
# - zip -r release.zip dist lib es src index.d.ts LICENSE README.md package.json
# - ls -l
# deploy:
# provider: releases
# name: "Release ${PACKAGE_VERSION}"
# body: "$RELEASE_BODY"
# overwrite: true
# skip_cleanup: true
# api_key:
# secure: ${GITHUB_TOKEN}
# file:
# - release.zip
# on:
# all_branches: true
# repo: $PROJECT_NAME
# after_deploy:
# - echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
# - npm publish
- npm run build
- npm run test
- stage: publish
if: env(BRANCH_IS_TAG) != true AND branch = master AND type = push
name: "Create Github Release"
before_deploy:
- git config --global user.email "[email protected]"
- git config --global user.name "Travis CI"
- git tag $PACKAGE_VERSION -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER from $TRAVIS_BRANCH"
- git push -q https://[email protected]/$PROJECT_NAME --tags
- zip -r release.zip dist lib es src index.d.ts LICENSE README.md package.json
- ls -l
deploy:
provider: releases
name: "Release ${PACKAGE_VERSION}"
body: "$RELEASE_BODY"
overwrite: true
skip_cleanup: true
api_key:
secure: ${GITHUB_TOKEN}
file:
- release.zip
on:
all_branches: true
repo: $PROJECT_NAME
after_deploy:
- echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
- npm publish

# notifications:
# slack:
# rooms:
# secure: NmTpLAVX83pyyKJnTAyCy89XAJioG7dUM86CMl2V7u2Z3BdN4++Ee6pfTQkzrjZ6ITz+kil4Jpn8Vo5AHU18gmDwaqV+xrV2TX3Z58umPXY3tMR4s9STjDukUUhYn6H5m2cwcdScW+00s+aR8KUSkY49YtF3Kbha+EO1rA8/cpT8rINDz9ecUPH6AWuOIWbwpFiUQtrXUUxA9yKoGBRHRy5XX4r3GWuMRBKC4dTk0m1Z9kLgTmpi2ICrPmvzKyMtLspoqJWMO1n7d0saRW7mepJ34alCjaoUGi1lzHqwimCT87pCvwDIF4tXrRVmpCp4ZS1hTYeH/TedJcn+qw1abmmYaeC6fzSCB6DlWWQSJ4NI73pOzWKhQ1Q1SSd/x7ScWy+9K8CNY7jUoUVSMka1fBgeNeGxqezYl1A1GEa/iW6r0uiTOnQYC80UNtCnCbeB4kR6TeofECGWXMwuKOkT9gYnrvR0edGZmwmGqSFiLte86A1rxk3eoQr8NONMr11mkbeAe0hNbcG7TGojy4AwlY/q0VKpw7if0Wo9Hft/26sahFMawT7XvM9QmIs7+/QUnSEdVMDFy/qphQNlSUqNAMJX7U/5dtjc13WUAeNwg6gGAwoaAuE2mysFUYxbtD/KjlYStGFXhGJXilx2MVDZal2ZtDXGxKtIMV1xNF5QwaM=
notifications:
slack:
rooms:
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=
8 changes: 0 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,7 @@
### Removed
-->


## [0.0.2](https://github.com/acacode/axios-serializy/releases/tag/0.0.2)

### Fixed
- Problem with not serializing server side structures (BREAKING FIX)
- Typings in `index.d.ts` file

## [0.0.1](https://github.com/acacode/axios-serializy/releases/tag/0.0.1)

### Added
- Created project
- Added ability to attach error model for serializing server side error messages
32 changes: 12 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">

<h1>kinka + serializy</h1>
<h1>axios + serializy</h1>

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

<!-- ## 📚 Usage -->

<!-- ```js
import kinka from 'kinka'
import KinkaSerializy from 'axios-serializy'
## 📚 Usage

```js
import axios from 'axios-serializy'

const api = kinka.create({
baseURL: 'https://your-api.com',
middlewares: [
KinkaSerializy
]
const api = axios.create({
baseURL: 'https://your-api.com'
})

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

Also if you want to serialize error messages from server you need to:
Also if you want to serialize error messages from server you need to call `axios.setErrorModel(Model)`
Before creating axios instance

```js
axios.setErrorModel(YourPrettifiedErrorModel)

const api = kinka.create({
baseURL: 'https://your-api.com',
middlewares: [
KinkaSerializy({
errorModel: YourPrettifiedErrorModel
})
]
const api = axios.create({
baseURL: 'https://your-api.com'
})

``` -->
```


## 📝 License
Expand Down
12 changes: 12 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { AxiosStatic } from 'axios'
import { SerializyInstance } from 'http-helpers-serializy'

// TODO: added typings for 'model' property

export interface AxiosSerializy extends AxiosStatic {
setErrorModel(errorModel: SerializyInstance): void;
}

declare const Axios: AxiosSerializy;

export default Axios;
Loading

0 comments on commit 9564c4e

Please sign in to comment.