Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Volkov committed Aug 1, 2019
0 parents commit 90a4058
Show file tree
Hide file tree
Showing 15 changed files with 2,422 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
es
lib
28 changes: 28 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
extends:
- standard
- prettier
- prettier/standard

parser: babel-eslint

plugins:
- standard
- prettier

globals:
jasmine: true

env:
browser: true

rules:
no-var: error
prefer-const: error
prettier/prettier:
- error
- trailingComma: es5
singleQuote: true
semi: false

# TODO: The following rules should be removed incrementally in order to fully
# integrate lint rules from the Standard ESLint config and Prettier
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# production files
dist
lib
es


# other
node_modules
*.log
61 changes: 61 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

language: node_js
node_js:
- "node"

cache:
yarn: true
directories:
- "node_modules"

before_install:
- export PACKAGE_VERSION=$(node -p "require('./package.json').version")
- export NPM_REMOTE_VERSION=$(npm view axios-serializy version)
- export PACKAGE_NAME=$(node -p "require('./package.json').name")
- export BRANCH_IS_TAG=$(node -p "/^([0-9].[0-9].[0-9]+((-(alpha|beta))|))$/.test('${TRAVIS_BRANCH}')")
- export GIT_LOG="$(git log --pretty=format:"* %s (%h)")"
- export PROJECT_NAME="acacode/axios-serializy"
- 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

jobs:
include:
- stage: lint
script: yarn 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

# notifications:
# slack:
# rooms:
# secure: NmTpLAVX83pyyKJnTAyCy89XAJioG7dUM86CMl2V7u2Z3BdN4++Ee6pfTQkzrjZ6ITz+kil4Jpn8Vo5AHU18gmDwaqV+xrV2TX3Z58umPXY3tMR4s9STjDukUUhYn6H5m2cwcdScW+00s+aR8KUSkY49YtF3Kbha+EO1rA8/cpT8rINDz9ecUPH6AWuOIWbwpFiUQtrXUUxA9yKoGBRHRy5XX4r3GWuMRBKC4dTk0m1Z9kLgTmpi2ICrPmvzKyMtLspoqJWMO1n7d0saRW7mepJ34alCjaoUGi1lzHqwimCT87pCvwDIF4tXrRVmpCp4ZS1hTYeH/TedJcn+qw1abmmYaeC6fzSCB6DlWWQSJ4NI73pOzWKhQ1Q1SSd/x7ScWy+9K8CNY7jUoUVSMka1fBgeNeGxqezYl1A1GEa/iW6r0uiTOnQYC80UNtCnCbeB4kR6TeofECGWXMwuKOkT9gYnrvR0edGZmwmGqSFiLte86A1rxk3eoQr8NONMr11mkbeAe0hNbcG7TGojy4AwlY/q0VKpw7if0Wo9Hft/26sahFMawT7XvM9QmIs7+/QUnSEdVMDFy/qphQNlSUqNAMJX7U/5dtjc13WUAeNwg6gGAwoaAuE2mysFUYxbtD/KjlYStGFXhGJXilx2MVDZal2ZtDXGxKtIMV1xNF5QwaM=
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# CHANGELOG

<!-- TEMPLATE OF NEW VERSION -->

<!--
## [VERSION](https://github.com/acacode/axios-serializy/releases/tag/VERSION)
### Changed
### Fixed
### Added
### 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
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2018-present Acacode inc.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<div align="center">

