@@ -13,6 +13,7 @@ const commands = {
13
13
'build' : 'Build & Export a static site' ,
14
14
'upgrade' : 'Upgrade Aleph.js command'
15
15
}
16
+
16
17
const helpMessage = `Aleph.js v${ version }
17
18
The React Framework in deno.
18
19
@@ -60,13 +61,13 @@ async function main() {
60
61
const command = ( hasCommand ? String ( args . shift ( ) ) : 'dev' ) as keyof typeof commands
61
62
62
63
// prints aleph.js version
63
- if ( argOptions . v ) {
64
+ if ( argOptions . v && command != 'upgrade' ) {
64
65
console . log ( `aleph.js v${ version } ` )
65
66
Deno . exit ( 0 )
66
67
}
67
68
68
69
// prints aleph.js and deno version
69
- if ( argOptions . version ) {
70
+ if ( argOptions . version && command != 'upgrade' ) {
70
71
const { deno, v8, typescript } = Deno . version
71
72
console . log ( `aleph.js ${ version } ` )
72
73
console . log ( `deno ${ deno } ` )
@@ -122,8 +123,8 @@ async function main() {
122
123
if ( imports [ 'https://deno.land/x/aleph/' ] ) {
123
124
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 + ) \/ $ / )
124
125
if ( match ) {
125
- const port = parseInt ( match [ 2 ] )
126
126
const cwd = Deno . cwd ( )
127
+ const port = parseInt ( match [ 2 ] )
127
128
listenAndServe ( { port } , async ( req : ServerRequest ) => {
128
129
const url = new URL ( 'http://localhost' + req . url )
129
130
const resp = new Request ( req , { pathname : util . cleanPath ( url . pathname ) , params : { } , query : url . searchParams } )
@@ -160,7 +161,7 @@ async function main() {
160
161
161
162
import ( `./cli/${ command } .ts` ) . then ( ( { default : cmd } ) => {
162
163
if ( command === 'upgrade' ) {
163
- cmd ( )
164
+ cmd ( argOptions . v || argOptions . version || 'latest' )
164
165
} else {
165
166
const appDir = path . resolve ( args [ 0 ] || '.' )
166
167
if ( command !== 'init' && ! existsDirSync ( appDir ) ) {
0 commit comments