Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydenseric committed May 1, 2019
2 parents 12247fc + c3f9127 commit 9685511
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 76 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["env"]
}
5 changes: 5 additions & 0 deletions .huskyrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"hooks": {
"pre-commit": "lint-staged"
}
}
4 changes: 4 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.js": "eslint",
"*.{json,yml,md}": "prettier -l"
}
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"proseWrap": "never",
"singleQuote": true,
"semi": false
}
6 changes: 6 additions & 0 deletions .size-limit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"limit": "1 KB",
"ignore": ["apollo-link", "apollo-link-http-common"]
}
]
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

### Patch

- Updated dependencies.
- Reduced the size of the published `package.json` by moving dev tool config to files. This also prevents editor extensions such as Prettier and ESLint from detecting config and attempting to operate when opening package files installed in `node_modules`.
- Simplified the `prepublishOnly` script.
- Add tips for React Native gotchas, via [#135](https://github.com/jaydenseric/apollo-upload-client/pull/135).

## 10.0.0
Expand Down
74 changes: 21 additions & 53 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,28 @@
},
"browserslist": "> 0.5%, not dead, node 6",
"dependencies": {
"apollo-link": "^1.2.6",
"apollo-link-http-common": "^0.2.8",
"extract-files": "^5.0.0"
"apollo-link": "^1.2.11",
"apollo-link-http-common": "^0.2.13",
"extract-files": "^5.0.1"
},
"devDependencies": {
"@babel/cli": "^7.2.0",
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.2.0",
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"babel-eslint": "^10.0.1",
"eslint": "^5.10.0",
"eslint-config-env": "^2.0.0",
"eslint-config-prettier": "^3.3.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-import-order-alphabetical": "^0.0.1",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-prettier": "^3.0.0",
"graphql": "^14.0.2",
"husky": "^1.3.0",
"jsdoc-md": "^1.7.0",
"lint-staged": "^8.1.0",
"prettier": "^1.15.3",
"size-limit": "^0.21.0"
"eslint": "^5.16.0",
"eslint-config-env": "^4.0.0",
"eslint-config-prettier": "^4.2.0",
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-import-order-alphabetical": "^0.0.2",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-prettier": "^3.0.1",
"graphql": "^14.2.1",
"husky": "^2.1.0",
"jsdoc-md": "^2.1.0",
"lint-staged": "^8.1.5",
"prettier": "^1.17.0",
"size-limit": "^1.3.0"
},
"scripts": {
"prepare": "npm run prepare:clean && npm run prepare:js && npm run prepare:jsdoc && npm run prepare:prettier",
Expand All @@ -66,38 +66,6 @@
"test:eslint": "eslint .",
"test:prettier": "prettier '**/*.{json,yml,md}' -l",
"test:size": "size-limit",
"prepublishOnly": "npm run prepare && npm test"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": "eslint",
"*.{json,yml,md}": "prettier -l"
},
"eslintIgnore": [
"lib"
],
"eslintConfig": {
"extends": [
"env"
]
},
"prettier": {
"proseWrap": "never",
"singleQuote": true,
"semi": false
},
"size-limit": [
{
"name": "CJS",
"limit": "1 KB",
"ignore": [
"apollo-link",
"apollo-link-http-common"
]
}
]
"prepublishOnly": "npm test"
}
}
52 changes: 29 additions & 23 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ client.mutate({

Used to mark a [React Native `File` substitute](#type-reactnativefilesubstitute). It’s too risky to assume all objects with `uri`, `type` and `name` properties are files to extract. Re-exported from [`extract-files`](https://npm.im/extract-files) for convenience.

| Parameter | Type | Description |
| :-------- | :----------------------------------------------------------- | :----------------------------------------------------------------------------------- |
| `file` | [ReactNativeFileSubstitute](#type-reactnativefilesubstitute) | A React Native [`File`](https://developer.mozilla.org/docs/web/api/file) substitute. |
| Parameter | Type | Description |
| :-- | :-- | :-- |
| `file` | [ReactNativeFileSubstitute](#type-reactnativefilesubstitute) | A React Native [`File`](https://developer.mozilla.org/docs/web/api/file) substitute. |

#### Examples

Expand All @@ -158,19 +158,21 @@ _A React Native file that can be used in query or mutation variables._
> })
> ```
---
### function createUploadLink
Creates a terminating [Apollo Link](https://apollographql.com/docs/link) capable of file uploads. Options match [`createHttpLink`](https://apollographql.com/docs/link/links/http#options).
| Parameter | Type | Description |
| :-------------------------- | :-------------------------------------------- | :------------------------------------------------------------------------------------------------ |
| `options` | [Object](https://mdn.io/object) | Options. |
| `options.uri` | [string](https://mdn.io/string)? = `/graphql` | GraphQL endpoint URI. |
| `options.fetch` | [function](https://mdn.io/function)? | [`fetch`](https://fetch.spec.whatwg.org) implementation to use, defaulting to the `fetch` global. |
| `options.fetchOptions` | [FetchOptions](#type-fetchoptions)? | `fetch` options; overridden by upload requirements. |
| `options.credentials` | [string](https://mdn.io/string)? | Overrides `options.fetchOptions.credentials`. |
| `options.headers` | [Object](https://mdn.io/object)? | Merges with and overrides `options.fetchOptions.headers`. |
| `options.includeExtensions` | [boolean](https://mdn.io/boolean)? = `false` | Toggles sending `extensions` fields to the GraphQL server. |
| Parameter | Type | Description |
| :-- | :-- | :-- |
| `options` | Object | Options. |
| `options.uri` | string? = `/graphql` | GraphQL endpoint URI. |
| `options.fetch` | function? | [`fetch`](https://fetch.spec.whatwg.org) implementation to use, defaulting to the `fetch` global. |
| `options.fetchOptions` | [FetchOptions](#type-fetchoptions)? | `fetch` options; overridden by upload requirements. |
| `options.credentials` | string? | Overrides `options.fetchOptions.credentials`. |
| `options.headers` | Object? | Merges with and overrides `options.fetchOptions.headers`. |
| `options.includeExtensions` | boolean? = `false` | Toggles sending `extensions` fields to the GraphQL server. |
**Returns:** ApolloLink — A terminating [Apollo Link](https://apollographql.com/docs/link) capable of file uploads.
Expand All @@ -194,34 +196,38 @@ _A basic Apollo Client setup._
> })
> ```
---
### type FetchOptions
GraphQL request `fetch` options.
**Type:** [Object](https://mdn.io/object)
**Type:** Object
| Property | Type | Description |
| :------------ | :------------------------------- | :------------------------------- |
| `headers` | [Object](https://mdn.io/object) | HTTP request headers. |
| `credentials` | [string](https://mdn.io/string)? | Authentication credentials mode. |
| Property | Type | Description |
| :------------ | :------ | :------------------------------- |
| `headers` | Object | HTTP request headers. |
| `credentials` | string? | Authentication credentials mode. |
#### See
- [Polyfillable fetch options](https://github.github.io/fetch#options).
---
### type ReactNativeFileSubstitute
A React Native [`File`](https://developer.mozilla.org/docs/web/api/file) substitute.
Be aware that inspecting network requests with Chrome dev tools interferes with the React Native `FormData` implementation, causing network errors.
**Type:** [Object](https://mdn.io/object)
**Type:** Object
| Property | Type | Description |
| :------- | :------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `uri` | [String](https://mdn.io/string) | Filesystem path. |
| `name` | [String](https://mdn.io/string)? | File name. |
| `type` | [String](https://mdn.io/string)? | File content type. Some environments (particularly Android) require a valid MIME type; Expo `ImageResult.type` is unreliable as it can be just `image`. |
| Property | Type | Description |
| :-- | :-- | :-- |
| `uri` | String | Filesystem path. |
| `name` | String? | File name. |
| `type` | String? | File content type. Some environments (particularly Android) require a valid MIME type; Expo `ImageResult.type` is unreliable as it can be just `image`. |
#### See
Expand Down

0 comments on commit 9685511

Please sign in to comment.