Skip to content

Commit

Permalink
apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
clairesunstudio committed Dec 2, 2020
1 parent b20d73b commit c55cec3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion scripts/release-branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const releaseBranch = 'release/' + version;
// asynchronous function immediately and exit 1.
// Create the release branch and push to Github.
shell.exec(`git branch -D ${releaseBranch}`)
updateCoreVersion(version)
await updateCoreVersion(version)
await git.checkoutLocalBranch(releaseBranch)
await git.add('./*');
await git.commit('Consolidate changelogs and update core version');
Expand Down
21 changes: 10 additions & 11 deletions scripts/update-version.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
const path = require('path');
const fs = require('fs');
const fs = require('fs').promises;

module.exports = function updateCoreVersion(newVer) {
module.exports = async function updateCoreVersion(newVer) {
const filePath = `${path.resolve(__dirname, '../packages/core')}/.env`;

const content = fs.readFileSync(filePath).toString();


const regex = /[0-9]+\.[0-9]+\.[0-9]+/g;
const newContent = content.replace(regex, newVer)

fs.writeFileSync(filePath, newContent, (err) => {
if (err) throw err;
})
try {
const content = fs.readFileSync(filePath).toString();
const regex = /[0-9]+\.[0-9]+\.[0-9]+/g;
const newContent = content.replace(regex, newVer)
await fs.writeFile(filePath, newContent);
} catch(error) {
throw error;
}
}

0 comments on commit c55cec3

Please sign in to comment.