File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 11import { serve } from "bun" ;
2+ import { version } from './package.json'
23import index from "./src/index.html" ;
34
5+ const openBrowser = ( url : string ) => {
6+ const platform = process . platform
7+ let command : string ;
8+
9+ if ( platform === "darwin" ) {
10+ command = "open" ;
11+ } else if ( platform === "win32" ) {
12+ command = "start" ;
13+ } else {
14+ command = "xdg-open" ;
15+ }
16+
17+ Bun . spawn ( [ command , url ] ) ;
18+ }
19+
420const server = serve ( {
521 routes : {
622 "/" : index
723 }
824} )
925
10- console . log ( `Morphaweb is running at: http://localhost:${ server . port } (Cmd+click to open)` ) ;
26+ const url = `http://localhost:${ server . port } ` ;
27+
28+ console . log ( `Morphaweb v${ version } is running at: ${ url } (Cmd+click to open). ` ) ;
29+ console . log ( `Attempting to start in your default browser...` ) ;
30+
31+ openBrowser ( url )
Original file line number Diff line number Diff line change 11import Morphaweb from './Morphaweb'
2- import { version } from '../package.json'
2+ import { version } from '../package.json'
33
44const morphaweb = new Morphaweb ( )
55
You can’t perform that action at this time.
0 commit comments