cli
cli copied to clipboard
Feature/async await cleanup 1
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 :)
I'd like to test this out thoroughly before we set it as latest on npm, if you don't mind. I don't expect any issues, but: "Trust, but verify."
Why would I mind, this really needs to be tested before it's released as stable 😄