Skip to content

Commit 90a4058

Browse files
author
Sergey Volkov
committed
initial commit
0 parents  commit 90a4058

File tree

15 files changed

+2422
-0
lines changed

15 files changed

+2422
-0
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist
2+
es
3+
lib

.eslintrc.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
extends:
2+
- standard
3+
- prettier
4+
- prettier/standard
5+
6+
parser: babel-eslint
7+
8+
plugins:
9+
- standard
10+
- prettier
11+
12+
globals:
13+
jasmine: true
14+
15+
env:
16+
browser: true
17+
18+
rules:
19+
no-var: error
20+
prefer-const: error
21+
prettier/prettier:
22+
- error
23+
- trailingComma: es5
24+
singleQuote: true
25+
semi: false
26+
27+
# TODO: The following rules should be removed incrementally in order to fully
28+
# integrate lint rules from the Standard ESLint config and Prettier

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# production files
2+
dist
3+
lib
4+
es
5+
6+
7+
# other
8+
node_modules
9+
*.log

.travis.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
2+
language: node_js
3+
node_js:
4+
- "node"
5+
6+
cache:
7+
yarn: true
8+
directories:
9+
- "node_modules"
10+
11+
before_install:
12+
- export PACKAGE_VERSION=$(node -p "require('./package.json').version")
13+
- export NPM_REMOTE_VERSION=$(npm view axios-serializy version)
14+
- export PACKAGE_NAME=$(node -p "require('./package.json').name")
15+
- export BRANCH_IS_TAG=$(node -p "/^([0-9].[0-9].[0-9]+((-(alpha|beta))|))$/.test('${TRAVIS_BRANCH}')")
16+
- export GIT_LOG="$(git log --pretty=format:"* %s (%h)")"
17+
- export PROJECT_NAME="acacode/axios-serializy"
18+
- 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') + ')'")
19+
20+
install:
21+
- yarn install --frozen-lockfile
22+
23+
jobs:
24+
include:
25+
- stage: lint
26+
script: yarn lint
27+
- stage: test
28+
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 "[email protected]"
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://[email protected]/$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
57+
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=

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# CHANGELOG
2+
3+
<!-- TEMPLATE OF NEW VERSION -->
4+
5+
<!--
6+
## [VERSION](https://github.com/acacode/axios-serializy/releases/tag/VERSION)
7+
8+
### Changed
9+
### Fixed
10+
### Added
11+
### Removed
12+
-->
13+
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+
21+
## [0.0.1](https://github.com/acacode/axios-serializy/releases/tag/0.0.1)
22+
23+
### Added
24+
- Created project
25+
- Added ability to attach error model for serializing server side error messages

LICENSE

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

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<div align="center">
2+
3+
<h1>kinka + serializy</h1>
4+
5+
[![](https://img.shields.io/badge/license-MIT-red.svg)](./LICENSE)
6+
[![](https://img.shields.io/npm/v/axios-serializy.svg)](https://www.npmjs.com/package/axios-serializy)
7+
[![](https://img.shields.io/travis/acacode/axios-serializy.svg)](https://travis-ci.org/acacode/axios-serializy)
8+
[![](https://www.codefactor.io/repository/github/acacode/axios-serializy/badge/master)](https://www.codefactor.io/repository/github/acacode/axios-serializy/overview/master)
9+
[![](https://img.shields.io/npm/dm/axios-serializy.svg)](http://npm-stat.com/charts.html?package=axios-serializy)
10+
[![](https://badgen.net/bundlephobia/min/axios-serializy)](https://bundlephobia.com/result?p=axios-serializy)
11+
[![](https://badgen.net/bundlephobia/minzip/axios-serializy)](https://bundlephobia.com/result?p=axios-serializy)
12+
13+
<p>
14+
⚡️ Integration <b>serializy</b> with <b>axios</b> ⚡️
15+
</p>
16+
</div>
17+
18+
## 🚀 Installation
19+
20+
$ npm i -S axios-serializy
21+
# or using yarn
22+
$ yarn add axios-serializy
23+
24+
<!-- ## 📚 Usage -->
25+
26+
<!-- ```js
27+
import kinka from 'kinka'
28+
import KinkaSerializy from 'axios-serializy'
29+
30+
31+
const api = kinka.create({
32+
baseURL: 'https://your-api.com',
33+
middlewares: [
34+
KinkaSerializy
35+
]
36+
})
37+
38+
// ...
39+
40+
const { data } = await api.get('/client/1234', {
41+
model: ClientModel
42+
})
43+
44+
console.log(data) // your serialized client model
45+
```
46+
47+
Also if you want to serialize error messages from server you need to:
48+
49+
```js
50+
51+
const api = kinka.create({
52+
baseURL: 'https://your-api.com',
53+
middlewares: [
54+
KinkaSerializy({
55+
errorModel: YourPrettifiedErrorModel
56+
})
57+
]
58+
})
59+
60+
``` -->
61+
62+
63+
## 📝 License
64+
65+
Licensed under the [MIT License](./LICENSE).

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
theme: jekyll-theme-slate

babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [['@babel/preset-env']],
3+
}

bin/getLatestTag.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const fs = require('fs')
2+
const path = require('path')
3+
4+
const changelog = fs.readFileSync(path.resolve(__dirname, '../CHANGELOG.md'))
5+
const latestVersionRow = changelog
6+
.toString()
7+
.split(/(\r\n)|(\n)/g)
8+
.filter(
9+
str => str && str.startsWith('## ') && !str.startsWith('## [VERSION]')
10+
)[0]
11+
12+
if (!latestVersionRow) {
13+
throw Error('Nothing any versions in changelog')
14+
}
15+
16+
module.exports = latestVersionRow.split(/\[|\]/g)[1].replace(/\./g, '')

0 commit comments

Comments
 (0)