mirror of
https://github.com/simoneb/axios-hooks.git
synced 2025-12-08 21:25:56 +00:00
0.3.1
This commit is contained in:
parent
b07ceaf9e3
commit
c6535e7d57
12
.babelrc.js
Normal file
12
.babelrc.js
Normal file
@ -0,0 +1,12 @@
|
||||
const { NODE_ENV, BABEL_ENV } = process.env
|
||||
const cjs = NODE_ENV === 'test' || BABEL_ENV === 'commonjs'
|
||||
const loose = true
|
||||
|
||||
module.exports = {
|
||||
presets: [['@babel/env', { loose, modules: false }]],
|
||||
plugins: [
|
||||
['@babel/proposal-object-rest-spread', { loose }],
|
||||
cjs && ['@babel/transform-modules-commonjs', { loose }],
|
||||
['@babel/transform-runtime', { useESModules: !cjs }],
|
||||
].filter(Boolean),
|
||||
}
|
||||
25
.eslintrc
Normal file
25
.eslintrc
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"parser": "babel-eslint",
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:import/recommended",
|
||||
"plugin:prettier/recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true
|
||||
},
|
||||
"globals": {
|
||||
"Promise": true
|
||||
},
|
||||
"rules": {
|
||||
"valid-jsdoc": 2
|
||||
},
|
||||
"plugins": [
|
||||
"import"
|
||||
]
|
||||
}
|
||||
9
.gitignore
vendored
9
.gitignore
vendored
@ -1,7 +1,4 @@
|
||||
/coverage
|
||||
/demo/dist
|
||||
/es
|
||||
/lib
|
||||
/node_modules
|
||||
es
|
||||
lib
|
||||
node_modules
|
||||
npm-debug.log*
|
||||
package-lock.json
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
es/
|
||||
lib/
|
||||
demo/dist/
|
||||
@ -1,12 +1,7 @@
|
||||
language: node_js
|
||||
node_js: 11
|
||||
|
||||
before_install:
|
||||
- npm install coveralls
|
||||
|
||||
after_success:
|
||||
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
|
||||
|
||||
sudo: false
|
||||
script: npm run lint
|
||||
deploy:
|
||||
skip_cleanup: true
|
||||
provider: script
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
## Prerequisites
|
||||
|
||||
[Node.js](http://nodejs.org/) >= 6 must be installed.
|
||||
|
||||
## Installation
|
||||
|
||||
- Running `npm install` in the component's root directory will install everything you need for development.
|
||||
|
||||
## Demo Development Server
|
||||
|
||||
- `npm start` will run a development server with the component's demo app at [http://localhost:3000](http://localhost:3000) with hot module reloading.
|
||||
|
||||
## Running Tests
|
||||
|
||||
- `npm test` will run the tests once.
|
||||
|
||||
- `npm run test:coverage` will run the tests and produce a coverage report in `coverage/`.
|
||||
|
||||
- `npm run test:watch` will run the tests on every change.
|
||||
|
||||
## Building
|
||||
|
||||
- `npm run build` will build the component for publishing to npm and also bundle the demo app.
|
||||
|
||||
- `npm run clean` will delete built resources.
|
||||
21
LICENSE.md
Normal file
21
LICENSE.md
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-present Dan Abramov
|
||||
|
||||
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.
|
||||
@ -1,7 +1,7 @@
|
||||
# axios-hooks
|
||||
|
||||
[](https://travis-ci.org/simoneb/axios-hooks)
|
||||
|
||||

|
||||
[](https://coveralls.io/github/simoneb/axios-hooks?branch=master)
|
||||
|
||||
Describe axios-hooks here.
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
import React from 'react'
|
||||
import { render } from 'react-dom'
|
||||
|
||||
import useAxios from '../../src'
|
||||
|
||||
function AxiosHooksDemo() {
|
||||
const [{ data, loading, error }, reload] = useAxios(
|
||||
'https://jsonplaceholder.typicode.com/todos/1'
|
||||
)
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>axios-hooks demo</h1>
|
||||
<button onClick={reload}>Reload data</button>
|
||||
<div>
|
||||
{loading && 'Loading...'}
|
||||
{error && 'Error!!!'}
|
||||
<pre>{data && JSON.stringify(data, null, 2)}</pre>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
render(<AxiosHooksDemo />, document.querySelector('#demo'))
|
||||
@ -1,7 +0,0 @@
|
||||
module.exports = {
|
||||
type: 'react-component',
|
||||
npm: {
|
||||
esModules: true,
|
||||
umd: false
|
||||
}
|
||||
}
|
||||
5664
package-lock.json
generated
Normal file
5664
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
89
package.json
89
package.json
@ -1,55 +1,68 @@
|
||||
{
|
||||
"name": "axios-hooks",
|
||||
"version": "0.3.0",
|
||||
"version": "0.3.1",
|
||||
"description": "axios-hooks",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
"files": [
|
||||
"es",
|
||||
"lib",
|
||||
"umd"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "nwb build-react-component",
|
||||
"clean": "nwb clean-module && nwb clean-demo",
|
||||
"prepublishOnly": "npm run build",
|
||||
"start": "nwb serve-react-demo",
|
||||
"test": "nwb test-react",
|
||||
"test:coverage": "nwb test-react --coverage",
|
||||
"test:watch": "nwb test-react --server",
|
||||
"pretty": "prettier **/*.{js,json,md,yml} --write"
|
||||
},
|
||||
"dependencies": {
|
||||
"lru-cache": "^5.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.x",
|
||||
"axios": "^0.18.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"husky": "^1.3.1",
|
||||
"lint-staged": "^8.1.4",
|
||||
"nwb": "0.23.x",
|
||||
"prettier": "^1.16.4",
|
||||
"react": "^16.8.2",
|
||||
"react-dom": "^16.8.2"
|
||||
},
|
||||
"author": "Simone Busoli <simone.busoli@gmail.com>",
|
||||
"homepage": "https://github.com/simoneb/axios-hooks",
|
||||
"license": "MIT",
|
||||
"repository": "",
|
||||
"keywords": [
|
||||
"axios",
|
||||
"react",
|
||||
"hooks"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": "Simone Busoli <simone.busoli@gmail.com>",
|
||||
"homepage": "https://github.com/simoneb/axios-hooks",
|
||||
"repository": "simoneb/axios-hooks",
|
||||
"bugs": "https://github.com/simoneb/axios-hooks/issues",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
"files": [
|
||||
"lib",
|
||||
"es",
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
|
||||
"build:es": "babel src --out-dir es",
|
||||
"build": "run-p build:*",
|
||||
"clean": "rimraf lib es coverage",
|
||||
"format": "prettier --write \"src/**/*.{js,md}\"",
|
||||
"lint": "eslint src",
|
||||
"prepare": "npm run clean && npm run build",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"lru-cache": "^5.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0-0",
|
||||
"axios": "^0.18.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.2.3",
|
||||
"@babel/core": "^7.3.3",
|
||||
"@babel/plugin-transform-runtime": "^7.2.0",
|
||||
"@babel/preset-env": "^7.3.1",
|
||||
"axios": "^0.18.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"cross-env": "^5.2.0",
|
||||
"eslint": "^5.14.0",
|
||||
"eslint-config-prettier": "^4.0.0",
|
||||
"eslint-plugin-import": "^2.16.0",
|
||||
"eslint-plugin-prettier": "^3.0.1",
|
||||
"husky": "^1.3.1",
|
||||
"lint-staged": "^8.1.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^1.16.4",
|
||||
"react": "^16.8.2",
|
||||
"react-dom": "^16.8.2",
|
||||
"rimraf": "^2.6.3"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"**/*.{js,json,md,yml}": [
|
||||
"src/**/*.{js,md}": [
|
||||
"prettier --write",
|
||||
"git add"
|
||||
]
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"mocha": true
|
||||
}
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
describe('useAxios', () => {
|
||||
it('works', () => {
|
||||
console.log('all good')
|
||||
})
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user