tabris-cli
Advanced tools
Comparing version 3.0.2 to 3.1.0
{ | ||
"name": "tabris-cli", | ||
"version": "3.0.2", | ||
"version": "3.1.0", | ||
"description": "Command line tool for Tabris.js", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -44,3 +44,2 @@ const {join} = require('path'); | ||
await fs.remove(zipPath); | ||
this._platformsCache.prune(); | ||
return this._platformsCache.get(platform); | ||
@@ -47,0 +46,0 @@ } |
@@ -14,2 +14,5 @@ const {join} = require('path'); | ||
copySync(path, cachePath); | ||
if (isNightly(platform.version)) { | ||
this._removeOtherNightlies(platform); | ||
} | ||
} catch(e) { | ||
@@ -32,27 +35,9 @@ throw new Error('Could not copy platform to ' + cachePath + '. Error: ' + (e.message || e)); | ||
prune() { | ||
this._cleanUpNightlies(); | ||
_removeOtherNightlies(platform) { | ||
listDirectories(join(this._cachePath, platform.name)) | ||
.filter(isNightly) | ||
.filter(version => version !== platform.version) | ||
.forEach(version => removeSync(join(this._cachePath, platform.name, version))); | ||
} | ||
_cleanUpNightlies() { | ||
let nightlies = this._getPlatformNightlies(); | ||
Object.keys(nightlies).forEach(platform => { | ||
let [, ...tail] = nightlies[platform].sort().reverse(); | ||
tail.forEach(version => removeSync(join(this._cachePath, platform, version))); | ||
}); | ||
} | ||
_getPlatformNightlies() { | ||
let nightlies = {}; | ||
listDirectories(this._cachePath).forEach(platform => { | ||
listDirectories(join(this._cachePath, platform)).forEach(version => { | ||
if (isNightly(version)) { | ||
nightlies[platform] = nightlies[platform] || []; | ||
nightlies[platform].push(version); | ||
} | ||
}); | ||
}); | ||
return nightlies; | ||
} | ||
}; | ||
@@ -59,0 +44,0 @@ |
46
129712
3248