Skip to content

Commit

Permalink
fix: Run update-versions during prepublishOnly npm step
Browse files Browse the repository at this point in the history
Get the version from package.json, which should be set by
semantic-release.
  • Loading branch information
thewtex committed Oct 12, 2022
1 parent 78dd325 commit 8717d05
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "itk-wasm",
"version": "1.0.0-b.18",
"version": "0.0.0-semantically-released",
"description": "High-performance spatial analysis in a web browser, Node.js, and reproducible execution across programming languages and hardware architectures.",
"main": "./dist/index.js",
"browser": {
Expand Down Expand Up @@ -56,7 +56,7 @@
"test:chrome": "start-server-and-test start http-get://localhost:8083 cypress:runChrome",
"test:firefox:ci": "start-server-and-test start http-get://localhost:8083 cypress:runFirefox:ci",
"test:firefox": "start-server-and-test start http-get://localhost:8083 cypress:runFirefox",
"prepublishOnly": "npm run build"
"prepublishOnly": "npm run build:tsc && node ./src/update-versions.cjs && npm run build:workerBundles && npm run build:workerMinBundles && npm run build:webpack"
},
"config": {
"commitizen": {
Expand Down Expand Up @@ -175,12 +175,6 @@
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/exec",
{
"verifyReleaseCmd": "node ./update-versions.cjs ${nextRelease.version}"
}
],
[
"@semantic-release/changelog",
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ export { default as WorkerPoolFunction } from './WorkerPoolFunction.js'
export { default as WorkerPoolProgressCallback } from './WorkerPoolProgressCallback.js'
export { default as WorkerPoolRunTasksResult } from './WorkerPoolRunTasksResult.js'

const version = '1.0.0-b.18'
const version = '0.0.0-semantically-released'
export { version }
2 changes: 1 addition & 1 deletion src/itkConfigDevelopment.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const version = '1.0.0-b.18'
const version = '0.0.0-semantically-released'

const itkConfig = {
webWorkersUrl: undefined,
Expand Down
7 changes: 4 additions & 3 deletions update-versions.cjs → src/update-versions.cjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const fs = require('fs')

const version = process.argv[2]
let version = process.argv[2]
if (!version) {
console.error(`usage: ${__filename} VERSION`)
process.exit(1)
const packageString = fs.readFileSync('package.json', { encoding: 'utf-8' })
const packageData = JSON.parse(packageString)
version = packageData.version
}

function rewriteVersion(filename) {
Expand Down

0 comments on commit 8717d05

Please sign in to comment.