Skip to content

Commit

Permalink
style(bindgen): Nullish coalescing operator for language, outputDir
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Jan 18, 2023
1 parent 61f7415 commit 88ebd0a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/itk-wasm-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,13 @@ function typescriptBindings(outputDir, buildDir, wasmBinaries, options, forNode=
const nodeText = forNode ? 'Node' : ''

const srcOutputDir = path.join(outputDir, 'src')
try {
fs.mkdirSync(srcOutputDir, { recursive: true })
} catch (err) {
if (err.code !== 'EEXIST') throw err
}

if (options.packageName) {
try {
fs.mkdirSync(srcOutputDir, { recursive: true })
} catch (err) {
if (err.code !== 'EEXIST') throw err
}

const packageJsonPath = path.join(outputDir, 'package.json')
if (!fs.existsSync(packageJsonPath)) {
const packageJson = JSON.parse(fs.readFileSync(bindgenResource('template.package.json')))
Expand All @@ -312,6 +311,8 @@ function typescriptBindings(outputDir, buildDir, wasmBinaries, options, forNode=
if (!fs.existsSync(rollupConfigPath)) {
fs.copyFileSync(bindgenResource('rollup.node.config.js'), rollupConfigPath)
}
} else {

}

const tsConfigPath = path.join(outputDir, 'tsconfig.json')
Expand Down Expand Up @@ -582,9 +583,8 @@ function typescriptBindings(outputDir, buildDir, wasmBinaries, options, forNode=
function bindgen(wasmBinaries, options) {
const { buildDir } = processCommonOptions()

const language = options.language === undefined ? 'typescript' : options.language

const outputDir = options.outputDir ? options.outputDir : language
const language = options.language ?? 'typescript'
const outputDir = options.outputDir ?? language

try {
fs.mkdirSync(outputDir, { recursive: true })
Expand Down

0 comments on commit 88ebd0a

Please sign in to comment.