Skip to content

Commit

Permalink
feat(bindgen): Support --package-version for typescript bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Apr 25, 2023
1 parent ee7513a commit 64749ef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"build:webpack": "webpack --mode production --progress --color && webpack --mode development --progress --color",
"build:emscripten": "node ./src/build-emscripten.js",
"build:emscripten:compress-stringify": "node ./src/itk-wasm-cli.js -s packages/compress-stringify -b emscripten-build build ",
"build:bindgen:typescript:compress-stringify": "./src/itk-wasm-cli.js -s packages/compress-stringify -b emscripten-build bindgen --package-name @itk-wasm/compress-stringify --package-description \"Zstandard compression and decompression and base64 encoding and decoding in WebAssembly.\" --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:bindgen:typescript:compress-stringify": "./src/itk-wasm-cli.js -s packages/compress-stringify -b emscripten-build bindgen --package-version 0.4.3 --package-name @itk-wasm/compress-stringify --package-description \"Zstandard compression and decompression and base64 encoding and decoding in WebAssembly.\" --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:bindgen:python:compress-stringify": "./src/itk-wasm-cli.js -s packages/compress-stringify -b wasi-build bindgen --language python --package-name itkwasm-compress-stringify --package-description \"Zstandard compression and decompression and base64 encoding and decoding in WebAssembly.\" --package-version 0.4.2 --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:emscripten:dicom": "node ./src/itk-wasm-cli.js -s packages/dicom -b emscripten-build build ",
"build:bindgen:typescript:dicom": "./src/itk-wasm-cli.js -s packages/dicom -b emscripten-build bindgen --package-name @itk-wasm/dicom --package-description \"Read files and images related to DICOM file format.\" --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
Expand Down
4 changes: 2 additions & 2 deletions packages/compress-stringify/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@itk-wasm/compress-stringify",
"version": "0.4.2",
"version": "0.4.3",
"description": "Zstandard compression and decompression and base64 encoding and decoding in WebAssembly.",
"type": "module",
"module": "./dist/bundles/compress-stringify.js",
Expand Down Expand Up @@ -62,4 +62,4 @@
"type": "git",
"url": "https://github.com/InsightSoftwareConsortium/itk-wasm"
}
}
}
11 changes: 11 additions & 0 deletions src/bindgen/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,18 @@ function typescriptBindings(outputDir, buildDir, wasmBinaries, options, forNode=
if(options.repository) {
packageJson.repository = { 'type': 'git', 'url': options.repository }
}
if(options.packageVersion) {
packageJson.version = options.packageVersion
} else {
packageJson.version = "0.1.0"
}
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
} else {
if (options.packageVersion) {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath))
packageJson.version = options.packageVersion
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
}
}

if (!forNode) {
Expand Down

0 comments on commit 64749ef

Please sign in to comment.