33import re
44from git import Repo , TagReference
55
6+
67def readVersionFromPackageJson () -> None :
78 packageJson = open ("package.json" , "r" )
89 contentRaw = packageJson .read ()
910 contentJson = json .loads (contentRaw )
1011 packageJson .close ()
1112 return contentJson ["version" ]
1213
14+
1315def isPackageJsonVersionTagged (repo , packageJsonVersion ) -> bool :
1416 packageJsonVersionTagFound = False
1517 for tag in repo .tags :
@@ -18,6 +20,7 @@ def isPackageJsonVersionTagged(repo, packageJsonVersion) -> bool:
1820 break
1921 return packageJsonVersionTagFound
2022
23+
2124def isChangeLogUpdatedWithPackageJsonVersion (packageJsonVersion ) -> bool :
2225 packageJsonVersionChangeLogEntryFound = False
2326 changeLog = open ("CHANGELOG.md" , "r" )
@@ -30,22 +33,25 @@ def isChangeLogUpdatedWithPackageJsonVersion(packageJsonVersion) -> bool:
3033 break
3134 return packageJsonVersionChangeLogEntryFound
3235
36+
3337def isAllPackagesInstalledLocally () -> bool :
3438 process = subprocess .Popen (["cmd" , "/c" , "npm" , "list" , "--production" , "--parseable" , "--depth=99999" , "--loglevel=error" ], stderr = subprocess .PIPE )
3539 out = process .stderr .read ()
3640 success = (len (out ) == 0 )
3741 if (not success ):
38- print (f"Error while checking if all packages is installed locally: { out } " )
42+ print (f"Error while checking if all packages is installed locally: { out } " )
3943 return success
4044
45+
4146def packageExtension () -> bool :
4247 process = subprocess .Popen (["cmd" , "/c" , "vsce" , "package" ], stderr = subprocess .PIPE )
4348 out = process .stderr .read ()
4449 success = (len (out ) == 0 )
4550 if (not success ):
46- print (f"Error while packaging: { out } " )
51+ print (f"Error while packaging: { out } " )
4752 return success
4853
54+
4955def main ():
5056 packageJsonVersion = readVersionFromPackageJson ()
5157 repo = Repo ("./" )
@@ -72,4 +78,5 @@ def main():
7278 print ("Creating tag in Git..." )
7379 repo .create_tag (packageJsonVersion )
7480
81+
7582main ()
0 commit comments