Skip to content

Commit

Permalink
feat: Added the version script of twilio oai
Browse files Browse the repository at this point in the history
  • Loading branch information
lakshmiravalir authored Aug 24, 2021
1 parent 7b5cfda commit 74e2509
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions scripts/get-version-type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* eslint-disable no-console */
const { ChangeLogHelper } = require('./change-log-helper');

const versionRegex = /(\d+)\.(\d+)\.(\d+)/;
const dateRegex = /\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])/;
const ch = new ChangeLogHelper(versionRegex, dateRegex, 'CHANGES.md', 'OAI_CHANGES.md');

const getVersionType = async () => {
const versions = await ch.getFirstTwoVersions();
if (versions.length === 2) {
const version1 = versions[0].split('.');
const version2 = versions[1].split('.');
for (let i = 0; i < 3; i++) {
if (version1[i] !== version2[i]) return i;
}
}
return -1;
};
(async () => {
console.log(await getVersionType());
})();

0 comments on commit 74e2509

Please sign in to comment.