mirror of
https://framagit.org/les/gancio.git
synced 2025-02-01 00:52:01 +01:00
revert cli
This commit is contained in:
parent
f30bb9a29b
commit
c9bf3af29e
1 changed files with 42 additions and 0 deletions
42
server/cli.js
Executable file
42
server/cli.js
Executable 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
|
Loading…
Reference in a new issue