Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann committed Dec 12, 2023
1 parent 60a31a2 commit d335c34
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 0 additions & 2 deletions src/constants.ts
@@ -1,10 +1,8 @@
import os from 'node:os'
import logger from '@wdio/logger'

export const MOZ_CENTRAL_CARGO_TOML = 'https://hg.mozilla.org/mozilla-central/raw-file/tip/testing/geckodriver/Cargo.toml'
export const BASE_CDN_URL = process.env.GECKODRIVER_CDNURL || process.env.npm_config_geckodriver_cdnurl || 'https://github.com/mozilla/geckodriver/releases/download'
// e.g. https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-macos-aarch64.tar.gz
export const GECKODRIVER_DOWNLOAD_PATH = `${BASE_CDN_URL}/v%s/geckodriver-v%s-%s%s%s`
export const DEFAULT_HOSTNAME = '0.0.0.0'
export const BINARY_FILE = 'geckodriver' + (os.platform() === 'win32' ? '.exe' : '')
export const log = logger('geckodriver')
5 changes: 4 additions & 1 deletion src/index.ts
@@ -1,10 +1,13 @@
import cp from 'node:child_process'
import logger from '@wdio/logger'

import { download as downloadDriver } from './install.js'
import { hasAccess, parseParams } from './utils.js'
import { DEFAULT_HOSTNAME, log } from './constants.js'
import { DEFAULT_HOSTNAME } from './constants.js'
import type { GeckodriverParameters } from './types.js'

const log = logger('geckodriver')

export async function start (params: GeckodriverParameters) {
const { cacheDir, customGeckoDriverPath, ...startArgs } = params
let geckoDriverPath = process.env.GECKODRIVER_FILEPATH || customGeckoDriverPath
Expand Down
4 changes: 3 additions & 1 deletion src/install.ts
Expand Up @@ -7,15 +7,17 @@ import fsp from 'node:fs/promises'
import zlib from 'node:zlib'
import { Readable } from 'node:stream'

import logger from '@wdio/logger'
import tar from 'tar-fs'
import { type RequestInit } from 'node-fetch'
import { HttpsProxyAgent } from 'https-proxy-agent'
import { HttpProxyAgent } from 'http-proxy-agent'
import unzipper, { type Entry } from 'unzipper'

import { BINARY_FILE, MOZ_CENTRAL_CARGO_TOML, log } from './constants.js'
import { BINARY_FILE, MOZ_CENTRAL_CARGO_TOML } from './constants.js'
import { hasAccess, getDownloadUrl, retryFetch } from './utils.js'

const log = logger('geckodriver')
const streamPipeline = util.promisify(stream.pipeline)

const fetchOpts: RequestInit = {}
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Expand Up @@ -39,8 +39,8 @@ export function parseParams(params: GeckodriverParameters) {
if (typeof val === 'boolean' && !val) {
return ''
}
const vals = Array.isArray(val) ? val : [val]
return vals.map((v) => `--${decamelize(key, { separator: '-' })}${typeof v === 'boolean' ? '' : `=${v}`}`)
const values = Array.isArray(val) ? val : [val]
return values.map((v) => `--${decamelize(key, { separator: '-' })}${typeof v === 'boolean' ? '' : `=${v}`}`)
})
.flat()
.filter(Boolean)
Expand Down
5 changes: 2 additions & 3 deletions tsconfig.json
@@ -1,10 +1,10 @@
{
"compilerOptions": {
"module": "ESNext",
"module": "NodeNext",
"target": "ES2020",
"baseUrl": "src",
"outDir": "./dist",
"moduleResolution": "node",
"moduleResolution": "Node16",
"declaration": true,
"declarationMap": true,
"noUnusedLocals": true,
Expand All @@ -23,4 +23,3 @@
"include": ["src/**/*", "src/cjs/package.json"],
"ignore": ["node_modules", "dist"]
}

0 comments on commit d335c34

Please sign in to comment.