Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small fix(data/schema.js), update webpack-hot-middleware #477

Merged
merged 2 commits into from Mar 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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