This repository was archived by the owner on Jun 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
60 lines (52 loc) · 1.52 KB
/
index.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
"use strict";
const Context = require("./lib/rootctx");
const { A, The } = require("./athe");
exports._bddy = function() {
return new Context();
};
class BuildFunctionSet {
constructor(context, coTFn, args) {
this.context = context;
this.coTFn = coTFn;
this.args = args;
}
def(f) {
return this.context.def(this.coTFn(...this.args), f);
}
from(f) {
return this.def(f);
}
alsodir() {
new BuildFunctionSet(this.context, aConfig.file, [
this.args[0].replace(/[/\\][^/\\]+$/, "")
]).def(this.context.ensureDir);
return this;
}
}
const BuildEntryT = (ctx, coTFn) => (...args) => new BuildFunctionSet(ctx, coTFn, args);
//predefs
const existingFile = require("./lib/predefs/existingFile");
const Verda = require("./lib/plugins/verda");
const Command = require("./lib/plugins/command");
const VCall = require("./lib/plugins/vcall");
const Dir = require("./lib/plugins/dir");
const FileOps = require("./lib/plugins/fileops");
exports.bddy = function(defs, argv, _options) {
const options = Object.assign({}, _options);
const r = new Context();
r.resources.options = Object.assign({}, r.resources.options, options);
r.loadDefinitions(existingFile);
r.loadPlugin({ verda: new Verda(options) });
r.loadPlugin({
command: new Command(),
dir: new Dir(),
fileops: new FileOps(),
vcall: new VCall()
});
const a = A(CoTarget => BuildEntryT(r, CoTarget));
const the = The(Target => Target);
if (defs) {
defs.call(r, r, a, the, argv, exports);
}
return r;
};