forked from twilio/twilio-cli-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added the version script of twilio oai
- Loading branch information
1 parent
7b5cfda
commit 74e2509
Showing
1 changed file
with
21 additions
and
0 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
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()); | ||
})(); |