-
-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Towards #86 🎉 Change the path for mevn.json config file * v1.0.8 release 🚀
- Loading branch information
1 parent
aa915a0
commit 89a9b29
Showing
17 changed files
with
164 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
node_modules | ||
lib/files/routes/* | ||
lib/utils/createFile.js | ||
lib/templates/routes/* | ||
lib/utils/createFile.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,36 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
const shell = require('shelljs'); | ||
const inquirer = require('inquirer'); | ||
const chalk = require('chalk'); | ||
const createFile = require('../utils/createFile'); | ||
|
||
const { showBanner } = require('../external/banner'); | ||
const { configFileExists } = require('../utils/messages'); | ||
|
||
exports.generateConfig = () => { | ||
if(!fs.existsSync('./mevn.json')){ | ||
console.log(chalk.red.bold('\n Make sure that you are having a valid MEVN stack project in path')); | ||
process.exit(1); | ||
} | ||
showBanner(); | ||
configFileExists(); | ||
|
||
let data = fs.readFileSync('./mevn.json', 'utf8'); | ||
let appname = JSON.parse(data); | ||
shell.cd(appname.project_name); | ||
shell.cd('server'); | ||
shell.cd('config'); | ||
setTimeout(() => { | ||
shell.cd('server/config'); | ||
|
||
inquirer.prompt([{ | ||
name: 'db', | ||
type: 'input', | ||
message: 'Enter the url for the database : ', | ||
}]).then((answers) => { | ||
inquirer.prompt([{ | ||
name: 'db', | ||
type: 'input', | ||
message: 'Enter the url for the database : ', | ||
}]).then((answer) => { | ||
|
||
const content = 'module.exports = {\n \'url\': "' + answers.db + '"\n}'; | ||
const configFileContent = [ | ||
'{', | ||
` "url": "${answer.db}"`, | ||
'}' | ||
]; | ||
|
||
createFile('./config.js', content, { flag: 'wx' }, (err) => { | ||
if (err) throw err; | ||
console.log(chalk.yellow('File Created...!')); | ||
createFile('./config.js', configFileContent.join('\n').toString(), { flag: 'wx' }, (err) => { | ||
if (err) throw err; | ||
console.log(chalk.yellow('File Created...!')); | ||
}); | ||
}); | ||
}); | ||
}, 200); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.