Skip to content

Commit

Permalink
Merge pull request #141 from bindable-ui/dd/version-update-script
Browse files Browse the repository at this point in the history
add script to update version
  • Loading branch information
djedi authored May 3, 2022
2 parents d1c0dc6 + 0450830 commit 8a5e0c4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
2 changes: 1 addition & 1 deletion dev-app/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<c-nav-horizontal-item
position="right"
href="https://github.com/bindable-ui/bindable"
title="v1.11.4"
title="v1.11.5"
></c-nav-horizontal-item>
</c-nav-horizontal>
</l-box>
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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"
Expand Down
26 changes: 26 additions & 0 deletions update-version.js
Original file line number Diff line number Diff line change
@@ -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);
});

0 comments on commit 8a5e0c4

Please sign in to comment.