mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 00:27:58 +00:00
18 lines
618 B
JavaScript
18 lines
618 B
JavaScript
|
const fs = require('fs')
|
||
|
const child_process = require('child_process')
|
||
|
|
||
|
const dev = process.env.TRAVIS && process.env.TRAVIS_BRANCH === 'dev' || true
|
||
|
|
||
|
let version = child_process.execSync(`npm show tone${dev?'@next':''} version`).toString()
|
||
|
version = version.split('.')
|
||
|
//increment the patch
|
||
|
version[2] = parseInt(version[2]) + 1
|
||
|
//put it back in semver
|
||
|
version = version.join('.')
|
||
|
|
||
|
//write it to the package.json
|
||
|
const packageFile = '../package.json'
|
||
|
const package = JSON.parse(fs.readFileSync(packageFile, 'utf-8'))
|
||
|
package.version = version
|
||
|
fs.writeFileSync(packageFile, JSON.stringify(package, undefined, ' '))
|