Last active
August 29, 2015 14:05
-
-
Save KidkArolis/440b70203ea23e9075cf to your computer and use it in GitHub Desktop.
rjs-configurator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rjsConfig = require("rjs-configurator"); | |
// default npm usecase | |
rjsConfig.npm("../my-app", function (err, config) { | |
// contains map, packages | |
console.log(config); | |
}); | |
// advanced usage | |
rjsConfig.generate({ | |
dependencies: function () { | |
// return fs.readFileSync("some/package.json").dependencies; | |
return {dep: "1.0.0"}; | |
}, | |
resolve: function (base, name) { | |
// download it from somewhere, store and return the path | |
// crawl node_modules and return the path | |
} | |
}); | |
rjsConfig.npm = function (root) { | |
rjsConfig.generate({ | |
dependencies: function (cb) { | |
cb(null, require(path.join(root, "package.json")).dependencies); | |
}, | |
resolve: function (base, name, cb) { | |
resolve(name, { basedir: base }, cb); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment