Skip to content

Commit

Permalink
feat: add debug parameter to serve (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoboucas committed Mar 21, 2022
1 parent 559d82c commit 95beffe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ImportMap, ImportMapFile } from './import_map.js'
import { generateManifest } from './manifest.js'

interface ServeOptions {
debug?: boolean
distImportMapPath?: string
importMaps?: ImportMapFile[]
onAfterDownload?: LifecycleHook
Expand All @@ -16,7 +17,7 @@ interface ServeOptions {
const serve = async (
port: number,
sourceDirectories: string[],
{ distImportMapPath, importMaps, onAfterDownload, onBeforeDownload }: ServeOptions = {},
{ debug, distImportMapPath, importMaps, onAfterDownload, onBeforeDownload }: ServeOptions = {},
) => {
const deno = new DenoBridge({
onAfterDownload,
Expand All @@ -35,6 +36,10 @@ const serve = async (
const importMap = new ImportMap(importMaps)
const flags = ['-A', '--unstable', '--no-clear-screen', '--watch', `--import-map=${importMap.toDataURL()}`]

if (debug) {
flags.push('--log-level=debug')
}

deno.run(['run', ...flags, preBundlePath, port.toString()], { wait: false })

if (distImportMapPath) {
Expand Down

0 comments on commit 95beffe

Please sign in to comment.