revert cli

This commit is contained in:
lesion 2021-10-21 16:18:58 +02:00
parent f30bb9a29b
commit c9bf3af29e
No known key found for this signature in database
GPG key ID: 352918250B012177

42
server/cli.js Executable file
View file

@ -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 <command> [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