Adding script to calculate what nodeModules are needed for a service. Used it to set nodeModulesInclude for api and ide

pull/85/head^2
Tim Robinson 2015-04-16 15:22:34 +00:00
rodzic 8a0d2cfc16
commit 0f86040782
1 zmienionych plików z 9 dodań i 7 usunięć

Wyświetl plik

@ -188,19 +188,21 @@ dest = "/build/webkitbuilds/app.nw"
var args = ["local","-s", "local"];
*/
module.exports = function(options, cb) {
var dest = convertPath(options.dest);
var dest = options.dest && convertPath(options.dest);
var root = convertPath(options.root);
var args = options.args;
ignore = options.ignore && function(id) {
return options.ignore.test(id);
};
build(root, args, function(err, result) {
var serverSource = fs.readFileSync(root + "/server.js", "utf8");
serverSource = serverSource.replace(/^(#.*|"use strict";?|\s)*/, function(a) {
return a.trim() + "\n\n" + patchTemplate + "\n\n";
});
fs.writeFileSync(dest + "/server.js", serverSource, "utf8");
fs.writeFileSync(dest + "/module-map.json", JSON.stringify(result.moduleMap), "utf8");
if (dest) {
var serverSource = fs.readFileSync(root + "/server.js", "utf8");
serverSource = serverSource.replace(/^(#.*|"use strict";?|\s)*/, function(a) {
return a.trim() + "\n\n" + patchTemplate + "\n\n";
});
fs.writeFileSync(dest + "/server.js", serverSource, "utf8");
fs.writeFileSync(dest + "/module-map.json", JSON.stringify(result.moduleMap), "utf8");
}
cb(null, result);
});