Skip to content

Commit 38a5732

Browse files
authored
Refactor project structure (#15)
* Refactor project structure * Add missing lint script * Add missing nodemon
1 parent 974d949 commit 38a5732

16 files changed

+1017
-3224
lines changed

.babelrc

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"presets": ["env"],
3-
"plugins": ["babel-plugin-inline-import"]
2+
"presets": ["env"]
43
}

.eslintrc.js

+4-21
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,9 @@
11
module.exports = {
2-
extends: ['airbnb-base', 'prettier', 'plugin:jest/recommended'],
2+
rules: {
3+
'import/no-extraneous-dependencies': 0,
4+
},
5+
extends: 'callstack-io',
36
env: {
4-
es6: true,
5-
node: true,
67
jest: true,
78
},
8-
plugins: ['jest', 'prettier'],
9-
rules: {
10-
'import/extensions': 0,
11-
'import/no-unresolved': 0,
12-
'class-methods-use-this': 0,
13-
'import/prefer-default-export': 0,
14-
'no-class-assign': 0,
15-
'no-underscore-dangle': 0,
16-
'no-unused-expressions': 0,
17-
'no-use-before-define': 0,
18-
'prettier/prettier': [
19-
'error',
20-
{
21-
singleQuote: true,
22-
trailingComma: 'es5',
23-
},
24-
],
25-
},
269
};

example/.babelrc

-4
This file was deleted.

example/__tests__/person.test.js

-24
This file was deleted.

example/dev.js

-3
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1-
const data = [
1+
module.exports = [
22
{ personId: 1, name: 'Kevin Odling' },
33
{ personId: 2, name: 'Farah Bennett' },
44
{ personId: 3, name: 'Arian Guthrie' },
55
{ personId: 4, name: 'Serena Monroe' },
66
];
7-
8-
const resolvers = {
9-
Query: {
10-
persons: () => data,
11-
},
12-
};
13-
14-
export default resolvers;

example/src/index.js renamed to example/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import express from 'express';
2-
import bodyParser from 'body-parser';
3-
import { graphqlExpress, graphiqlExpress } from 'apollo-server-express';
4-
import schema from './schema';
1+
const express = require('express');
2+
const bodyParser = require('body-parser');
3+
const { graphqlExpress, graphiqlExpress } = require('apollo-server-express');
4+
const schema = require('./schema');
55

66
const PORT = process.env.PORT || 3003;
77
const HOST = process.env.HOST || 'localhost';

example/package.json

-27
This file was deleted.

example/schema.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const { makeExecutableSchema } = require('graphql-tools');
2+
const graphqlDirectiveUid = require('../index');
3+
const fakeData = require('./fakeData');
4+
5+
const typeDefs = `
6+
type Person @uid(from: ["personId", "name"]){
7+
personId: Int
8+
name: String
9+
}
10+
11+
type Query {
12+
persons: [Person]
13+
}
14+
`;
15+
16+
const resolvers = {
17+
Query: {
18+
persons: () => fakeData,
19+
},
20+
};
21+
22+
module.exports = makeExecutableSchema({
23+
typeDefs,
24+
resolvers,
25+
schemaDirectives: {
26+
uid: graphqlDirectiveUid,
27+
},
28+
});

example/src/schema.graphql

-8
This file was deleted.

example/src/schema.js

-12
This file was deleted.

0 commit comments

Comments
 (0)