@@ -13,6 +13,7 @@ const commands = {
1313 'build' : 'Build & Export a static site' ,
1414 'upgrade' : 'Upgrade Aleph.js command'
1515}
16+
1617const helpMessage = `Aleph.js v${ version }
1718The React Framework in deno.
1819
@@ -60,13 +61,13 @@ async function main() {
6061 const command = ( hasCommand ? String ( args . shift ( ) ) : 'dev' ) as keyof typeof commands
6162
6263 // prints aleph.js version
63- if ( argOptions . v ) {
64+ if ( argOptions . v && command != 'upgrade' ) {
6465 console . log ( `aleph.js v${ version } ` )
6566 Deno . exit ( 0 )
6667 }
6768
6869 // prints aleph.js and deno version
69- if ( argOptions . version ) {
70+ if ( argOptions . version && command != 'upgrade' ) {
7071 const { deno, v8, typescript } = Deno . version
7172 console . log ( `aleph.js ${ version } ` )
7273 console . log ( `deno ${ deno } ` )
@@ -122,8 +123,8 @@ async function main() {
122123 if ( imports [ 'https://deno.land/x/aleph/' ] ) {
123124 const match = String ( imports [ 'https://deno.land/x/aleph/' ] ) . match ( / ^ h t t p : \/ \/ ( l o c a l h o s t | 1 2 7 .0 .0 .1 ) : ( \d + ) \/ $ / )
124125 if ( match ) {
125- const port = parseInt ( match [ 2 ] )
126126 const cwd = Deno . cwd ( )
127+ const port = parseInt ( match [ 2 ] )
127128 listenAndServe ( { port } , async ( req : ServerRequest ) => {
128129 const url = new URL ( 'http://localhost' + req . url )
129130 const resp = new Request ( req , { pathname : util . cleanPath ( url . pathname ) , params : { } , query : url . searchParams } )
@@ -160,7 +161,7 @@ async function main() {
160161
161162 import ( `./cli/${ command } .ts` ) . then ( ( { default : cmd } ) => {
162163 if ( command === 'upgrade' ) {
163- cmd ( )
164+ cmd ( argOptions . v || argOptions . version || 'latest' )
164165 } else {
165166 const appDir = path . resolve ( args [ 0 ] || '.' )
166167 if ( command !== 'init' && ! existsDirSync ( appDir ) ) {
0 commit comments