diff --git a/README.md b/README.md index f2ada3b8..8f9d4fcf 100644 --- a/README.md +++ b/README.md @@ -104,9 +104,12 @@ Run `yarn start`, then open `http://localhost:9000` Run `yarn test` ### Release + This is used when updating Bindable. -With your changes update the version number in `dev-app/app.html` in the `title` attribute (around line 37), and the package.json file. Then make a release on Github. +Run `yarn update-version`. This will update the version in `package.json` and the title attribe in `dev-app/app.html` to the new version you specify. + +Once you merge your changes to master, [create a new release on Github](https://github.com/bindable-ui/bindable/releases). Update your app to point to the new release in package.json (and package-lock.json if you're not using Yarn) and then `yarn install` or `npm install`. diff --git a/dev-app/app.html b/dev-app/app.html index 5fcf581d..13b12eb4 100644 --- a/dev-app/app.html +++ b/dev-app/app.html @@ -52,7 +52,7 @@ diff --git a/package.json b/package.json index 07c0daae..c055a082 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@bindable-ui/bindable", "description": "An Aurelia component library", - "version": "1.11.4", + "version": "1.11.5", "repository": { "type": "git", "url": "https://github.com/bindable-ui/bindable" @@ -100,7 +100,8 @@ "test-coverage": "jest --coverage=true", "test": "jest --coverage=true", "test:debug": "jest --coverage=false --runInBand --detectOpenHandles --forceExit", - "test:ci": "jest --coverage=true --ci --detectOpenHandles --forceExit" + "test:ci": "jest --coverage=true --ci --detectOpenHandles --forceExit", + "update-version": "node ./update-version.js" }, "engines": { "node": ">=12.22.12" diff --git a/update-version.js b/update-version.js new file mode 100644 index 00000000..692bb6e4 --- /dev/null +++ b/update-version.js @@ -0,0 +1,26 @@ +const fs = require('fs'); +const packageJsonPath = './package.json'; +const appHtmlPath = './dev-app/app.html'; +const file = require(packageJsonPath); +const readline = require('readline'); + +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, +}); + +console.log(`Current: ${file.version}`); +rl.question('New version: ', version => { + file.version = version; + rl.close(); +}); + +rl.on('close', () => { + // Update app.html + html = fs.readFileSync(appHtmlPath, 'utf8'); + newHtml = html.replace(/title="v[\d\.]+"/, `title="v${file.version}"`); + fs.writeFileSync(appHtmlPath, newHtml); + + fs.writeFileSync(packageJsonPath, JSON.stringify(file, null, 2) + '\n'); + process.exit(0); +});