Skip to content

Commit

Permalink
format generated index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
timqian committed Mar 27, 2018
1 parent f6ee80b commit f3936de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ if(gqlSchema.getMutationType()) {
mutationsIndexJs += `module.exports.${mutationType} = fs.readFileSync(path.join(__dirname, '${mutationType}.gql'), 'utf8');\n`;
});
fs.writeFileSync(path.join(mutationsFolder, 'index.js'), mutationsIndexJs);
indexJsExportAll += `module.exports.mutations = require('./mutations');
`
indexJsExportAll += `module.exports.mutations = require('./mutations');\n`;
} else {
console.log('[gqlg warning]:', 'No mutation type found in your schema');
}
Expand All @@ -218,7 +217,7 @@ if(gqlSchema.getQueryType()) {
queriesIndexJs += `module.exports.${queryType} = fs.readFileSync(path.join(__dirname, '${queryType}.gql'), 'utf8');\n`;
});
fs.writeFileSync(path.join(queriesFolder, 'index.js'), queriesIndexJs);
indexJsExportAll += `module.exports.queries = require('./queries');`
indexJsExportAll += `module.exports.queries = require('./queries');\n`;
} else {
console.log('[gqlg warning]:', 'No query type found in your schema');
}
Expand All @@ -231,7 +230,7 @@ if(gqlSchema.getSubscriptionType()) {
subscriptionsIndexJs += `module.exports.${subscriptionType} = fs.readFileSync(path.join(__dirname, '${subscriptionType}.gql'), 'utf8');\n`;
});
fs.writeFileSync(path.join(subscriptionsFolder, 'index.js'), subscriptionsIndexJs);
indexJsExportAll += `module.exports.subscriptions = require('./subscriptions');`
indexJsExportAll += `module.exports.subscriptions = require('./subscriptions');\n`;
} else {
console.log('[gqlg warning]:', 'No subscription type found in your schema');
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gql-generator",
"version": "1.0.3",
"version": "1.0.4",
"description": "",
"main": "index.js",
"bin": {
Expand Down

0 comments on commit f3936de

Please sign in to comment.