Skip to content

Commit df83406

Browse files
committed
chore: cleanup repo boilerplate
- Config files for ESLint, Prettier, Git - Remove Bluemix-specific references from docs, comments, and code - Update README with new commands - Switch to yarn - Add Travis CI config - Add Code Climate config - Remove Bluemix-specific config files
1 parent e2b13ad commit df83406

12 files changed

+5276
-286
lines changed

.codeclimate.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
engines:
3+
duplication:
4+
enabled: true
5+
config:
6+
languages:
7+
- javascript
8+
eslint:
9+
enabled: true
10+
channel: "eslint-4"
11+
checks:
12+
# This appears to be borked in Code Climate’s config
13+
import/extensions:
14+
enabled: false
15+
fixme:
16+
enabled: true
17+
ratings:
18+
paths:
19+
- "**.js"
20+
exclude_paths:
21+
- coverage/
22+
- dist/
23+
- node_modules/
24+
- test/

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/*{.,-}min.js

.gitignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,5 @@ node_modules
66
# Don’t include the built module; npm will do that for us
77
dist
88

9-
# Don’t include sensitive data
10-
config/app_env_private.json
11-
129
# Testing directories
1310
coverage
14-
.nyc_output
15-
sonarlint.json

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package.json
2+
node_modules

.travis.TEMPLATE.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.travis.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
language: node_js
2+
cache:
3+
yarn: true
4+
directories:
5+
- node_modules
6+
node_js:
7+
- "6"
8+
- "7"
9+
- "8"
10+
notifications:
11+
email: false
12+
before_script:
13+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
14+
- chmod +x ./cc-test-reporter
15+
- ./cc-test-reporter before-build
16+
script:
17+
- yarn test
18+
after_script:
19+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
20+
after_success:
21+
- yarn build
22+
- yarn semantic-release
23+
branches:
24+
only:
25+
- master

README.md

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,68 @@
1-
# Bluemix GraphQL Data Source Base
1+
# GrAMPS GraphQL Data Source Base
22

3-
- Provides templates for npm, Travis CI, and SonarQube
4-
- Provides TODO comments next to all items that need to be edited
5-
- Starts with the simplest possible example code to limit how much boilerplate editing is required
6-
- Starts you off right with test coverage at 💯
7-
- Provides testing helpers for common resolver testing patterns
8-
- Comes with docs! https://ibm.biz/graphql-data-source
3+
This is a minimal example and boilerplate for a GrAMPS data source. Inside, you’ll find:
4+
5+
- **Connector** — how to access the data source (e.g. a REST API)
6+
- **Model** — methods to retrieve/modify data from the data source (e.g. a
7+
CRUD wrapper)
8+
- **Schema** — description for GraphQL to interpret the data (see the
9+
[GraphQL docs on schemas](http://graphql.org/learn/schema/))
10+
- **Resolvers** — functions to map the results of calls to model methods to
11+
the schema
12+
13+
Each file contains a `TODO` comment explaining the changes you’ll need to make to create a working data source.
14+
15+
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.
16+
17+
## Code Quality and Continuous Integration
18+
19+
To help ensure a reliable, easy-to-maintain data source, this example also includes:
20+
21+
- Configuration for Travis CI (for automated testing) and Code Climate
22+
(for quality analysis)
23+
- Starts you off right with test coverage at 💯
24+
- Provides testing helpers for common resolver testing patterns
25+
- Comes with docs! https://ibm.biz/graphql-data-source
926

1027
## Quickstart
1128

29+
**NOTE:** Replace all instances of `YOUR_DATA_SOURCE_NAME` with the actual name you want to use (e.g. `data-source-companyname-datatype`).
30+
1231
```sh
1332
# Clone the repo
14-
git clone git@github.ibm.com:Bluemix/graphql-data-source-base.git graphql-data-source-YOUR_DATA_SOURCE_NAME
33+
git clone [email protected]:gramps-graphql/data-source-base.git data-source-YOUR_DATA_SOURCE_NAME
1534

1635
# Move into it
17-
cd graphql-data-source-YOUR_DATA_SOURCE_NAME/
36+
cd data-source-YOUR_DATA_SOURCE_NAME/
1837

1938
# Change the remote repo
20-
git remote set-url origin [email protected]:Bluemix/YOUR_REPO_NAME.git
21-
22-
# Create a package.json
23-
cp package.TEMPLATE.json package.json
39+
git remote set-url origin [email protected]:USER_OR_ORG/YOUR_REPO_NAME.git
2440

25-
# IMPORTANT: Edit name, description, author, and repository in package.json
41+
# IMPORTANT: Make sure to edit the name, description, contributors, and
42+
# repository fields in package.json
2643

2744
# Install dependencies
28-
npm install
45+
yarn install
2946
```
3047

31-
### To Develop In Local Mode
48+
### To Develop with Mock Data
3249

3350
Start the app with the following command:
3451

3552
```sh
36-
# Run in local mode with mock data
37-
npm run local
53+
# Develop with mock data
54+
yarn mock-data
3855
```
3956

40-
### To Develop in Atlas Mode
41-
42-
Create `config/app_env_private.json` by duplicating `config/app_env_private.TEMPLATE.json`. Inside, add the required private environment variables.
43-
44-
> **NOTE:** Information on where to get the required environment variables can
45-
> be found in the "How do I configure my application to use Bluemix?" section
46-
> of [this FAQ](https://ibm.biz/BdjXjr).
57+
### To Develop with Live Data
4758

48-
Next, start the app in Atlas mode:
59+
Once you’ve got your data source configured to load live data, you can enable live data in development:
4960

5061
```sh
51-
# Run in Atlas mode with live data
52-
npm run atlas
62+
# Develop with live data
63+
yarn live-data
5364
```
5465

5566
### Notes for Developers
5667

57-
Currently, there is no watch capability (PRs welcome!), so the service needs to be stopped (`control` + `C`) and restarted (`npm run [local|atlas]`) to reflect new changes to the data source.
68+
Currently, there is no watch capability (PRs welcome!), so the service needs to be stopped (`control` + `C`) and restarted (`yarn [mock-data|live-data]`) to reflect new changes to the data source.

config/routes-atlas.json

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)