From c9bf3af29eb5e653cba935d2d1bbc5572b0a90d4 Mon Sep 17 00:00:00 2001 From: lesion Date: Thu, 21 Oct 2021 16:18:58 +0200 Subject: [PATCH] revert cli --- server/cli.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 server/cli.js diff --git a/server/cli.js b/server/cli.js new file mode 100755 index 00000000..b3f50afe --- /dev/null +++ b/server/cli.js @@ -0,0 +1,42 @@ +#!/usr/bin/env node +const pkg = require('../package.json') +const path = require('path') + +process.env.cwd = path.resolve('./') + +process.chdir(path.resolve(__dirname, '..')) + +async function start () { + const suffix = require('../package.json').name.includes('-edge') ? '-edge' : '' + require('@nuxt/cli-edge').run(['start', '--modern']) + .catch((error) => { + console.error(error) + process.exit(2) + }) +} + +console.info(`📅 ${pkg.name} - v${pkg.version} - ${pkg.description} (nodejs: ${process.version}, ENV: ${process.env.NODE_ENV})`) + +require('yargs') + .usage('Usage $0 [options]') + .option('docker', { + alias: 'd', + describe: 'Inside docker', + default: false, + type: 'boolean' + }) + .option('config', { + alias: 'c', + describe: 'Configuration file', + default: path.resolve(process.env.cwd, 'config.json') + }) + .coerce('config', config_path => { + const absolute_config_path = path.resolve(process.env.cwd, config_path) + process.env.config_path = absolute_config_path + return absolute_config_path + }) + .command(['start', 'run', '$0'], 'Start gancio', {}, start) + .help('h') + .alias('h', 'help') + .epilog('Made with ❤ by underscore hacklab - https://gancio.org') + .argv