list.js 641 B

123456789101112131415161718192021222324252627
  1. 'use strict'
  2. const fs = require('graceful-fs')
  3. const log = require('npmlog')
  4. function list (gyp, args, callback) {
  5. var devDir = gyp.devDir
  6. log.verbose('list', 'using node-gyp dir:', devDir)
  7. fs.readdir(devDir, onreaddir)
  8. function onreaddir (err, versions) {
  9. if (err && err.code !== 'ENOENT') {
  10. return callback(err)
  11. }
  12. if (Array.isArray(versions)) {
  13. versions = versions.filter(function (v) { return v !== 'current' })
  14. } else {
  15. versions = []
  16. }
  17. callback(null, versions)
  18. }
  19. }
  20. module.exports = list
  21. module.exports.usage = 'Prints a listing of the currently installed node development files'