kopia lustrzana https://github.com/c9/core
create __packed__.js before publishing
rodzic
41518496d4
commit
7479523eb9
|
@ -36,6 +36,7 @@ define(function(require, exports, module) {
|
||||||
var FormData = require("form-data");
|
var FormData = require("form-data");
|
||||||
var http = require(APIHOST.indexOf("localhost") > -1 ? "http" : "https");
|
var http = require(APIHOST.indexOf("localhost") > -1 ? "http" : "https");
|
||||||
var basename = require("path").basename;
|
var basename = require("path").basename;
|
||||||
|
var dirname = require("path").dirname;
|
||||||
|
|
||||||
var verbose = false;
|
var verbose = false;
|
||||||
var force = false;
|
var force = false;
|
||||||
|
@ -433,6 +434,41 @@ define(function(require, exports, module) {
|
||||||
// @TODO add a .c9exclude file that excludes files
|
// @TODO add a .c9exclude file that excludes files
|
||||||
var zipFilePath;
|
var zipFilePath;
|
||||||
function build(){
|
function build(){
|
||||||
|
var base = dirname(cwd);
|
||||||
|
var packageName = json.name;
|
||||||
|
var config = Object.keys(plugins).map(function(p) {
|
||||||
|
return packageName + "/" + p;
|
||||||
|
});
|
||||||
|
var paths = {};
|
||||||
|
paths[packageName] = cwd;
|
||||||
|
|
||||||
|
var build = require("architect-build/build");
|
||||||
|
build(config, {
|
||||||
|
paths: paths,
|
||||||
|
enableBrowser: true,
|
||||||
|
includeConfig: false,
|
||||||
|
noArchitect: true,
|
||||||
|
compress: true,
|
||||||
|
obfuscate: true,
|
||||||
|
oneLine: true,
|
||||||
|
filter: [],
|
||||||
|
ignore: [],
|
||||||
|
withRequire: false,
|
||||||
|
stripLess: false,
|
||||||
|
basepath: base,
|
||||||
|
}, function(e, result) {
|
||||||
|
var packedFiles = result.sources.map(function(m) {
|
||||||
|
return m.file
|
||||||
|
});
|
||||||
|
fs.writeFile("__packed__.js", result.code, "utf8", function(err, result) {
|
||||||
|
if (err) console.log(err);
|
||||||
|
|
||||||
|
zip(packedFiles);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function zip(ignore){
|
||||||
zipFilePath = join(os.tmpDir(), json.name + "@" + json.version);
|
zipFilePath = join(os.tmpDir(), json.name + "@" + json.version);
|
||||||
var tarArgs = ["-zcvf", zipFilePath, "."];
|
var tarArgs = ["-zcvf", zipFilePath, "."];
|
||||||
var c9ignore = process.env.HOME + "/.c9/.c9ignore";
|
var c9ignore = process.env.HOME + "/.c9/.c9ignore";
|
||||||
|
|
Ładowanie…
Reference in New Issue