add some notes

This commit is contained in:
Brendan Forster 2018-08-03 15:08:17 -03:00
parent 2381d5fe22
commit 49b1f14b45

View file

@ -13,16 +13,18 @@ const options: SpawnSyncOptions = {
} }
function findYarnVersion(callback: (path: string) => void) { function findYarnVersion(callback: (path: string) => void) {
glob('vendor/yarn-*.js', options, (error, files) => { glob('vendor/yarn-*.js', (error, files) => {
if (error != null) { if (error != null) {
throw error throw error
} }
// this ensures the paths returned by glob are sorted alphabetically
files.sort() files.sort()
const foundVersion = files[files.length - 1] // use the latest version here if multiple are found
const latestVersion = files[files.length - 1]
callback(foundVersion) callback(latestVersion)
}) })
} }