ring-websites-toolbelt
Version:
Ring Publishing Platform tool to work with Ring Websites
27 lines (21 loc) • 714 B
JavaScript
const fs = require('fs');
const prompts = require('prompts');
const homedir = require('os').homedir();
class Setup {
constructor(options) {
this.options = options;
}
async execute() {
let ScriptClass;
if (fs.existsSync('./theme.json')) {
ScriptClass = require(`./theme/setup`);
} else if (fs.existsSync('./router.json')) {
ScriptClass = require(`./router/setup`);
} else {
throw new Error('There is no "theme.json" or "router.json" file in your current directory.');
}
const script = new ScriptClass(this.options);
await script.execute();
}
}
module.exports = Setup;