Skip to content

Commit 428a71f

Browse files
committed
A few housekeeping items
1 parent 2e52b45 commit 428a71f

17 files changed

+9015
-297
lines changed

.eslintrc.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module.exports = {
2+
env: {
3+
es6: true,
4+
node: true,
5+
jest: true,
6+
},
7+
extends: 'eslint:recommended',
8+
rules: {
9+
indent: ['error', 2, { SwitchCase: 1 }],
10+
'linebreak-style': ['error', 'unix'],
11+
quotes: ['error', 'single'],
12+
semi: ['error', 'always'],
13+
'no-console': ['warn', { allow: ['info', 'error', 'dir'] }],
14+
'arrow-parens': ['error', 'always'],
15+
curly: 'error',
16+
'no-else-return': 'error',
17+
'no-unneeded-ternary': 'error',
18+
'no-useless-return': 'error',
19+
'no-var': 'error',
20+
'one-var': ['error', 'never'],
21+
'prefer-arrow-callback': 'error',
22+
'prefer-const': 'error',
23+
strict: 'error',
24+
'symbol-description': 'error',
25+
yoda: ['error', 'never', { exceptRange: true }],
26+
},
27+
};

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ npm-debug.log*
88

99
build/
1010
node_modules/
11+
coverage/

.npmignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
coverage/
3+
.eslintrc.js

.travis.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: node_js
2+
node_js:
3+
- "node"
4+
before_install:
5+
- npm i -g npm

LICENSE

+5-26
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,9 @@
1-
BSD License
1+
The MIT License (MIT)
22

3-
For GraphQL software
3+
Copyright (c) 2017-present Samer Buna
44

5-
Copyright (c) 2017, jsComplete, Inc. All rights reserved.
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

7-
Redistribution and use in source and binary forms, with or without modification,
8-
are permitted provided that the following conditions are met:
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
98

10-
* Redistributions of source code must retain the above copyright notice, this
11-
list of conditions and the following disclaimer.
12-
13-
* Redistributions in binary form must reproduce the above copyright notice,
14-
this list of conditions and the following disclaimer in the documentation
15-
and/or other materials provided with the distribution.
16-
17-
* Neither the name jsComplete nor the names of its contributors may be used to
18-
endorse or promote products derived from this software without specific
19-
prior written permission.
20-
21-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
25-
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28-
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Graphfront
22

3-
Use a database schema information to generate a GraphQL schema.
3+
Use a PostgreSQL database schema information to generate a GraphQL schema.
44

55
This is a work-in-progress project.
66
It requires a super recent version of Node.js and using it in production is not recommended.
77

88

9+
[![Build Status](https://travis-ci.org/jscomplete/graphfront.svg?branch=master)](https://travis-ci.org/jscomplete/graphfront)
910
[![npm version](https://badge.fury.io/js/graphfront.svg)](https://badge.fury.io/js/graphfront)
1011

1112
## Getting Started
@@ -33,7 +34,7 @@ import { generator } from 'graphfront';
3334
const { getSchema } = generator(dbPool, apiKeyValidator);
3435
```
3536

36-
This defines a a function that can be invoked to generate a schema.
37+
This defines a function that can be invoked to generate a schema.
3738

3839
Or you can use request handler that automatically generates the schema
3940

@@ -59,4 +60,4 @@ Changes are tracked as [Github releases](https://github.com/jscomplete/graphfron
5960

6061
### License
6162

62-
Graphfront is [BSD-licensed](https://github.com/jscomplete/graphfront/blob/master/LICENSE).
63+
Graphfront is released under the [MIT license](https://github.com/jscomplete/graphfront/blob/master/LICENSE).

lib/__tests__/index.test.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use strict';
2+
3+
const graphql = require('graphql');
4+
const graphfront = require('../index');
5+
const graphqlHTTP = require('express-graphql');
6+
7+
describe('Graphfront API', () => {
8+
it('exposes buildSchema and graphqlHTTP', () => {
9+
expect(graphfront.buildSchema).toBe(graphql.buildSchema);
10+
expect(graphfront.graphqlHTTP).toBe(graphqlHTTP);
11+
});
12+
13+
it('must be a top-level function that receives a config object', () => {
14+
expect(() => graphfront({})).not.toThrow();
15+
16+
expect(() => graphfront()).toThrow();
17+
});
18+
19+
it('exposes a schemaDb function', () => {
20+
expect(() => graphfront.schemaDb()).not.toThrow();
21+
});
22+
23+
it('exposes a generator function', () => {
24+
expect(() => graphfront.generator()).not.toThrow();
25+
});
26+
});

lib/config.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
module.exports = {
2-
recordsLimit: process.env.GF_RECORDSLIMIT || 100,
4+
recordsLimit: process.env.GF_RECORDSLIMIT || 100
35
};

0 commit comments

Comments
 (0)