Skip to content

Commit e31ac4b

Browse files
authored
fix: update to stable dependency versions (#10)
* fix: update to stable dependency versions Calling this a fix to cause the patch version to bump. * chore: remove unused dependencies * docs: update README with quickstart + fix badges Code Climate badges were loading the wrong repo data. Whoops. * docs: more README improvements
1 parent b87878f commit e31ac4b

File tree

3 files changed

+1134
-1008
lines changed

3 files changed

+1134
-1008
lines changed

README.md

Lines changed: 59 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,90 @@
11
<a href="https://gramps.js.org/"><img src="https://gramps.js.org/assets/img/gramps-banner.png" alt="GrAMPS · An easier way to manage the data sources powering your GraphQL server" width="450"></a>
22

33
# GrAMPS GraphQL Data Source Base
4-
[![Build Status](https://travis-ci.org/gramps-graphql/data-source-base.svg?branch=master)](https://travis-ci.org/gramps-graphql/data-source-base) [![Maintainability](https://api.codeclimate.com/v1/badges/ac264833fac1fbd1afe0/maintainability)](https://codeclimate.com/github/gramps-graphql/data-source-base/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/ac264833fac1fbd1afe0/test_coverage)](https://codeclimate.com/github/gramps-graphql/data-source-base/test_coverage) [![npm version](https://img.shields.io/npm/v/@gramps/data-source-base.svg?style=flat)](https://www.npmjs.com/package/@gramps/data-source-base) [![Greenkeeper badge](https://badges.greenkeeper.io/gramps-graphql/data-source-base.svg)](https://greenkeeper.io/)
54

6-
This is a minimal example and boilerplate for a GrAMPS data source. Inside, you’ll find:
5+
[![Build Status](https://travis-ci.org/gramps-graphql/data-source-base.svg?branch=master)](https://travis-ci.org/gramps-graphql/data-source-base) [![Maintainability](https://api.codeclimate.com/v1/badges/1858e5dd8acfad0d4540/maintainability)](https://codeclimate.com/github/gramps-graphql/data-source-base/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/1858e5dd8acfad0d4540/test_coverage)](https://codeclimate.com/github/gramps-graphql/data-source-base/test_coverage) [![npm version](https://img.shields.io/npm/v/@gramps/data-source-base.svg?style=flat)](https://www.npmjs.com/package/@gramps/data-source-base) [![Greenkeeper badge](https://badges.greenkeeper.io/gramps-graphql/data-source-base.svg)](https://greenkeeper.io/)
76

8-
- **Context** — an object with methods to retrieve/modify data from the data
9-
source (e.g. a CRUD wrapper)
10-
- **Schema** — type definitions for GraphQL to interpret the data (see the
11-
[GraphQL docs on schemas](http://graphql.org/learn/schema/))
12-
- **Resolvers** — functions to map the results of calls to model methods to
13-
the schema
14-
- **Mock Resolvers** — mock functions for offline development
15-
16-
Each file contains a `TODO` comment explaining the changes you’ll need to make to create a working data source.
17-
18-
The goal of this repo is to provide enough code to allow a working example of a data source and its related tests, but to limit how much boilerplate needs to be edited to get your own data source implemented.
19-
20-
## Code Quality and Continuous Integration
21-
22-
To help ensure a reliable, easy-to-maintain data source, this example also includes:
23-
24-
- Configuration for Travis CI (for automated testing) and Code Climate
25-
(for quality analysis)
26-
- Starts you off right with test coverage at 💯
27-
- Provides testing helpers for common resolver testing patterns
28-
- Comes with docs! https://ibm.biz/graphql-data-source
7+
A boilerplate and minimal example for a [GrAMPS data source](https://gramps.js.org/data-source/data-source-overview/).
298

309
## Quickstart
3110

32-
**NOTE:** Replace all instances of `YOUR_DATA_SOURCE_NAME` with the actual name you want to use (e.g. `data-source-companyname-datatype`).
11+
Set up a local data source in seconds with:
3312

34-
```sh
35-
# Get a copy of the data source
36-
npx degit gramps-graphql/data-source-base data-source-YOUR_DATA_SOURCE_NAME
37-
38-
# Move into it
39-
cd data-source-YOUR_DATA_SOURCE_NAME/
13+
```bash
14+
# 💥 zero dependencies! no global installs! create a new data source
15+
npx graphql-cli create -b gramps-graphql/data-source-base data-source-mydata
4016

41-
# IMPORTANT: Make sure to edit the name, description, contributors, and
42-
# repository fields in package.json
17+
# 📂 move into the newly-created data source
18+
cd $_
4319

44-
# Install dependencies
45-
yarn
46-
47-
# Start the dev server
20+
# 🚀 start the GraphQL Playground with your spankin’ new data source
4821
yarn dev
4922
```
5023

51-
You'll see a message with URLs for the GraphQL gateway and the [GraphQL Playground](https://github.com/graphcool/graphql-playground). Open the Playground link (usually http://localhost:8080/playground if you don’t already have something running on port 8080), then run a query:
24+
> **NOTE:** We recommend prefixing data source projects with `data-source-` for clarity and the eventual support of CLI tools to add data sources to your gateway. So if you’re creating a user management data source for the Acme company, we recommend `data-source-acme-users` or `data-source-acmeusers` as a directory/repo name.
25+
26+
> **ALSO NOTE:** `$_` is a handy shortcut for using the last argument passed to the previous command. It [also does other stuff](https://unix.stackexchange.com/questions/280453/understand-the-meaning-of), but that's a rabbit hole for another time.
27+
28+
After running `yarn dev`, you’ll see a message with URLs for the GraphQL gateway and the [GraphQL Playground](https://github.com/graphcool/graphql-playground). Open the Playground link (usually http://localhost:8080/playground if you don’t already have something running on port 8080), then run a query:
5229

5330
```graphql
5431
{
55-
getById(id: 123) {
56-
id
57-
name
58-
lucky_numbers
59-
}
32+
getById(id: 123) {
33+
id
34+
name
35+
lucky_numbers
36+
}
6037
}
6138
```
6239

6340
### To Develop with Mock Data
6441

65-
Start the app with the following command:
42+
Add the `--mock` flag to enable mock data, which is helpful for working offline.
6643

6744
```sh
6845
# Start the gateway with mock data
6946
yarn dev --mock
7047
```
7148

49+
See `src/mocks.js` to modify your mock resolvers.
50+
51+
> **NOTE:** For more information on the GrAMPS CLI and its available options, [check out the docs](https://gramps.js.org/cli/cli-overview/).
52+
53+
### To Run the Tests
54+
55+
GrAMPS data sources start you off with 100% test coverage so you can build high-reliability GraphQL servers without a bunch of setup work.
56+
57+
Run the tests with:
58+
59+
```bash
60+
yarn test
61+
```
62+
63+
## What's Inside?
64+
65+
Inside, you’ll find:
66+
67+
* **Schema** — type definitions for GraphQL to interpret the data (see the
68+
[GraphQL docs on schemas](http://graphql.org/learn/schema/))
69+
* **Resolvers** — functions to map the results of calls to model methods to
70+
the schema
71+
* **Mock Resolvers** — mock functions for offline development
72+
* **Context** — an object with methods to interact with data that is passed to resolver functions
73+
74+
Each file contains a `TODO` comment explaining the changes you’ll need to make to create a working data source.
75+
76+
The goal of this repo is to provide enough code to allow a working example of a data source and its related tests, but to limit how much boilerplate needs to be edited to get your own data source implemented.
77+
78+
## Code Quality and Continuous Integration
79+
80+
To help ensure a reliable, easy-to-maintain data source, this example also includes:
81+
82+
* Configuration for Travis CI (for automated testing) and Code Climate
83+
(for quality analysis)
84+
* Starts you off right with test coverage at 💯
85+
* Provides testing helpers for common resolver testing patterns
86+
* Comes with docs! https://gramps.js.org/data-source/data-source-overview/
87+
7288
### Notes for Developers
7389

7490
Currently, there is no watch capability (PRs welcome!), so the service needs to be stopped (`control` + `C`) and restarted (`yarn dev`) to reflect new changes to the data source.

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,30 @@
3434
"casual": "^1.5.19"
3535
},
3636
"peerDependencies": {
37-
"graphql": "^0.9.0 || ^0.10.0 || ^0.11.0",
37+
"graphql": "^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0",
3838
"graphql-tools": "^1.2.1 || ^2.5.1"
3939
},
4040
"devDependencies": {
41-
"@gramps/cli": "^1.0.0-beta.4",
42-
"@gramps/gramps": "^1.0.0-beta-7",
41+
"@gramps/cli": "^1.1.3",
42+
"@gramps/gramps": "^1.1.0",
4343
"babel-cli": "^6.24.1",
4444
"babel-eslint": "^8.0.3",
45-
"babel-jest": "^21.2.0",
45+
"babel-jest": "^22.0.4",
4646
"babel-plugin-inline-import": "^2.0.6",
4747
"babel-preset-env": "^1.6.1",
48-
"cross-env": "^5.1.1",
48+
"cross-env": "^5.1.3",
4949
"del-cli": "^1.1.0",
5050
"eslint": "^4.13.1",
5151
"eslint-config-airbnb-base": "^12.1.0",
5252
"eslint-config-prettier": "^2.9.0",
5353
"eslint-plugin-import": "^2.8.0",
5454
"eslint-plugin-prettier": "^2.4.0",
55-
"graphql": "^0.11.7",
56-
"graphql-tools": "^2.13.0",
55+
"graphql": "^0.12.3",
56+
"graphql-tools": "^2.14.1",
5757
"husky": "^0.14.3",
58-
"jest": "^21.2.1",
58+
"jest": "^22.0.4",
5959
"prettier": "^1.9.2",
60-
"semantic-release": "^8.2.0"
60+
"semantic-release": "^11.0.2"
6161
},
6262
"jest": {
6363
"coverageReporters": [

0 commit comments

Comments
 (0)