Created
May 2, 2017 16:14
-
-
Save brunocarvalhodearaujo/0060f28a497c16253eadf037d7f41292 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node --harmony-async-await | |
require('babel-register') | |
const program = require('commander') | |
const { version } = require('../package.json') | |
const { Model } = require('../src/models/Model') | |
// manage startup of application | |
program | |
.command('start') | |
.alias('up') | |
.description('start server of Paper ERP') | |
.option('-p, --port [port]', 'tcp port of listen service') | |
.action(({ port = process.env.PORT || 2650 }) => require('../src').default.listen(port)) | |
// manage database of application | |
program | |
.command('database') | |
.description('manage and setup storage of application') | |
.option('-r, --roolback [roolback]', 'put database into initial state (clear)') | |
.option('-m, --migrate [migrate]', 'migrate database to latest version') | |
.option('-s, --seed [seed]', 'populate database with factory data') | |
.action(({ roolback = false, migrate = false, seed = false }) => new Model().rebuild(roolback, migrate, seed)) | |
// defaults of command line application | |
program | |
.version(version) | |
.parse(process.argv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment