8000 ✨ release 1.0.0 by js2me · Pull Request #3 · acacode/kinka · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Feb 11, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
4a63254
bump version to .52--alpha, update build
js2me Nov 19, 2018
2914d3b
added extra scripts which needed for the preparing package to new rel…
js2me Dec 12, 2018
b00539e
fix: resolve merge conflicts
js2me Dec 12, 2018
3f37b6a
fix doc problems in package.json and README.md, remove not needed dis…
js2me Dec 12, 2018
65cd31c
fix travis yml file naming, added dist folder to git ignore
js2me Dec 12, 2018
abfa84f
created server for testings
js2me Dec 13, 2018
5da3809
fix: merge conflicts
js2me Dec 13, 2018
472d4e1
bump version for check on working travis config
js2me Dec 13, 2018
23d6af4
fix: update messages from compare-versions script
js2me Dec 13, 2018
6963b5c
fix: short fix in compareVersions function
js2me Dec 13, 2018
ed9e91d
fix: updated prepare-package script, added user friendly messages
js2me Dec 13, 2018
1d30d8d
internal: downgrade package version to test how work travis
js2me Dec 13, 2018
d8c20d4
fix: travis build
js2me Dec 13, 2018
3a23af1
bump version to 1.0.0
js2me Dec 13, 2018
a22adcb
BREAKING CHANGE: renaming 'body' to 'data' option
js2me Dec 16, 2018
9bd2b2b
test: created karma config
js2me Dec 16, 2018
191e372
internal: move travis nodejs scripts to bin folder
js2me Dec 16, 2018
ed9c6bf
initial commit
js2me Dec 17, 2018
d8fea85
test: added a couple unit tests for kinka instance
js2me Dec 17, 2018
acf088e
fix: fix bug with options http method; test: update unit tests, added…
js2me Dec 17, 2018
3726f03
test: updated unit tests for basic methods and created for custom met…
js2me Dec 18, 2018
830b798
travis: updated config, added unit-test script
js2me Dec 18, 2018
dc4eedd
fix: compare-versions and prepare-package paths in scripts after movi…
js2me Dec 18, 2018
541d917
docs: updated README, added emojis
js2me Dec 18, 2018
2c801d4
docs:fix: catchingErrors image path
js2me Dec 18, 2018
176e09e
docs: updated README
js2me Dec 18, 2018
805bea8
docs: README
js2me Dec 18, 2018
41fc779
docs: fix README
js2me Dec 18, 2018
9876268
docs: updated README
js2me Dec 18, 2018
d4ebbfa
docs: short fix README
js2me Dec 18, 2018
569e01b
docs: updated README
js2me Dec 18, 2018
a5bbde7
docs: README
js2me Dec 18, 2018
8bb47c4
test: added common unit tests for methods and custom methods
js2me Dec 18, 2018
9d8737a
test: filled up tests for some things in kinka.js
js2me Dec 18, 2018
c0c9287
Merge remote-tracking branch 'origin/develop' into test/test-base-con…
js2me Dec 18, 2018
4b61f2c
Merge branch 'master' into develop
js2me Dec 19, 2018
141d9f8
Merge branch 'develop' into test/test-base-configuration
js2me Dec 19, 2018
7105dfd
test: wrapped unit tests for 'merge', 'isObject' base helpers
js2me Dec 19, 2018
14c0f9a
fix: merge conflicts after merging master to develop
js2me Dec 20, 2018
5eb4ddc
feat: updated compare-versions script, added create-release, spawn-co…
js2me Dec 20, 2018
51642f5
fix: short: remove unused constant variable
js2me Dec 20, 2018
be863ed
Merge branch 'test/test-base-configuration' of https://github.com/aca…
js2me Dec 20, 2018
685210e
test work release-it
js2me Dec 20, 2018
73fa6b9
Release 0.1.0
js2me Dec 20, 2018
23d9c2b
test: added unit tests for parseJSON, isUndefined base helpers
js2me Dec 20, 2018
841a281
feat: release-it config
js2me Dec 21, 2018
1c65789
bump version, update release-it config
js2me Dec 21, 2018
5a45438
update travis config
js2me Dec 21, 2018
9f98070
remove unused script
js2me Dec 21, 2018
4c78a4f
bump version
js2me Dec 21, 2018
bdbd6db
update after success scripts in travis config, for testing of working…
js2me Dec 21, 2018
a179f3d
fix: merge conflicts
js2me Dec 21, 2018
acd000b
fix: release-it set 'requireCleanWorkingDir' to false
js2me Dec 21, 2018
1d0cde2
fix: release-it config for travis
js2me Dec 21, 2018
4de5250
fix: release-it config
js2me Dec 21, 2018
83d2c0c
fix: travis yml after success scripts, added try release bump
js2me Dec 21, 2018
b520000
fix: release-it travis yml configs
js2me Dec 21, 2018
ab28b03
try to trigger travis build
js2me Dec 21, 2018
00556c5
bump version to .55-alpha, update release-it config
js2me Dec 21, 2018
933edd8
bump version to .56-alpha for testing travis npm publishing
js2me Dec 21, 2018
19330a8
update travis config
js2me Dec 21, 2018
e75707e
fix travis config
js2me Dec 21, 2018
ba34843
bump: version
js2me Dec 21, 2018
5102b0d
fix: release-it, travis configs
js2me Dec 21, 2018
35c751e
fix: return warning
js2me Dec 21, 2018
cd52d1d
fix: merge conflicts
js2me Dec 21, 2018
1014b66
fix: travis config
js2me Dec 21, 2018
ac70b23
fix: merge conflicts
js2me Dec 21, 2018
af39458
fix: solve problems with production files
js2me Dec 21, 2018
bbe1b11
fix travis
js2me Dec 21, 2018
8fc4e1c
removed: unused test files; docs: created CHANGELOG.md
js2me Dec 21, 2018
6568952
bump: version update to .58; update yarn.lock
js2me Dec 21, 2018
0fa155d
update travis config
js2me Dec 21, 2018
c06973a
remove comments from travis config
js2me Dec 21, 2018
0441f7c
fix travis
js2me Dec 21, 2018
51f4327
fix: travis config
js2me Dec 21, 2018
31f1044
dist
js2me Dec 21, 2018
654a965
fix: travis config
js2me Dec 21, 2018
c6a52f3
remove dist folder
js2me Dec 21, 2018
1c92912
fix travis config remote set-url
js2me Dec 21, 2018
126f29b
bump version
js2me Dec 21, 2018
56739f4
bump version
js2me Dec 21, 2018
29da08b
fix travis
js2me Dec 21, 2018
be66644
bump version
js2me Dec 21, 2018
8000 6a103b3
fix travis
js2me Dec 21, 2018
c033eb0
bump version again :C, fix travis
js2me Dec 21, 2018
4ac9a33
fix travis
js2me Dec 21, 2018
6ad4727
Release kinka 0.0.70--alpha [ci skip]
js2me Dec 21, 2018
c038af7
fix
js2me Dec 21, 2018
9157c5c
build release 0.0.75--alpha [ci skip]
js2me Dec 21, 2018
fc0a973
Release kinka 0.0.75--alpha [ci skip]
js2me Dec 21, 2018
6bd8f25
fix travis
js2me Dec 21, 2018
d40c8c8
fix: update travis config
js2me Dec 22, 2018
a113289
update travis config
js2me Dec 22, 2018
d63f8f4
travis fix
js2me Dec 22, 2018
c2d1dd5
trying to fix travis
js2me Dec 22, 2018
1815c2a
change travis
js2me Dec 22, 2018
48f6517
fix travis config
js2me Dec 22, 2018
4c2fc6b
test bump version for testing after release travis config
js2me Dec 22, 2018
280a288
update version to 1.0.0, update travis config
js2me Dec 22, 2018
7074eb6
docs: fix CHANGELOG issues
js2me Dec 22, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": ["env", "es2015", "stage-0"],
"plugins": [
"transform-async-await"
]
}
20 changes: 20 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"non-interactive": true,
"scripts": {
"changelog": "git log --pretty=format:\"* %s (%h)\""
},
"git": {
"requireCleanWorkingDir": false,
"requireUpstream": false,
"commit": true,
"tag": true,
"push": true,
"commitMessage": "Release ${name} ${version} [ci skip]"
},
"npm": {
"publish": false
},
"github": {
"release": true
}
}
37 changes: 37 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
language: node_js
node_js:
- "node"
cache:
yarn: true
directories:
- "node_modules"
before_install:
- echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
- export PACKAGE_VERSION=$(node -p "require('./package.json').version")
- export NPM_REMOTE_VERSION=$(npm view kinka version)
- export PACKAGE_NAME=$(node -p "require('./package.json').name")
install:
- yarn
script:
- yarn lint
- yarn unit-test
- yarn build
after_success:
- ls -l
- git add . && git commit -m "travis: build release ${PACKAGE_VERSION} [ci skip]"
- git status
- env
- git remote rm origin
- git remote add origin https://js2me:${GITHUB_TOKEN}@github.com/acacode/kinka.git
- git remote set-url origin https://js2me:${GITHUB_TOKEN}@github.com/acacode/kinka.git
- git fetch -p
- git fetch
- git symbolic-ref HEAD refs/heads/${TRAVIS_BRANCH}
- git symbolic-ref HEAD
- git remote show origin
- if [ ${TRAVIS_BRANCH} = "master" ] && [ "${TRAVIS_PULL_REQUEST}" = "false" ];then
yarn git-release ${PACKAGE_VERSION};
npm publish;
fi
# - npm publish

