Skip to content

Commit

Permalink
feat: use default logger in DenoBridge (#89)
Browse files Browse the repository at this point in the history
* feat: use default logger in DenoBridge

* refactor: use `getLogger` instead of `getDefaultLogger`
  • Loading branch information
eduardoboucas committed Aug 8, 2022
1 parent 6d2b19b commit 50b91e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import semver from 'semver'

import { download } from './downloader.js'
import { getPathInHome } from './home_path.js'
import { Logger } from './logger.js'
import { getLogger, Logger } from './logger.js'
import { getBinaryExtension } from './platform.js'

const DENO_VERSION_FILE = 'version.txt'
Expand All @@ -20,7 +20,7 @@ interface DenoOptions {
cacheDirectory?: string
debug?: boolean
denoDir?: string
logger: Logger
logger?: Logger
onAfterDownload?: OnAfterDownloadHook
onBeforeDownload?: OnBeforeDownloadHook
useGlobal?: boolean
Expand Down Expand Up @@ -50,7 +50,7 @@ class DenoBridge {
this.cacheDirectory = options.cacheDirectory ?? getPathInHome('deno-cli')
this.debug = options.debug ?? false
this.denoDir = options.denoDir
this.logger = options.logger
this.logger = options.logger ?? getLogger(undefined, options.debug)
this.onAfterDownload = options.onAfterDownload
this.onBeforeDownload = options.onBeforeDownload
this.useGlobal = options.useGlobal ?? true
Expand Down
5 changes: 0 additions & 5 deletions test/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ import { spy } from 'sinon'
import tmp from 'tmp-promise'

import { DenoBridge } from '../src/bridge.js'
import { getLogger } from '../src/logger.js'
import { getPlatformTarget } from '../src/platform.js'

const testLogger = getLogger(() => {
// no-op
})
const require = createRequire(import.meta.url)
const archiver = require('archiver')

Expand All @@ -40,7 +36,6 @@ test('Downloads the Deno CLI on demand and caches it for subsequent calls', asyn
const afterDownload = spy()
const deno = new DenoBridge({
cacheDirectory: tmpDir.path,
logger: testLogger,
onBeforeDownload: beforeDownload,
onAfterDownload: afterDownload,
useGlobal: false,
Expand Down

0 comments on commit 50b91e7

Please sign in to comment.