File tree Expand file tree Collapse file tree 4 files changed +21
-18
lines changed
Expand file tree Collapse file tree 4 files changed +21
-18
lines changed Original file line number Diff line number Diff line change 1+ const program = require ( 'commander' )
2+ const packageJson = require ( '../../package.json' )
3+ const loadInit = require ( './init' )
4+ const loadStart = require ( './start' )
5+
6+ module . exports = function startCli ( server ) {
7+ program . version ( packageJson . version )
8+
9+ loadInit ( program )
10+ loadStart ( program , server )
11+
12+ program . parse ( process . argv )
13+ if ( program . args . length === 0 ) program . help ( )
14+ }
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ const extend = require('extend')
66const packageJson = require ( '../../package.json' )
77const colors = require ( 'colors/safe' )
88
9- module . exports = function ( program ) {
9+ module . exports = function ( program , server ) {
1010 const start = program
1111 . command ( 'start' )
1212 . description ( 'run the Solid server' )
@@ -38,12 +38,12 @@ module.exports = function (program) {
3838 } )
3939 }
4040
41- bin ( argv )
41+ bin ( argv , server )
4242 } )
4343 } )
4444}
4545
46- function bin ( argv ) {
46+ function bin ( argv , server ) {
4747 if ( ! argv . email ) {
4848 argv . email = {
4949 host : argv [ 'emailHost' ] ,
@@ -117,7 +117,7 @@ function bin (argv) {
117117 const solid = require ( '../../' )
118118 let app
119119 try {
120- app = solid . createServer ( argv )
120+ app = solid . createServer ( argv , server )
121121 } catch ( e ) {
122122 if ( e . code === 'EACCES' ) {
123123 console . log ( colors . red . bold ( 'ERROR' ) , 'You need root privileges to start on this port' )
Original file line number Diff line number Diff line change 11#!/usr/bin/env node
2-
3- var program = require ( 'commander' )
4- var packageJson = require ( '../package.json' )
5- var loadInit = require ( './lib/init' )
6- var loadStart = require ( './lib/start' )
7-
8- program
9- . version ( packageJson . version )
10-
11- loadInit ( program )
12- loadStart ( program )
13-
14- program . parse ( process . argv )
15- if ( program . args . length === 0 ) program . help ( )
2+ const startCli = require ( './lib/cli' )
3+ startCli ( )
Original file line number Diff line number Diff line change 11module . exports = require ( './lib/create-app' )
22module . exports . createServer = require ( './lib/create-server' )
3+ module . exports . startCli = require ( './bin/lib/cli' )
You can’t perform that action at this time.
0 commit comments