Commit d1f4745f authored by Philipp Nowinski's avatar Philipp Nowinski
Browse files

[BUGFIX] fix running order

parent 5f7d55e6
......@@ -33,38 +33,48 @@ console.log('');
console.log(chalk.green('Your .sgc-config.json is compatible with SGC 2.1.0 ✓'));
fs.writeFile(filePath, jsonFormat(sgcConfiguration), error => console.log);
fs.exists(process.cwd() + '/../.eslintrc.js', exists => {
if (!exists) {
inquirer.prompt([
{
type: 'confirm',
name: 'provideEsLint',
message: 'Looks like you don\'t have an EsLint configuration file, yet. Do you want to include the sgalinski default configuration?'
}
]).then(answers => {
if (answers.provideEsLint) {
request('https://gitlab.sgalinski.de/snippets/28/raw').pipe(fs.createWriteStream(process.cwd() + '/../.eslintrc.js'));
console.log(chalk.green('Add EsLint configuration ✓'));
}
});
} else {
console.log(chalk.green('EsLint configuration found ✓'));
}
});
checkEslint();
fs.exists(process.cwd() + '/../.jshintrc', exists => {
if (exists) {
inquirer.prompt([
{
type: 'confirm',
name: 'removeJsHint',
message: 'The SGC does not use JsHint anymore. Do you want to remove your .jshintrc file?'
}
]).then(answers => {
if (answers.removeJsHint) {
fs.unlink(process.cwd() + '/../.jshintrc', error => console.log);
console.log(chalk.green('Removed .jshintr ✓'));
}
});
}
});
function checkEslint() {
fs.exists(process.cwd() + '/../.eslintrc.js', exists => {
if (!exists) {
console.log('');
inquirer.prompt([
{
type: 'confirm',
name: 'provideEsLint',
message: 'Looks like you don\'t have an EsLint configuration file, yet. Do you want to include the sgalinski default configuration?'
}
]).then(answers => {
if (answers.provideEsLint) {
request('https://gitlab.sgalinski.de/snippets/28/raw').pipe(fs.createWriteStream(process.cwd() + '/../.eslintrc.js'));
console.log(chalk.green('Add EsLint configuration ✓'));
}
checkJsHint();
});
} else {
console.log(chalk.green('EsLint configuration found ✓'));
checkJsHint();
}
});
}
function checkJsHint() {
fs.exists(process.cwd() + '/../.jshintrc', exists => {
if (exists) {
console.log('');
inquirer.prompt([
{
type: 'confirm',
name: 'removeJsHint',
message: 'The SGC does not use JsHint anymore. Do you want to remove your .jshintrc file?'
}
]).then(answers => {
if (answers.removeJsHint) {
fs.unlink(process.cwd() + '/../.jshintrc', error => console.log);
console.log(chalk.green('Removed .jshintr ✓'));
}
});
}
});
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment