How to use the readdir-scoped-modules.sync function in readdir-scoped-modules

To help you get started, we’ve selected a few readdir-scoped-modules examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github npm / npm-registry-mock / lib / predefines.js View on Github external
var fs = require("fs")
var path = require("path")
var fixtures = path.resolve(__dirname, "..", "fixtures")
var readdir = require("readdir-scoped-modules")
var pkgs = readdir.sync(fixtures).filter(function(f) {
  return !f.match(/\.json$/)
})

var routes = pkgs.map(function(p) {
  var pdir = fixtures + "/" + p
  var vers = fs.readdirSync(pdir).filter(function(v) {
    return v !== "-"
  }).map(function(v) {
    return pdir + "/" + v.replace(/\.json$/, "")
  })

  var tgzdir = pdir + "/-"
  var tgzs = fs.readdirSync(tgzdir).map(function (t) {
    return tgzdir + "/" + t
  })
  return [pdir].concat(vers).concat(tgzs)

readdir-scoped-modules

Like `fs.readdir` but handling `@org/module` dirs as if they were a single entry.

ISC
Latest version published 5 years ago

Package Health Score

52 / 100
Full package analysis

Popular readdir-scoped-modules functions

Similar packages