Skip to content

Commit

Permalink
Merge branch 'master' into greenkeeper/initial
Browse files Browse the repository at this point in the history
  • Loading branch information
dleitee authored Jun 6, 2018
2 parents 5f226d1 + e3b879c commit 8b9353c
Show file tree
Hide file tree
Showing 11 changed files with 238 additions and 26 deletions.
18 changes: 9 additions & 9 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"presets": [
["env", {"modules": false}]
],
"plugins": ["transform-object-rest-spread"],
"env": {
"development": {
"test": {
"presets": ["env", "react"]
},
"rollup": {
"presets": [
["env", {
"modules": false,
}], "react"
],
"plugins": ["external-helpers"]
}
"rollup": {
"presets": [["env", {"modules": false}], "react"],
"plugins": ["transform-object-rest-spread", "external-helpers"]
},
}
}
File renamed without changes.
53 changes: 49 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
{
"extends": ["cheesecakelabs"],
"settings": {
"import/resolver": 0
}
"parser": "babel-eslint",
"extends": ["airbnb", "prettier", "prettier/react"],
"env": {
"browser": true,
"node": true,
"jest": true
},
"rules": {
"semi": ["error", "never"],
"no-console": [
"error",
{
"allow": ["warn", "info", "error"]
}
],
"import/named": "error",
"import/prefer-default-export": "off",
"no-multiple-empty-lines": [
"error",
{
"max": 1,
"maxEOF": 1,
"maxBOF": 0
}
],
"jsx-a11y/href-no-hash": 0,
"import/order": [
"error",
{
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
"newlines-between": "always"
}
],
"react/jsx-filename-extension": "off",
"arrow-parens": ["error", "as-needed"],
"prettier/prettier": [
"error",
{
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"semi": false,
"parser": "babylon",
"printWidth": 100
}
]
},
"plugins": ["react", "prettier"]
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
coverage
node_modules
lib
10 changes: 10 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
src
.circleci
coverage
tests
.babelrc
.eslintrc.json
.prettierrc.json
codecov.yml
rollup.config.js
yarn.lock
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# react-fetches

[![Greenkeeper badge](https://badges.greenkeeper.io/dleitee/react-fetches.svg?token=02c8adf78705fea22a73f5fb6ebb60e58cb82cd203254efc1dc5f141eb9bd461&ts=1528216010503)](https://greenkeeper.io/)
[![codecov](https://codecov.io/gh/dleitee/react-fetches/branch/master/graph/badge.svg?token=HGzOPgq5AL)](https://codecov.io/gh/dleitee/react-fetches)
[![CircleCI](https://circleci.com/gh/dleitee/react-fetches/tree/master.svg?style=svg&circle-token=317c7e90c40a084e9de799bfa3fd963a85c1acb7)](https://circleci.com/gh/dleitee/react-fetches/tree/master)

React Fetches is a simple and efficient way to make requests into your REST API's.

Expand Down Expand Up @@ -43,7 +45,7 @@ So I created the `react-fetches`.
## Install

```sh
npm install --save react-fetches
npm install --save fetches react-fetches
```

## Basic Example
Expand All @@ -52,6 +54,7 @@ npm install --save react-fetches
```es6
import React from 'react'
import { render } from 'react-dom'
import { createClient } from 'fetches'
import { Provider } from 'react-fetches'

import View from './view'
Expand All @@ -70,7 +73,7 @@ render(<Root />, document.getElementById('root'))
**view.js**
```es6
import React, { Component, Fragment } from 'react'
import { connect } from 'fetches'
import { connect } from 'react-fetches'

const mapRequestsToProps = (http, map) => ({
userID: map(http.get('user'), (user) => user.id),
Expand Down
28 changes: 23 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
{
"name": "react-fetches",
"version": "0.1.0-alpha.0",
"version": "1.0.0",
"description": "A new way to perform fetch requests with react.",
"main": "src/index.js",
"main": "./lib/module.js",
"scripts": {
"test": "BABEL_ENV=development jest --config .jestrc.json",
"test": "BABEL_ENV=test jest --config .jestrc.json",
"build": "NODE_ENV=rollup rollup -c",
"eslint": "eslint src tests"
},
"author": "Daniel Leite de Oliveira <dleitee@gmail.com> (https://github.com/dleitee)",
"repository": {
"type": "git",
"url": "git+https://github.com/dleitee/fetches.git"
},
"license": "ISC",
"bugs": {
"url": "https://github.com/dleitee/fetches/issues"
},
"homepage": "https://github.com/dleitee/fetches#readme",
"author": "Daniel Leite de Oliveira <dleitee@gmail.com> (https://github.com/dleitee)",
"dependencies": {
"fetches": "^0.1.3",
"lodash.frompairs": "^4.0.1",
Expand All @@ -22,16 +31,25 @@
"babel-eslint": "^8.2.3",
"babel-jest": "^23.0.1",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"dom-testing-library": "^2.3.2",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-cheesecakelabs": "^2.0.3",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.9.1",
"form-data": "^2.3.2",
"jest": "^23.1.0",
"lodash.get": "^4.4.2",
"nock": "^9.2.6",
"node-fetch": "^2.1.2",
"react-testing-library": "^3.1.3"
"react-testing-library": "^3.1.3",
"rollup": "^0.59.4",
"rollup-plugin-babel": "^3.0.4",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-node-resolve": "^3.3.0"
}
}
23 changes: 23 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import babel from 'rollup-plugin-babel'

export default {
input: 'src/index.js',
output: {
file: 'lib/module.js',
format: 'cjs',
},
plugins: [
babel({ exclude: 'node_modules/**' }),
resolve({
modulesOnly: true,
jsnext: true,
customResolveOptions: {
moduleDirectory: 'node_modules',
},
}),
commonjs(),
],
external: ['fetches', 'lodash.frompairs', 'p-is-promise', 'prop-types', 'react', 'react-dom'],
}
2 changes: 1 addition & 1 deletion src/provider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react'
import React from 'react'
import PropTypes from 'prop-types'
import { Client } from 'fetches'

Expand Down
2 changes: 1 addition & 1 deletion tests/library.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Provider, connect } from '../'
import { Provider, connect } from '../src/'

describe('Library exports', () => {
test('should export Provider and connect', () => {
Expand Down
Loading

0 comments on commit 8b9353c

Please sign in to comment.