Browse Source
* Sort `now scale ls` similarly how `now ls` is sorted * Remove unused dependencymaster
Jarmo Isotalo
8 years ago
committed by
Matheus Fernandes
3 changed files with 42 additions and 46 deletions
@ -0,0 +1,30 @@ |
|||
const fs = require('fs-promise') |
|||
|
|||
module.exports = async function(apps) { |
|||
let pkg |
|||
try { |
|||
const json = await fs.readFile('package.json') |
|||
pkg = JSON.parse(json) |
|||
} catch (err) { |
|||
pkg = {} |
|||
} |
|||
|
|||
return apps |
|||
.map(([name, deps]) => { |
|||
deps = deps.slice().sort((a, b) => { |
|||
return b.created - a.created |
|||
}) |
|||
return [name, deps] |
|||
}) |
|||
.sort(([nameA, depsA], [nameB, depsB]) => { |
|||
if (pkg.name === nameA) { |
|||
return -1 |
|||
} |
|||
|
|||
if (pkg.name === nameB) { |
|||
return 1 |
|||
} |
|||
|
|||
return depsB[0].created - depsA[0].created |
|||
}) |
|||
} |
Loading…
Reference in new issue