Feature/async await cleanup 1 #53
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In short: I've converted some of the more used filesystem functions to use sync methods.
getPlatformConfig
setPlatformConfig
getPlatformRootDir
getPlatformExtensionsDir
loadExtensionJson
addToExtensionsJs
cache getValue, setValue
clearTokens
authorizeRequests
setHostEnvName
parseCredentials
getLinkedDirectories
setLinkedDirectories
linkExtension
linkDirectory
unlinkDirectory
getAnalyticsVisitor
getCacheFilePath
readJsonFile
writeJsonFile
handleError
containsBuildTask
getPackageJson
savePackageJson
addLocalDependency
linkLocalDependencies
isPlatformDirectory
I've also removed all the redundant
return awaits at function endings.As far as I can tell, there's no upside to using async methods for ~1ms file reading operations in a command line tool running in a single threaded node process. And I believe it also makes the CLI code easier to read and follow.
I'm pretty sure that I didn't remove every await call where it's not needed any more, but it's not a problem since it'll resolve to the same value.
Please comment away :)