Skip to content

Commit

Permalink
feat(bindgen): Copy WASM modules to dist/pipelines/
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Jan 18, 2023
1 parent 7529612 commit 84de1cd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/itk-wasm-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,20 @@ function typescriptBindings(outputDir, buildDir, wasmBinaries, options, forNode=
wasmBinaryRelativePath = wasmBinaryName
}

const distPipelinesDir = path.join(outputDir, 'dist', 'pipelines')
try {
fs.mkdirSync(distPipelinesDir, { recursive: true })
} catch (err) {
if (err.code !== 'EEXIST') throw err
}
fs.copyFileSync(wasmBinaryRelativePath, path.join(distPipelinesDir, path.basename(wasmBinaryRelativePath)))
const wasmBinaryBasename = path.basename(wasmBinaryRelativePath, '.wasm')
const wasmBinaryDirname = path.dirname(wasmBinaryRelativePath)
if (fs.existsSync(path.join(wasmBinaryDirname, `${wasmBinaryBasename}.js`))) {
fs.copyFileSync(path.join(wasmBinaryDirname, `${wasmBinaryBasename}.js`), path.join(distPipelinesDir, `${wasmBinaryBasename}.js`))
fs.copyFileSync(path.join(wasmBinaryDirname, `${wasmBinaryBasename}.umd.js`), path.join(distPipelinesDir, `${wasmBinaryBasename}.umd.js`))
}

const parsedPath = path.parse(path.resolve(wasmBinaryRelativePath))
const runPath = path.join(parsedPath.dir, parsedPath.name)
const runPipelineScriptPath = bindgenResource('interfaceJSONNode.js')
Expand Down

0 comments on commit 84de1cd

Please sign in to comment.