2019-06-21 23:52:18 +02:00
|
|
|
#!/usr/bin/env node
|
2019-11-06 11:31:56 +01:00
|
|
|
const pkg = require('../package.json')
|
2019-07-03 16:58:24 +02:00
|
|
|
const path = require('path')
|
2019-06-21 23:52:18 +02:00
|
|
|
|
2021-09-30 11:15:21 +02:00
|
|
|
process.env.cwd = path.resolve('./')
|
2019-07-03 16:58:24 +02:00
|
|
|
|
|
|
|
// needed by nuxt
|
2021-09-30 11:15:21 +02:00
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
|
process.chdir(path.resolve(__dirname, '..'))
|
|
|
|
}
|
2019-06-21 23:52:18 +02:00
|
|
|
|
2021-10-18 15:46:38 +02:00
|
|
|
async function start () {
|
|
|
|
const suffix = require('../package.json').name.includes('-edge') ? '-edge' : ''
|
|
|
|
require('@nuxt/cli' + suffix).run(['start', '--modern'])
|
|
|
|
.catch((error) => {
|
|
|
|
console.error(error)
|
|
|
|
process.exit(2)
|
|
|
|
})
|
2019-07-03 16:58:24 +02:00
|
|
|
}
|
|
|
|
|
2021-09-30 11:15:21 +02:00
|
|
|
console.info(`📅 ${pkg.name} - v${pkg.version} - ${pkg.description} (nodejs: ${process.version}, ENV: ${process.env.NODE_ENV})`)
|
2019-07-03 16:58:24 +02:00
|
|
|
|
|
|
|
require('yargs')
|
2019-11-06 11:31:56 +01:00
|
|
|
.usage('Usage $0 <command> [options]')
|
|
|
|
.option('docker', {
|
|
|
|
alias: 'd',
|
|
|
|
describe: 'Inside docker',
|
|
|
|
default: false,
|
|
|
|
type: 'boolean'
|
|
|
|
})
|
|
|
|
.option('config', {
|
|
|
|
alias: 'c',
|
|
|
|
describe: 'Configuration file',
|
2021-09-30 11:15:21 +02:00
|
|
|
default: path.resolve(process.env.cwd, 'config.json')
|
2019-11-06 11:31:56 +01:00
|
|
|
})
|
|
|
|
.coerce('config', config_path => {
|
2021-09-30 11:15:21 +02:00
|
|
|
const absolute_config_path = path.resolve(process.env.cwd, config_path)
|
2019-11-06 11:31:56 +01:00
|
|
|
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')
|
2019-11-06 14:47:44 +01:00
|
|
|
.argv
|