Skip to content

Commit

Permalink
Merge pull request #477 from justicepay/fiximport
Browse files Browse the repository at this point in the history
small fix(data/schema.js), update webpack-hot-middleware
  • Loading branch information
koistya committed Mar 1, 2016
2 parents b6e088e + 47dc97f commit 4d62b4f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"replace": "^0.3.0",
"url-loader": "^0.5.7",
"webpack": "^1.12.14",
"webpack-hot-middleware": "^2.7.1",
"webpack-hot-middleware": "^2.8.1",
"webpack-middleware": "^1.4.0"
},
"jest": {
Expand Down
10 changes: 7 additions & 3 deletions src/data/queries/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { join } from 'path';
import Promise from 'bluebird';
import jade from 'jade';
import fm from 'front-matter';
import MarkdownIt from 'markdown-it';

import {
GraphQLString as StringType,
Expand All @@ -20,7 +21,7 @@ import {

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

const md = require('markdown-it')();
const md = new MarkdownIt();

// A folder with Jade/Markdown/HTML content pages
const CONTENT_DIR = join(__dirname, './content');
Expand All @@ -42,7 +43,8 @@ const parseContent = (path, fileContent, extension) => {
default:
return null;
}
return Object.assign({ path, content: htmlContent }, fmContent.attributes);
const smth = Object.assign({ path, content: htmlContent }, fmContent.attributes);
return smth;
};

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

export default {
const content = {
type: ContentType,
args: {
path: { type: new NonNull(StringType) },
Expand All @@ -99,3 +101,5 @@ export default {
return parseContent(path, source, extension);
},
};

export default content;
4 changes: 3 additions & 1 deletion src/data/queries/me.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

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

export default {
const me = {
type: UserType,
resolve({ request }) {
return request.user && {
Expand All @@ -18,3 +18,5 @@ export default {
};
},
};

export default me;
7 changes: 5 additions & 2 deletions src/data/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ import {
GraphQLObjectType as ObjectType,
} from 'graphql';

import me from './queries/me';
import content from './queries/content';

const schema = new Schema({
query: new ObjectType({
name: 'Query',
fields: {
me: require('./queries/me').default,
content: require('./queries/content').default,
me,
content,
},
}),
});
Expand Down

0 comments on commit 4d62b4f

Please sign in to comment.