Skip to content

Commit

Permalink
chore: Update dependencies (#61)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Remove Relay Classic support
  • Loading branch information
taion authored Mar 19, 2019
1 parent fc8bb6d commit 17ff83a
Show file tree
Hide file tree
Showing 20 changed files with 3,585 additions and 3,174 deletions.
11 changes: 6 additions & 5 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"presets": [
["env", {
"loose": true
}],
"stage-1"
["@4c", {
"targets": {}
}]
],
"plugins": ["add-module-exports"]
"plugins": [
"add-module-exports"
]
}
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": [
"4catalyzer",
"4catalyzer-jest",
"prettier"
],
"plugins": [
Expand Down
34 changes: 5 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Relay Local Schema [![Travis][build-badge]][build] [![npm][npm-badge]][npm]

Use [Relay](http://facebook.github.io/relay/) without a GraphQL server.

[![Codecov][codecov-badge]][codecov]
[![Discord][discord-badge]][discord]

## Usage

### Relay Modern

```js
import { Environment } from 'react-relay';
import { Network } from 'relay-local-schema';
Expand Down Expand Up @@ -48,33 +48,6 @@ const environment = new Environment({
});
```

### Relay Classic

```js
import RelayLocalSchema from 'relay-local-schema/lib/classic';

import schema from './data/schema';

Relay.injectNetworkLayer(
new RelayLocalSchema.NetworkLayer({ schema })
);
```

This will execute queries against the specified schema locally, rather than against a separate GraphQL server.

You can also supply a GraphQL.js `rootValue` or `contextValue`, or an `onError` callback:

```js
Relay.injectNetworkLayer(
new RelayLocalSchema.NetworkLayer({
schema,
rootValue: 'foo',
contextValue: 'bar',
onError: (errors, request) => console.error(errors, request),
})
);
```

## Caveat

This is intended for exploratory work, integration tests, demos, and working with local data. This is not generally intended as a substitute for a remote GraphQL back end in production.
Expand All @@ -85,5 +58,8 @@ This is intended for exploratory work, integration tests, demos, and working wit
[npm-badge]: https://img.shields.io/npm/v/relay-local-schema.svg
[npm]: https://www.npmjs.org/package/relay-local-schema

[codecov-badge]: https://img.shields.io/codecov/c/github/relay-tools/relay-local-schema/master.svg
[codecov]: https://codecov.io/gh/relay-tools/relay-local-schema

[discord-badge]: https://img.shields.io/badge/Discord-join%20chat%20%E2%86%92-738bd7.svg
[discord]: https://discord.gg/0ZcbPKXt5bX40xsQ
64 changes: 31 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@
],
"main": "lib/index.js",
"scripts": {
"build": "rimraf lib && babel src -d lib",
"build": "BABEL_ENV=production babel src -d lib --delete-dir-on-start",
"build-fixtures": "npm run update-schema && npm run relay-compiler",
"lint": "eslint src test *.js",
"lint": "eslint src test",
"prepublish": "npm run build",
"relay-compiler": "relay-compiler --src test/modern --schema test/fixtures/schema.graphql",
"relay-compiler": "relay-compiler --watchman false --src test --schema test/fixtures/schema.graphql",
"tdd": "jest --watch",
"test": "npm run build-fixtures && npm run lint && npm run testonly -- --coverage",
"testonly": "jest --runInBand --verbose",
"update-schema": "babel-node test/fixtures/updateSchema.js"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": [
"eslint --fix",
Expand Down Expand Up @@ -50,39 +55,32 @@
"homepage": "https://github.com/relay-tools/relay-local-schema#readme",
"peerDependencies": {
"graphql": ">=0.5.0",
"react-relay": ">=1.0.0",
"relay-runtime": ">=1.0.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.2",
"babel-jest": "^22.4.3",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-relay": "^1.5.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-1": "^6.24.1",
"codecov": "^3.0.0",
"eslint": "^4.19.1",
"eslint-config-4catalyzer-react": "^0.4.1",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-react": "^7.7.0",
"@4c/babel-preset": "^4.1.5",
"@babel/cli": "^7.2.3",
"@babel/core": "^7.3.4",
"@babel/node": "^7.2.2",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.5.0",
"babel-plugin-add-module-exports": "^1.0.0",
"babel-plugin-relay": "^3.0.0",
"codecov": "^3.2.0",
"eslint": "^5.15.3",
"eslint-config-4catalyzer": "^0.7.2",
"eslint-config-4catalyzer-jest": "^1.1.2",
"eslint-config-prettier": "^4.1.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jest": "^22.4.1",
"eslint-plugin-prettier": "^3.0.1",
"graphql": "^14.1.1",
"graphql-relay": "^0.5.4",
"husky": "^0.14.3",
"jest": "^22.4.3",
"lint-staged": "^7.0.0",
"prettier": "^1.11.1",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-relay": "^1.5.0",
"relay-compiler": "^1.5.0",
"relay-runtime": "^1.5.0",
"rimraf": "^2.6.2"
"graphql-relay": "^0.6.0",
"husky": "^1.3.1",
"jest": "^24.5.0",
"lint-staged": "^8.1.5",
"prettier": "^1.16.4",
"relay-compiler": "^3.0.0",
"relay-runtime": "^3.0.0"
}
}
File renamed without changes.
53 changes: 0 additions & 53 deletions src/classic/NetworkLayer.js

This file was deleted.

24 changes: 0 additions & 24 deletions src/classic/__forks__/createRequestError.js

This file was deleted.

39 changes: 0 additions & 39 deletions src/classic/__forks__/formatRequestErrors.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/classic/index.js

This file was deleted.

File renamed without changes.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { createFetch, Network } from './modern';
export createFetch from './createFetch';
export Network from './Network';
2 changes: 0 additions & 2 deletions src/modern/index.js

This file was deleted.

8 changes: 8 additions & 0 deletions test/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": [
"@4c"
],
"plugins": [
"relay"
]
}
20 changes: 0 additions & 20 deletions test/.eslintrc

This file was deleted.

9 changes: 5 additions & 4 deletions test/modern/Network.test.js → test/Network.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { Environment, graphql, RecordSource, Store } from 'relay-runtime';

import { Network } from '../../src';
import { Network } from '../src';

import schema, { resetData } from '../fixtures/schema';
import schema, { resetData } from './fixtures/schema';

function executeQuery(environment, taggedNode) {
const {
getRequest,
createOperationSelector,
createOperationDescriptor,
} = environment.unstable_internal;

const query = getRequest(taggedNode);
const operation = createOperationSelector(query);
const operation = createOperationDescriptor(query);

return environment
.execute({ operation })
Expand Down
12 changes: 0 additions & 12 deletions test/classic/.babelrc

This file was deleted.

Loading

0 comments on commit 17ff83a

Please sign in to comment.