@0divtag/cms_cli
Version:
CLI Tool for installing Blog CMS (https://github.com/0DivTag/blog_cms)
59 lines (44 loc) • 1.54 kB
JavaScript
const util = require('util');
const exec = util.promisify(require('child_process').exec);
var CLI = require('clui'),
Spinner = CLI.Spinner;
const chalk = require('chalk');
const clear = require('clear');
const figlet = require('figlet');
const inquirer = require('./lib/inquirer');
const repo = require('./lib/repo');
const file = require('./lib/files');
clear();
console.log(
chalk.blue(
figlet.textSync('Blog CMS', { horizontalLayout: 'full' })
)
);
const run = async () => {
const method = await inquirer.askInstallMethod();
const User = await inquirer.askUser();
try {
if (method.install == 'local') {
await repo.downloadRepo();
} else {
console.log('\nProduction install is not ready yet :/ Please use local for now.');
process.exit();
}
} catch (err) {
console.log(chalk.red('This Folder seems to be not empty. Please make a new folder and install blog_cms from there.'));
process.exit();
}
await file.writeInitData(User);
console.log(chalk.green(' ✓') + ' Download successfull');
async function start() {
var countdown = new Spinner('Installing dependencies (this could take a while) ', ['⣾','⣽','⣻','⢿','⡿','⣟','⣯','⣷']);
countdown.start();
await exec('npm install');
countdown.stop();
console.log(chalk.green(' ✓') + ' Installed dependencies\n');
console.log('Start MongoDB and the Express Server by executing ' + chalk.green('docker-compose up --build'));
}
start();
};
run();