Skip to content

Commit 4d62b4f

Browse files
committed
Merge pull request #477 from justicepay/fiximport
small fix(data/schema.js), update webpack-hot-middleware
2 parents b6e088e + 47dc97f commit 4d62b4f

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"replace": "^0.3.0",
7979
"url-loader": "^0.5.7",
8080
"webpack": "^1.12.14",
81-
"webpack-hot-middleware": "^2.7.1",
81+
"webpack-hot-middleware": "^2.8.1",
8282
"webpack-middleware": "^1.4.0"
8383
},
8484
"jest": {

src/data/queries/content.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { join } from 'path';
1212
import Promise from 'bluebird';
1313
import jade from 'jade';
1414
import fm from 'front-matter';
15+
import MarkdownIt from 'markdown-it';
1516

1617
import {
1718
GraphQLString as StringType,
@@ -20,7 +21,7 @@ import {
2021

2122
import ContentType from '../types/ContentType';
2223

23-
const md = require('markdown-it')();
24+
const md = new MarkdownIt();
2425

2526
// A folder with Jade/Markdown/HTML content pages
2627
const CONTENT_DIR = join(__dirname, './content');
@@ -42,7 +43,8 @@ const parseContent = (path, fileContent, extension) => {
4243
default:
4344
return null;
4445
}
45-
return Object.assign({ path, content: htmlContent }, fmContent.attributes);
46+
const smth = Object.assign({ path, content: htmlContent }, fmContent.attributes);
47+
return smth;
4648
};
4749

4850
const readFile = Promise.promisify(fs.readFile);
@@ -84,7 +86,7 @@ async function resolveFileName(path) {
8486
return { success: false, fileName: null, extension: null };
8587
}
8688

87-
export default {
89+
const content = {
8890
type: ContentType,
8991
args: {
9092
path: { type: new NonNull(StringType) },
@@ -99,3 +101,5 @@ export default {
99101
return parseContent(path, source, extension);
100102
},
101103
};
104+
105+
export default content;

src/data/queries/me.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import UserType from '../types/UserType';
1111

12-
export default {
12+
const me = {
1313
type: UserType,
1414
resolve({ request }) {
1515
return request.user && {
@@ -18,3 +18,5 @@ export default {
1818
};
1919
},
2020
};
21+
22+
export default me;

src/data/schema.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ import {
1212
GraphQLObjectType as ObjectType,
1313
} from 'graphql';
1414

15+
import me from './queries/me';
16+
import content from './queries/content';
17+
1518
const schema = new Schema({
1619
query: new ObjectType({
1720
name: 'Query',
1821
fields: {
19-
me: require('./queries/me').default,
20-
content: require('./queries/content').default,
22+
me,
23+
content,
2124
},
2225
}),
2326
});

0 commit comments

Comments
 (0)