-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #141 from bindable-ui/dd/version-update-script
add script to update version
- Loading branch information
Showing
4 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); |