-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
71 additions
and
27 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env node | ||
|
||
import { program } from 'commander' | ||
import { runMigrations, start } from '../lib.js' | ||
import { fileURLToPath } from 'url' | ||
import { dirname } from 'path' | ||
import execa from 'execa' | ||
|
||
program | ||
.version('1.0.0') | ||
.description('Your CLI description') | ||
.option('-n, --name <name>', 'input name') | ||
.option('-d, --debug', 'output extra debugging') | ||
|
||
program | ||
.command('dev') | ||
.description('Run the development server') | ||
.action(() => { | ||
/* | ||
We run the dev server by invoking nodemon in the applications root directory. | ||
We tell nodemon to watch the app directory for changes, and to execute the dev.js script in the bin directory. | ||
*/ | ||
|
||
const appdir = process.cwd() | ||
|
||
const __filename = fileURLToPath(import.meta.url) | ||
const __dirname = dirname(__filename) | ||
|
||
console.log('Running development server') | ||
execa( | ||
'nodemon', | ||
['--watch', appdir, '--exec', 'node ' + __dirname + '/dev.js'], | ||
{ | ||
stdio: 'inherit', | ||
env: { | ||
...process.env, | ||
NODE_ENV: 'dev', | ||
}, | ||
} | ||
) | ||
}) | ||
|
||
program | ||
.command('migrate') | ||
.description('Run migrations') | ||
.action(() => { | ||
runMigrations() | ||
}) | ||
const options = program.opts() | ||
|
||
if (options.debug) console.log(options) | ||
if (options.name) console.log(`Hello ${options.name}!`) | ||
|
||
program.parse() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env node | ||
import { start } from '../lib.js' | ||
start() |
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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