Skip to content

Commit

Permalink
Minor bug fix 👍
Browse files Browse the repository at this point in the history
Shows up warning if mevn generate is used with graphql boilerplate
  • Loading branch information
jamesgeorge007 committed Mar 10, 2019
1 parent b373b35 commit 2c838dc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/commands/basic/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ const shell = require('shelljs');
const inquirer = require('inquirer');
const chalk = require('chalk');
const os = require('os');
const createFile = require('../../utils/createFile');

const { appData } = require('../../utils/projectConfig');
const { configFileExists } = require('../../utils/messages');
const createFile = require('../../utils/createFile');
const { generateRoute } = require('./createRoute');
const { showBanner } = require('../../external/banner');
const { configFileExists } = require('../../utils/messages');
const { templateIsGraphQL } = require('../../utils/messages');

let generatedFileContent;
let generatedFile;
Expand All @@ -36,7 +38,14 @@ exports.generateFile = () => {
showBanner();
configFileExists();

setTimeout(() => {
setTimeout(async () => {
await appData()
.then(data => {
if (data.template === 'graphql') {
templateIsGraphQL();
}
});

inquirer.prompt([{
type: 'list',
name: 'file',
Expand Down
8 changes: 8 additions & 0 deletions lib/utils/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,11 @@ exports.configFileExists = () => {
process.exit(1);
}
};

exports.templateIsGraphQL = () => {
let msg = `GraphQL boilerplate doesn't include ${chalk.yellowBright(`model, route and controller`)} directories!`;
console.log(chalk.redBright(`\n Warning:- ${chalk.cyanBright(`${msg}
`)}`
));
process.exit(1);
};

0 comments on commit 2c838dc

Please sign in to comment.