Comparing version 0.1.2 to 0.1.3
@@ -11,5 +11,14 @@ function _ColaRuntime$$error(_error) { | ||
const NPM = require("npm"); | ||
NPM.load(function() { | ||
var err = arguments[0] !== undefined ? arguments[0] : _ColaRuntime$$error("Argument `err` is required!"); | ||
}); | ||
var shimModules = [ "process", "buffer", "browserify-zlib", "vm-browserify", "util", "url", "tty-browserify", "timers-browserify", "string_decoder", "stream-browserify", "querystring", "punycode", "path-browserify", "os-browserify", "https-browserify", "http-browserify", "events", "domain-browser", "crypto-browserify", "constants-browserify", "console-browserify", "assert" ]; | ||
function getJson() { | ||
var filename = arguments[0] !== undefined ? arguments[0] : _ColaRuntime$$error("Argument `filename` is required!"); | ||
return JSON.parse(FS.readFileSync(filename, "utf8")); | ||
var jsonSource = FS.readFileSync(filename, "utf8"); | ||
return jsonSource ? JSON.parse(jsonSource) : {}; | ||
} | ||
@@ -62,2 +71,24 @@ | ||
exports.resolve = _; | ||
function install() { | ||
var path = arguments[0] !== undefined ? arguments[0] : _ColaRuntime$$error("Argument `path` is required!"); | ||
path = Path.join(path, "./browser-shim"); | ||
if (FS.existsSync(path)) { | ||
return; | ||
} | ||
NPM.load(function() { | ||
var err = arguments[0] !== undefined ? arguments[0] : _ColaRuntime$$error("Argument `err` is required!"); | ||
if (err) { | ||
throw err; | ||
} | ||
NPM.commands.install(path, shimModules, function() { | ||
var err = arguments[0] !== undefined ? arguments[0] : _ColaRuntime$$error("Argument `err` is required!"); | ||
if (err) { | ||
throw err; | ||
} | ||
}); | ||
}); | ||
} | ||
exports.resolve = _; | ||
exports.installShim = install; |
@@ -10,2 +10,4 @@ #!/usr/bin/env node | ||
const path = require("path"); | ||
try { | ||
@@ -30,4 +32,6 @@ var firstArg = cli.args[0] ? cli.read() : "./"; | ||
output = cli.read(); | ||
drp.installShim(path.dirname(output)); | ||
fs.writeFileSync(/\/$/.test(output) ? "" + output + "/packages.json" : output, packages, "utf8"); | ||
} else { | ||
drp.installShim(path.dirname(output)); | ||
fs.writeFileSync(output, packages, "utf8"); | ||
@@ -34,0 +38,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://github.com/TrigenSoftware/Dr-Package", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"engines": { | ||
@@ -18,2 +18,3 @@ "node": ">=0.4.0" | ||
"dependencies": { | ||
"npm": "~2.0.0", | ||
"colors": "~0.6.2", | ||
@@ -20,0 +21,0 @@ "argue-cli": "~0.0.1" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
81705
2115
3
30
+ Addednpm@~2.0.0
+ Addednpm@2.0.2(transitive)