Skip to content

Commit

Permalink
chore: publish io packages
Browse files Browse the repository at this point in the history
  • Loading branch information
floryst committed Jul 7, 2022
1 parent 3a33327 commit d70d7b3
Show file tree
Hide file tree
Showing 3 changed files with 196 additions and 1 deletion.
140 changes: 140 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 31 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.0.6",
"@semantic-release/exec": "^6.0.3",
"@types/estree": "0.0.51",
"@types/mime-types": "^2.1.1",
"assert": "^2.0.0",
Expand Down Expand Up @@ -166,7 +167,36 @@
"prerelease": "b"
}
],
"tagFormat": "itk-wasm-v${version}"
"tagFormat": "itk-wasm-v${version}",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/exec",
{
"prepareCmd": "node ./update-versions.cjs ${nextRelease.version}"
}
],
[
"@semantic-release/npm",
{
"pkgRoot": "."
}
],
[
"@semantic-release/npm",
{
"pkgRoot": "./dist/image-io"
}
],
[
"@semantic-release/npm",
{
"pkgRoot": "./dist/mesh-io"
}
],
"@semantic-release/github"
]
},
"commitlint": {
"extends": [
Expand Down
25 changes: 25 additions & 0 deletions update-versions.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const fs = require('fs')

const version = process.argv[2]
if (!version) {
console.error(`usage: ${__filename} VERSION`)
process.exit(1)
}

function rewriteVersion(filename) {
if (!fs.existsSync(filename)) {
return
}
const lines = fs.readFileSync(filename, { encoding: 'utf-8' }).split('\n')
for (let i = 0; i < lines.length; i++) {
const line = lines[i]
if (lines[i].startsWith('const version = ')) {
lines[i] = `const version = '${version}';`
}
}

fs.writeFileSync(filename, lines.join('\n'))
}

rewriteVersion('dist/itkConfig.js')
rewriteVersion('dist/itkConfigDevelopment.js')

0 comments on commit d70d7b3

Please sign in to comment.