This repository has been archived by the owner on Sep 14, 2023. It is now read-only.
/
build.js
94 lines (72 loc) · 2.14 KB
/
build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Generated by CoffeeScript 1.4.0
(function() {
var amdify, async, at, dref, fs, outcome, path, stepc;
amdify = require("amdify");
at = amdify.transformers;
async = require("async");
stepc = require("stepc");
outcome = require("outcome");
fs = require("fs");
path = require("path");
dref = require("dref");
module.exports = (function() {
/*
*/
function _Class(ops, packageManagers) {
this._jam = packageManagers.packageManagers.jam;
this._directory = process.cwd();
this._output = this._directory + "/" + (dref.get(ops.pkg, "jam.public.vendor") || "jam");
console.log(this._output);
}
/*
*/
_Class.prototype.run = function(callback) {
var dir, o, output, self;
o = outcome.e(callback);
dir = this._directory + "/node_modules";
output = this._output;
self = this;
return stepc.async((function() {
return fs.readdir(dir, this);
}), o.s(function(dirs) {
dirs = dirs.map(function(d) {
return dir + "/" + d;
}).filter(function(d) {
return path.basename(d).substr(0, 1) !== "." && fs.lstatSync(d).isDirectory();
});
return this(null, dirs);
}), o.s(function(dirs) {
return self._amdifyAll(dirs, this);
}), o.s(function() {
return self._jam.rebuild(this);
}), callback);
};
/*
*/
_Class.prototype._amdifyAll = function(dirs, callback) {
var _this = this;
return async.map(dirs, (function(dir, callback) {
return _this._amdify(dir, function(err) {
return callback();
});
}), callback);
};
/*
*/
_Class.prototype._amdify = function(dir, callback) {
var _this = this;
return amdify({
entry: require.resolve(dir),
directory: this._output
}, outcome.e(callback).s(function(bundle) {
var transformer;
transformer = new at.Template("amd");
transformer = new at.Copy({
output: _this._output
}, transformer);
return bundle.transform(transformer, callback);
}));
};
return _Class;
})();
}).call(this);