Skip to content

Commit

Permalink
chore: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm committed Mar 13, 2024
1 parent 47e9d56 commit 66f3462
Show file tree
Hide file tree
Showing 14 changed files with 336 additions and 149 deletions.
123 changes: 23 additions & 100 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 12 additions & 8 deletions src/cli/commands/dev.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { existsSync } from 'node:fs'
import { join, resolve } from 'node:path'
import devServer, { defaultOptions } from '@hono/vite-dev-server'
import pc from 'picocolors'
import { createLogger, createServer } from 'vite'

import { version } from '../../version.js'
import { findEntrypoint } from '../utils/findEntrypoint.js'
import { defaultOptions, devServer } from '../vite/dev.js'
import type { Frog } from '../../frog.js'

type DevOptions = {
host?: boolean
Expand Down Expand Up @@ -35,7 +36,6 @@ export async function dev(
// Note: we are not relying on the default export so we can be compatible with
// runtimes that rely on it (e.g. Vercel Serverless Functions).
export: 'app',
injectClientScript: false,
}),
],
publicDir: staticDir ?? 'public',
Expand All @@ -47,10 +47,12 @@ export async function dev(
})

const module = await server.ssrLoadModule(entry_resolved)
const basePath = module.app?.basePath || '/'
const app = module.app as Frog | undefined
const basePath = app?.basePath || '/'

await server.listen()
server.bindCLIShortcuts()
const url = `http://localhost:${server.config.server.port}`

const logger = createLogger()
logger.clearScreen('info')
Expand All @@ -59,9 +61,11 @@ export async function dev(
` ${pc.green('[running]')} ${pc.bold('frog')}@${pc.dim(`v${version}`)}`,
)
logger.info('')
logger.info(
` ${pc.green('➜')} ${pc.bold('Local')}: ${pc.cyan(
`http://localhost:${server.config.server.port}${basePath}`,
)}`,
)
const appUrl = `${url}${basePath}`
logger.info(` ${pc.green('➜')} ${pc.bold('Local')}: ${pc.cyan(appUrl)}`)

if (app?.dev) {
const devUrl = `${url}${app.dev}`
logger.info(` ${pc.green('➜')} ${pc.bold('Inspect')}: ${pc.cyan(devUrl)}`)
}
}
Loading

0 comments on commit 66f3462

Please sign in to comment.