<h1>kinka + 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)
[![](https://img.shields.io/travis/acacode/axios-serializy.svg)](https://travis-ci.org/acacode/axios-serializy)
[![](https://www.codefactor.io/repository/github/acacode/axios-serializy/badge/master)](https://www.codefactor.io/repository/github/acacode/axios-serializy/overview/master)
[![](https://img.shields.io/npm/dm/axios-serializy.svg)](http://npm-stat.com/charts.html?package=axios-serializy)
[![](https://badgen.net/bundlephobia/min/axios-serializy)](https://bundlephobia.com/result?p=axios-serializy)
[![](https://badgen.net/bundlephobia/minzip/axios-serializy)](https://bundlephobia.com/result?p=axios-serializy)

<p>
⚡️ Integration <b>serializy</b> with <b>axios</b> ⚡️
</p>
</div>

## 🚀 Installation

$ npm i -S axios-serializy
# or using yarn
$ yarn add axios-serializy

<!-- ## 📚 Usage -->

<!-- ```js
import kinka from 'kinka'
import KinkaSerializy from 'axios-serializy'
const api = kinka.create({
baseURL: 'https://your-api.com',
middlewares: [
KinkaSerializy
]
})
// ...
const { data } = await api.get('/client/1234', {
model: ClientModel
})
console.log(data) // your serialized client model
```
Also if you want to serialize error messages from server you need to:
```js
const api = kinka.create({
baseURL: 'https://your-api.com',
middlewares: [
KinkaSerializy({
errorModel: YourPrettifiedErrorModel
})
]
})
``` -->


## 📝 License

Licensed under the [MIT License](./LICENSE).
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-slate
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [['@babel/preset-env']],
}
16 changes: 16 additions & 0 deletions bin/getLatestTag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const fs = require('fs')
const path = require('path')

const changelog = fs.readFileSync(path.resolve(__dirname, '../CHANGELOG.md'))
const latestVersionRow = changelog
.toString()
.split(/(\r\n)|(\n)/g)
.filter(
str => str && str.startsWith('## ') && !str.startsWith('## [VERSION]')
)[0]

if (!latestVersionRow) {
throw Error('Nothing any versions in changelog')
}

module.exports = latestVersionRow.split(/\[|\]/g)[1].replace(/\./g, '')
Empty file added index.d.ts
Empty file.
74 changes: 74 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"name": "axios-serializy",
"version": "0.0.2",
"license": "MIT",
"description": "integration kinka with serializy",
"main": "lib/axios-serializy.js",
"unpkg": "dist/axios-serializy.js",
"module": "es/axios-serializy.js",
"scripts": {
"build": "rollup -c",
"clean": "rimraf lib dist es",
"lint": "eslint .",
"lint-fix": "eslint . --fix",
"prepare": "yarn clean && yarn build",
"test": "exit 0"
},
"author": {
"name": "acacode"
},
"bugs": {
"url": "https://github.com/acacode/axios-serializy/issues"
},
"homepage": "https://github.com/acacode/axios-serializy#readme",
"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"ajv": "6.0.0",
"babel-eslint": "8.2.1",
"eslint": "4.18.2",
"eslint-config-prettier": "2.9.0",
"eslint-config-standard": "11.0.0",
"eslint-plugin-import": "2.9.0",
"eslint-plugin-node": "6.0.1",
"eslint-plugin-prettier": "2.5.0",
"eslint-plugin-promise": "3.6.0",
"eslint-plugin-standard": "3.0.1",
"js-yaml": "^3.13.1",
"lodash": "^4.17.15",
"prettier": "1.10.2",
"rimraf": "^2.6.3",
"rollup": "1.11.3",
"rollup-plugin-babel": "4.3.2",
"rollup-plugin-commonjs": "9.3.4",
"rollup-plugin-node-resolve": "4.2.3",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-terser": "^4.0.4"
},
"keywords": [
"kinka",
"serializy",
"javascript",
"javascript-library"
],
"typings": "./index.d.ts",
"dependencies": {},
"peerDependencies": {
"kinka": "^3.0.0-alpha.1",
"serializy": "^1.0.0-alpha.2"
},
"repository": {
"type": "git",
"url": "git+https://github.com/acacode/axios-serializy.git"
},
"github": {
"release": true
},
"files": [
"dist",
"lib",
"es",
"src",
"index.d.ts"
]
}
Loading

0 comments on commit 90a4058

Please sign in to comment.