File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,28 @@ const versionsFilePath = "./versions.json";
1313const manifestFilePath = "./manifest.json" ;
1414const packageFilePath = "./package.json" ;
1515
16+ // Function to check if the version Number is already used
17+ async function isVersionNumberUsed ( ) : Promise < boolean | undefined > {
18+ try {
19+ const data = await readFile ( manifestFilePath , "utf8" ) ;
20+ const manifest = JSON . parse ( data ) ;
21+ if ( manifest . version === packageSemver ) {
22+ console . log (
23+ logInsert ( [
24+ `>> version="${ packageSemver } " is already used try to update it in bump.ts file. ✓✓` ,
25+ "red" ,
26+ null ,
27+ ] ) ,
28+ ) ;
29+ return true ;
30+ }
31+ return false ;
32+
33+ } catch ( err ) {
34+ console . error ( "Error updating manifest.json:" , err ) ;
35+ return
36+ }
37+ }
1638// Function to update versions.json
1739async function updateVersionsFile ( ) {
1840 try {
@@ -119,6 +141,10 @@ export function logInsert(msgArr: Msg) {
119141}
120142// Main function to run all steps in sequence
121143async function main ( ) {
144+ const isUsed = await isVersionNumberUsed ( ) ;
145+ if ( isUsed ) {
146+ return ;
147+ }
122148 await updateVersionsFile ( ) ;
123149 await updateManifestFile ( ) ;
124150 await updatePackageJsonFile ( ) ;
You can’t perform that action at this time.
0 commit comments