Skip to content

Commit 2c0547b

Browse files
feat(publish): Update bower.json, if it exists
1 parent dabb5a1 commit 2c0547b

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

release.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const fs = require('fs');
99
const path = require('path');
1010
const semver = require('semver');
1111
const packageJson = JSON.parse(fs.readFileSync('package.json'));
12+
const modifiedFiles = [];
1213

1314
const yargs = require('yargs')
1415
.option('dryrun', {
@@ -48,6 +49,14 @@ if (versionBump !== 'none') {
4849

4950
packageJson.version = version;
5051
fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2));
52+
modifiedFiles.push('package.json');
53+
54+
if (yargs.argv.bower) {
55+
const bowerJson = fs.readFileSync('bower.json');
56+
bowerJson.version = version;
57+
fs.writeFileSync('bower.json', JSON.stringify(bowerJson, null, 2));
58+
modifiedFiles.push('bower.json');
59+
}
5160
}
5261

5362

@@ -68,17 +77,24 @@ if (readlineSync.keyInYN('\n\nUpdate CHANGELOG?')) {
6877

6978
let fullChangelog = fs.readFileSync('CHANGELOG.md');
7079
fs.writeFileSync('CHANGELOG.md', changelog + '\n' + fullChangelog);
80+
modifiedFiles.push('CHANGELOG.md');
81+
}
82+
83+
84+
// Run tests
85+
if (readlineSync.keyInYN('Run tests?')) {
86+
_exec('npm test')
7187
}
7288

7389

7490
// Commit and push changes
7591
if (!readlineSync.keyInYN('Ready to publish?')) {
76-
console.log('\n\nUndo changes:\n\ngit checkout CHANGELOG.md package.json\n\n');
92+
console.log(`\n\nRun this command to undo changes:\n\ngit checkout ${modifiedFiles.join(' ')}\n\n`);
7793
process.exit(1);
7894
}
7995

8096
if (!yargs.argv.dryrun) {
81-
_exec(`git ci -m ${version} package.json CHANGELOG.md`);
97+
_exec(`git ci -m ${version} ${modifiedFiles.join(' ')}`);
8298
}
8399

84100
if (!yargs.argv.dryrun) {

0 commit comments

Comments
 (0)