28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

# Changelog


## [1.0.0]

### Deprecated
- property `body` in [`KinkaRequestOptions`](./index.d.ts)
Example: `kinka.post('/some-data', { body: { foo: 'bar' }})`
_This property will be removed in the next versions_

### Fixed
- Fixed problems linked with creating request via kinka

### Added
- TravisCI intergration
- Unit tests for:
- kinka instance:
- kinka basic methods (`delete`, `get`, `head`, `options`, `patch`, `post`, `put`)
- kinka `customMethods` option ( `kinka.create({ customMethods: ['foo'] })`)
- `kinka.custom()` function
- kinka `baseURL` option ( `kinka.create({ baseURL: 'https://foo.bar' })`)
- base helpers:
- `merge()`
- `isObject()`
- `parseJSON()`
- `isUndefined()`
- Initial karma config
63 changes: 22 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,38 @@
</a>
<br>
<h1>
<a href="https://github.com/acacode/kinka/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-red.svg?style=flat-square"></a><a href="https://www.npmjs.com/package/kinka"><img src="https://img.shields.io/npm/v/kinka.svg?style=flat-square"></a><a href="https://travis-ci.org/acacode/kinka"><img src="https://img.shields.io/travis/acacode/kinka.svg?style=flat-square"></a><a href="https://www.codefactor.io/repository/github/acacode/kinka/overview/master"><img src="https://www.codefactor.io/repository/github/acacode/kinka/badge/master?style=flat-square"></a><a href="http://npm-stat.com/charts.html?package=kinka"><img src="https://img.shields.io/npm/dm/kinka.svg?style=flat-square"></a><a href="https://bundlephobia.com/result?p=kinka"><img src="https://flat.badgen.net/bundlephobia/min/kinka"></a><a href="https://bundlephobia.com/result?p=kinka"><img src="https://flat.badgen.net/bundlephobia/minzip/kinka"></a>
<a href="https://github.com/acacode/kinka/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-red.svg?style=flat-square"></a><a href="https://www.npmjs.com/package/kinka"><img src="https://img.shields.io/npm/v/kinka.svg?style=flat-square"></a><a href="https://travis-ci.org/acacode/kinka"><img src="https://img.shields.io/travis/acacode/kinka.svg?style=flat-square"></a><a href="https://www.codefactor.io/repository/github/acacode/kinka/overview/master"><img src="https://www.codefactor.io/repository/github/acacode/kinka/badge/master?style=flat-square"></a><br><a href="http://npm-stat.com/charts.html?package=kinka"><img src="https://img.shields.io/npm/dm/kinka.svg?style=flat-square"></a><a href="https://bundlephobia.com/result?p=kinka"><img src="https://flat.badgen.net/bundlephobia/min/kinka"></a><a href="https://bundlephobia.com/result?p=kinka"><img src="https://flat.badgen.net/bundlephobia/minzip/kinka"></a>
</h1>
<p>
Simple and very light HTTP web client.
⚡️ HTTP web client for browsers ⚡️
</p>
</div>
<b>kinka</b> it is very light weight (<b>~4KB minfied version</b>, <b>~1.5KB gzipped</b>) JavaScript library which allows to reduce http code ( which are using <a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest">XMLHttpRequests</a> ) and do http code more simple and easy to read.

❗️❗️❗️**CAUTION**❗️❗️❗️ : Currently it is alpha version. And soon the package will has been updated to [release version (1.0.0)](https://github.com/acacode/kinka/pull/3) and then most changes in the release version will be not compatible with alpha version ( property "body" will be renamed to "data" for more readable ). And also all code of the kinka will has been wrapped to unit tests and ,of course, most bugs has been fixed in the release version.
**kinka** it is very light weight 💨 ([**4KB min**, **1.8KB minzip**](https://bundlephobia.com/result?p=kinka)) and more powerful JavaScript library
It will reduce your http code (which are using [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest)) and allows http code more simple and easy to read.

<a href="https://jsfiddle.net/js2me/0y3ng8xu/"> Test kinka in JSFiddle </a>
## 🚀 Installation

<h2 align="left">Installation</h2>
$ npm i -S kinka
# or using yarn
$ yarn add kinka

npm i -S kinka
## 📚 Documentation & Examples

or using yarn
[Documentation](./docs/documentation.md)
[Examples](./examples)
[Sandbox](https://jsfiddle.net/js2me/0y3ng8xu/)

yarn add kinka
## Why kinka ❔


**It is easiest way to catch your bad request**
![catching error](./docs/images/catchingErrors.png)
**More [powerful things 💪](./docs/documentation.md)(e.g. auto abortable requests) which can improve your interaction with your requests**
![query params example](./docs/images/omitCatchesSample.png)
**Have [very small size](https://bundlephobia.com/result?p=kinka) which can improve site load time**
<!-- <img src="https://github.com/acacode/kinka/raw/master/docs/images/omitCatchesSample.png"><br> -->
<!-- <img src="https://github.com/acacode/kinka/raw/master/docs/images/queryParams.png"><br> -->

<h2 align="left">Documentation</h2>
<a href="https://github.com/acacode/kinka/blob/master/docs/documentation.md">Full documentation is here</a>
## 📝 License

<h2 align="left">Examples</h2>
<img src="https://github.com/acacode/kinka/raw/master/docs/images/defaultUsing.png">
<img src="https://github.com/acacode/kinka/raw/master/docs/images/omitCatchesSample.png">
<img src="https://github.com/acacode/kinka/raw/master/docs/images/queryParams.png">

<h2 aligh="left">LICENSE</h2>

MIT License

Copyright (c) 2018-present Sergey Volkov

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.
Licensed under the [MIT License](./LICENSE).
20 changes: 20 additions & 0 deletions bin/compare-versions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const spawnCommand = require('./spawn-command')
const currentVersion = require('../package.json').version

function compareVersions(packageName) {
spawnCommand(`npm view ${packageName} version`, npmVersion => {
const versionsAreEqual = currentVersion === npmVersion
if (versionsAreEqual) {
throw Error(
`Current version (${currentVersion}) should be updated/changed (npm: ${npmVersion})`
)
} else {
console.log(
`Current version (${currentVersion}) is not equals with npm version (npm: ${npmVersion}). That's fine!`
)
}
process.exit(+versionsAreEqual)
})
}

compareVersions('kinka')
34 changes: 34 additions & 0 deletions bin/spawn-command.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const childProcess = require('child_process')
const isWin = require('os').platform() === 'win32'

function getCommandLine(task, env) {
var file, args
var options = {
stdio: 'pipe',
windowsVerbatimArguments: isWin,
detached: !isWin,
env,
}
if (isWin) {
file = process.env.comspec || 'cmd.exe'
args = ['/s', '/c', task]
} else {
file = '/bin/sh'
args = ['-c', task]
}
return [file, args, options]
}

function spawnCommand(command, callback) {
const procOptions = getCommandLine(command, process.env)
const proc = childProcess.spawn.apply(childProcess, procOptions)
console.log(proc.pid, proc.kill)
proc.stdout.on('data', message => {
const fixedMessage = message.toString().replace('\n', '')
callback(fixedMessage)
proc.kill('SIGINT')
proc.kill('SIGTERM')
})
}

module.exports = spawnCommand
Loading
0