-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
758 lines (714 loc) · 32.6 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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
#!/usr/bin/env node
(function () {
var fs = require('fs-extra');
var path = require('path');
var spawn = require('child_process').spawn;
var parseString = require('xml2js').parseString;
var ncp = require('ncp').ncp;
var archiver = require('archiver');
var request = require('request');
var prompt = require('prompt');
var geardoc = require('@clockwork/geardoc');
var exec = require('child_process').exec;
prompt.start();
prompt.message = "Some information is required";
var rootPath = "./";
var log = function (x) { }; //By default, dont log anything
var showError = function (x) { console.log(x); };//By default, output errors to the console
var getDataViaPrompt = function (data, callback) { return prompt.get(data, callback); };
var userArguments = process.argv.slice(2);
var bridges = {
web: require('clockwork-web-bridge'),
uwp: require('clockwork-uwp-bridge')
};
if (userArguments.length < 1) {
console.log("No action was specified, use 'clockwork ?' to see the available actions");
} else {
switch (userArguments[0]) {
case "init":
createProject(userArguments[1]);
break;
case "build":
buildProject(function (x) { console.log("The package has been successfully generated, you can find it at " + x) });
break;
case "list":
listPackages(userArguments[1]);
break;
case "add":
addPackage(getDataViaPrompt, userArguments[1], userArguments[2]);
break;
case "update":
updatePackage(userArguments[1]);
break;
case "register":
prompt.get({
properties: {
username: {
description: 'Enter your username',
required: true
},
email: {
description: 'Enter your email',
pattern: /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/,
required: true,
message: 'This must be a valid email',
},
password: {
description: 'Enter your password',
hidden: true,
required: true,
replace: '*'
}
}
}, function (err, result) {
register(result.username, result.email, result.password);
});
break;
case "publish":
prompt.get({
properties: {
sourceFile: {
description: 'Enter the location of the source file',
required: true
},
packageId: {
description: 'Enter the package name',
pattern: /^[a-zA-Z0-9]+$/,
message: 'Name must only contain alphanumeric characters',
required: true
},
packageVersion: {
description: 'Enter the package version',
pattern: /^[a-zA-Z0-9\.\-]+$/,
message: 'Name must only contain alphanumeric characters, dots and dashes',
required: true
}
}
}, function (err, result) {
tryPublish(result.sourceFile, result.packageId, result.packageVersion);
});
break;
case "bridge":
runBridge(userArguments[1]);
break;
case "help":
case "?":
help();
break;
default:
console.log("The specified action was not recognized");
break;
}
}
//Create a project following the template in the working directory with the specified name
function createProject(projectName) {
if (projectName === undefined) {
console.log("No name was specified for the project");
return;
}
function createFolder(path, folder) {
path = path + "/" + folder.name;
try {
fs.mkdirSync(rootPath + path);
} catch (e) {
}
if (folder.folders) {
folder.folders.forEach(createFolder.bind(null, path));
}
}
var newProject = require('./template/newProject.js');
newProject.folders.forEach(createFolder.bind(null, ""));
newProject.files.forEach(function (file) {
fs.readFile(__dirname + "/" + file.file, 'base64', function (err, data) {
if (err) {
return console.log(err);
}
if (file.template) {
var b = new Buffer(data, 'base64');
var content = b.toString().replace("#projectName#", projectName);
b = new Buffer(content);
data = b.toString('base64');
}
fs.writeFile(rootPath + file.name, data, 'base64', function (err) {
if (err) throw err;
});
});
});
}
//Looks for a project in the working directory and creates a Clockwork package
function buildProject(callback) {
var manifest = readManifest();
if (manifest != null) {
try {
var path = generatePackage(manifest).then(callback);
} catch (e) {
showError("Error:" + e);
}
} else {
console.log("The current directory does not contain a Clockwork project");
}
}
//Creates a Clockwork package using the given manifest
function generatePackage(manifest) {
var workingPath = path.resolve(rootPath);
try {
fs.mkdirSync(workingPath + '/ClockworkPackageTemp');
} catch (e) { }
copyFileSync(workingPath + '/manifest.json', workingPath + '/ClockworkPackageTemp/manifest.json');
return new Promise(function (res, rej) {
console.log("Copying project files...");
ncp(workingPath + '/' + manifest.scope, workingPath + '/ClockworkPackageTemp/' + manifest.scope, function (err) {
if (err) {
console.error(err);
rej();
} else {
res()
}
})
}).then(function () {
return preprocessPackage(workingPath + "/ClockworkPackageTemp");
}).then(function (x) {
return new Promise(function (res, rej) {
try {
fs.unlinkSync(workingPath + "/" + manifest.name + '.cw');
} catch (e) { }
var output = fs.createWriteStream(workingPath + "/" + manifest.name + '.cw');
var archive = archiver('zip');
output.on('close', function () {
console.log("Deleting temporary files...");
deleteFolderRecursive(workingPath + "/ClockworkPackageTemp/");
res();
});
archive.on('error', function (err) {
throw err;
});
archive.pipe(output);
console.log("Creating package..");
archive.glob("**", {
cwd: workingPath + "/ClockworkPackageTemp/"
})
// archive.bulk([
// { expand: true, cwd: workingPath + "/ClockworkPackageTemp/", src: ['**'], dest: '' }
// ]);
archive.finalize();
});
}).then(function (x) { return workingPath + "/" + manifest.name + ".cw" });
}
//Reads the manifest in the working directory
function readManifest(projectPath) {
try {
var manifest = JSON.parse(fs.readFileSync((projectPath || path.resolve(rootPath)) + "/manifest.json"));
return manifest;
} catch (e) {
return null;
}
}
//Writes the manifest in the working directory
function writeManifest(manifest, callback, projectPath) {
fs.writeFile((projectPath || path.resolve(rootPath)) + "/manifest.json", JSON.stringify(manifest), function (err) {
if (callback) {
callback(err)
};
});
}
//Run all the preprocessors on the package
function preprocessPackage(path) {
var manifest = readManifest();
//Convert xml spritesheets to json
return new Promise(function (resolvef, rejectf) {
console.log("Processing levels...");
var levels = manifest.levels.map(function (oldName, i) {
if (oldName.indexOf(".xml") != -1) {
var newName = oldName.split(".xml").join(".json");
manifest.levels[i] = newName;
return new Promise(function (resolve, reject) {
log("Reading " + path + "/" + manifest.scope + "/" + oldName);
fs.readFile(path + "/" + manifest.scope + "/" + oldName, function (err, data) {
if (err) {
return console.error(err);
} else {
parseString(data, function (err, result) {
if (err) {
showError("There are errors in " + oldName + ", check your XML.");
resolve();
} else {
log("Writing " + path + "/" + manifest.scope + "/" + newName);
fs.writeFile(path + "/" + manifest.scope + "/" + newName, JSON.stringify(XMLlevelsToJson(result, oldName)), function (err) {
if (err) {
return console.error(err);
}
resolve();
});
}
});
}
});
});
} else {
return new Promise(function (resolve, reject) { return resolve() });
}
});
var spritesheets = manifest.spritesheets.map(function (oldName, i) {
console.log("Processing spritesheets...");
//If it is an XML file, convert to JSON
if (oldName.indexOf(".xml") != -1) {
var newName = oldName.split(".xml").join(".json");
manifest.spritesheets[i] = newName;
return new Promise(function (resolve, reject) {
fs.readFile(path + "/" + manifest.scope + "/" + oldName, function (err, data) {
if (err) {
return console.error(err);
} else {
parseString(data, function (err, result) {
if (err) {
showError("There are errors in " + oldName + ", check your XML.");
resolve();
} else {
fs.writeFile(path + "/" + manifest.scope + "/" + newName, JSON.stringify(XMLspritesheetsToJson(result)), function (err) {
if (err) {
return console.error(err);
}
resolve();
});
}
});
}
});
});
} else if (oldName.indexOf(".js") == oldName.length - 3) {
//If it a .js file, stringify functions
return new Promise(function (resolve, reject) {
fs.readFile(path + "/" + manifest.scope + "/" + oldName, function (err, data) {
if (err) {
return console.error(err);
} else {
var spritesheetContent;
eval("spritesheetContent = " + data);
//Stringify functions
(function stringifyFunctions(o) {
for (x in o) {
if (typeof o[x] == "object") {
stringifyFunctions(o[x]);
}
if (typeof o[x] == "function") {
o[x] = o[x].toString();
}
}
})(spritesheetContent);
var newName = oldName.split(".js").join(".json");
fs.writeFile(path + "/" + manifest.scope + "/" + newName, JSON.stringify(spritesheetContent), function (err) {
if (err) {
return console.error(err);
}
resolve();
});
}
});
});
}
});
Promise.all(levels.concat(spritesheets)).then(function (x) {
console.log("Updating manifest...");
fs.writeFile(path + "/manifest.json", JSON.stringify(manifest), function (err) {
if (err) {
return console.error(err);
}
resolvef();
});
});
});
}
//Levels logic
function XMLlevelsToJson(result, oldName) {
try {
return result.levels.level.map(XMLlevelToJson);
} catch (e) {
showError(oldName + " does not contain a valid XML levels file")
}
}
function XMLlevelToJson(thislevel) {
var level = {};
level.id = thislevel.$.id;
if (thislevel.object) {
level.objects = thislevel.object.map(function (thisobject) {
var object = {};
//Set name
object.name = thisobject.$.name
//Set type
if (thisobject.type && thisobject.type.length > 0) {
//Composition
object.type = thisobject.type.map(function (x) { return x.$.id; });
} else {
//Inheritance
object.type = thisobject.$.type;
}
//Set spritesheet
object.sprite = thisobject.$.spritesheet ? thisobject.$.spritesheet : null;
//Set whether the object is static
object.isstatic = thisobject.$.static ? thisobject.$.static : null;
//Set x,y,z
object.x = +thisobject.$.x;
object.y = +thisobject.$.y;
object.z = thisobject.$.z ? +thisobject.$.z : null;
//Set vars
try {
object.vars = thisobject.$.vars ? JSON.parse(thisobject.$.vars) : {};
} catch (e) {
showError("This string should be a valid JSON object but it is not");
showError(thisobject.$.vars);
object.vars = {};
}
return object;
});
} else {
level.objects = [];
}
return level;
}
//Spritesheets logic
function XMLspritesheetsToJson(result) {
return result.spritesheets.spritesheet.map(XMLspritesheetToJson);
}
function Spritesheet() {
this.name = "";
this.img;
this.states = {}
this.layers = {}
this.frames = {};
}
function State() {
this.layers = [];
}
//Holds a layer: Body, arms...
function Layer() {
this.frames = [];
this.x;
this.y;
}
//Holds a single frame
function Frame(x, y, w, h, t) {
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.t = t;
}
function XMLspritesheetToJson(thisspritesheet) {
var newspritesheet = new Spritesheet();
newspritesheet.name = thisspritesheet.$.name;
if (thisspritesheet.$.src != undefined) {
newspritesheet.src = thisspritesheet.$.src;
}
if (thisspritesheet.$.positionBasedOptimizations != undefined) {
newspritesheet.positionBasedOptimizations = thisspritesheet.$.positionBasedOptimizations;
}
thisspritesheet.frames[0].frame.forEach(function (frame) {
var newframe = new Frame();
if (frame.$.code == undefined) {
if (frame.$.fullTexture) {
newframe.fullTexture = true;
} else {
newframe.x = +frame.$.x;
newframe.y = +frame.$.y;
newframe.w = +frame.$.w
newframe.h = +frame.$.h;
}
} else {
newframe.code = frame.$.code;
}
newframe.t = +frame.$.t;
newspritesheet.frames[frame.$.name] = newframe;
});
thisspritesheet.layers[0].layer.forEach(function (layer) {
var newlayer = new Layer();
newlayer.x = layer.$.x;
newlayer.y = layer.$.y;
newlayer.frames = layer.frame ? layer.frame.map(function (f) { return f.$.name; }) : [];
newspritesheet.layers[layer.$.name] = newlayer;
});
thisspritesheet.states[0].state.forEach(function (state) {
var newstate = new State();
newstate.layers = state.layer ? state.layer.map(function (l) { return l.$.name; }) : [];
if (state.$.flip) {
newstate.flip = state.$.flip;
}
newspritesheet.states[state.$.name] = newstate;
});
return newspritesheet;
}
//File system helpers
function copyFileSync(srcFile, destFile) {
var content = fs.readFileSync(srcFile);
fs.writeFileSync(destFile, content);
}
function deleteFolderRecursive(path) {
if (fs.existsSync(path)) {
fs.readdirSync(path).forEach(function (file, index) {
var curPath = path + "/" + file;
if (fs.lstatSync(curPath).isDirectory()) { // recurse
deleteFolderRecursive(curPath);
} else { // delete file
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(path);
}
};
///CWPM
function listPackages(packageId) {
if (packageId) {
request('https://clockworkdev.github.io/ClockworkPackages/packages/' + packageId + '/versions.json', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log("Versions of " + packageId + ":");
var packages = JSON.parse(body);
packages.forEach(function (p) {
console.log(" " + p.version + " published at " + p.date);
});
}
});
} else {
request('https://clockworkdev.github.io/ClockworkPackages/packages/packages.json', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log("Packages published:");
var packages = JSON.parse(body);
packages.forEach(function (p) {
console.log(" " + p.id + " by " + p.by);
});
}
});
}
}
function register(username, email, password) {
request.post({ url: 'http://cwpm.azurewebsites.net/api/developers', form: { name: username, email: email, password: password } }, function (err, httpResponse, body) {
if (JSON.parse(body).res == "OK") {
console.log("User registered successfully");
} else {
console.log("Error registering your account. Maybe that username is already taken?");
}
})
}
function tryPublish(sourceFile, packageId, packageVersion) {
fs.access('clockwork-packages.repo', fs.constants.F_OK, (err) => {
if (err) {
console.log("Please execute this command in the Clockwork Packages root folder (where the clockwork-packages.repo is)");
} else {
fs.copy(sourceFile, `./packages/${packageId}/${packageVersion}/components.js`, (err) => {
if (err) {
console.log(err);
} else {
console.log('Package saved');
fs.readFile(sourceFile, 'utf8', (err, data) => {
if (err) {
console.log(err);
} else {
fs.outputFile(`./doc/${packageId}/${packageVersion}/doc.html`, geardoc.generateDoc(data), (err) => {
console.log(err || 'Documentation saved');
});
const versionsFile = `packages/${packageId}/versions.json`;
fs.access(versionsFile, fs.constants.F_OK, (err) => {
var versions = err ? [] : JSON.parse(fs.readFileSync(versionsFile, { encoding: 'utf8' }));
versions = versions.filter(x=>x.version != packageVersion);
versions.push({ version: packageVersion, date: new Date() });
if (err) {
fs.appendFile(versionsFile, JSON.stringify(versions, null, 4), (e) => {
console.log(e || 'Version list updated');
});
} else {
fs.writeFile(versionsFile, JSON.stringify(versions, null, 4), (e) => {
console.log(e || 'Version list updated');
});
}
});
const packagesFile = `packages/packages.json`;
fs.access(packagesFile, fs.constants.F_OK, (err) => {
var packages = err ? [] : JSON.parse(fs.readFileSync(packagesFile, { encoding: 'utf8' }));
if (packages.filter(x => x.id == packageId).length == 0) {
exec('git config --global user.name', (err, stdout, stderr) => {
var name = stdout.replace('\n', '');
packages.push({ id: packageId, by: name });
if (err) {
fs.appendFile(packagesFile, JSON.stringify(packages, null, 4), (e) => {
console.log(e || 'Package list updated');
});
} else {
fs.writeFile(packagesFile, JSON.stringify(packages, null, 4), (e) => {
console.log(e || 'Package list updated');
});
}
});
}
});
}
});
}
});
}
});
}
function addPackage(getData, packageName, packageVersion) {
if (typeof packageName === 'undefined') {
console.log("You must specify a module");
return;
}
var manifest = readManifest();
if (manifest == null) {
console.log("There is no Clockwork project in the working folder");
return;
}
if (typeof manifest.dependencies[packageName] === 'undefined') {
continueAddPackage();
} else {
getData({
properties: {
confirm: {
description: 'This package is already a dependency, do you want to change the version? (Y/N)',
pattern: /Y|N/,
required: true
},
}
}, function (err, result) {
if (result.confirm == "Y") {
continueAddPackage();
}
});
}
function continueAddPackage() {
request('http://cwpm.azurewebsites.net/api/packages/' + packageName, function (error, response, body) {
if (!error && response.statusCode == 200) {
var packages = JSON.parse(body);
if (packages.length == 0) {
console.log("This package can't be found on the online repository.");
return;
}
if (typeof packageVersion === 'undefined') {
var lastVersion = packages.sort(function (a, b) { return new Date(b.date) - new Date(a.date) })[0].version;
manifest.dependencies[packageName] = lastVersion
writeManifest(manifest, function (err) {
if (err) {
console.log("An error happened while trying to update the manifest");
} else {
console.log("Version " + lastVersion + " of " + packageName + " added to the dependencies");
}
});
} else {
if (packages.filter(function (p) { return p.version == packageVersion; }).length > 0) {
manifest.dependencies[packageName] = packageVersion;
writeManifest(manifest, function (err) {
if (err) {
console.log("An error happened while trying to update the manifest");
} else {
console.log("Version " + packageVersion + " of " + packageName + " added to the dependencies");
}
});
} else {
console.log("This version can't be found. Please list all the published versions with 'clockwork list " + packageName + "'");
}
}
}
});
}
}
function updatePackage(packageName) {
var manifest = readManifest();
if (manifest == null) {
console.log("There is no Clockwork project in the working folder");
return;
}
if (typeof packageName === 'undefined') {
Promise.all(Object.keys(manifest.dependencies).map(function (x) { return updateDependencyPromise(x) })).then(function () {
writeManifest(manifest);
});
} else {
updateDependencyPromise(packageName).then(function () {
writeManifest(manifest);
});
}
function updateDependencyPromise(packageName) {
return new Promise(function (resolve, reject) {
request('http://cwpm.azurewebsites.net/api/packages/' + packageName, function (error, response, body) {
if (!error && response.statusCode == 200) {
var packages = JSON.parse(body);
if (packages.length == 0) {
console.log("No versions of the module " + packageName + " have been found in the online repository.");
} else {
var lastVersion = packages.sort(function (a, b) { return new Date(b.date) - new Date(a.date) })[0].version;
if (manifest.dependencies[packageName] != lastVersion) {
console.log(packageName + " updated from " + manifest.dependencies[packageName] + " to " + lastVersion);
manifest.dependencies[packageName] = lastVersion;
} else {
console.log(packageName + " is already up to date");
}
}
resolve();
}
});
});
}
}
function runBridge(name, callback) {
if (bridges[name]) {
buildProject(function (packageName) {
if (!fs.existsSync(rootPath + name)) {
fs.mkdirSync(rootPath + name);
}
bridges[name](packageName, rootPath + name);
if (callback) {
callback(true);
}
});
} else {
console.log("This bridge can't be found, the following bridges are available:");
for (var bridge in bridges) {
console.log(" " + bridge);
}
if (callback) {
callback(false);
}
}
}
//Help
function help() {
console.log("The following commands are allowed:");
console.log("\n > clockwork init <projectName>");
console.log(" Creates an empty Clockwork project in the working directory");
console.log("\n > clockwork build");
console.log(" Builds the Clockwork project in the working directory, generating a .cw file");
console.log("\n > clockwork list");
console.log(" Lists the Clockwork modules available in the online repository");
console.log("\n > clockwork list <moduleName>");
console.log(" Lists the versions of that module available in the online repository");
console.log("\n > clockwork add <moduleName>");
console.log(" Adds the last version of the specified module as a dependency of the current project");
console.log("\n > clockwork add <moduleName> <moduleVersion>");
console.log(" Adds the specified version of the specified module as a dependency of the current project");
console.log("\n > clockwork update <moduleName>");
console.log(" Updates the dependency to the specified package to the latest published version");
console.log("\n > clockwork update");
console.log(" Updates the dependencies to all the packages to the latest published versions");
// console.log("\n > clockwork register");
// console.log(" Registers a developer account, allowing you to publish Clockwork modules");
console.log("\n > clockwork publish");
console.log(" Publishes a module in the Clockwork online repository");
console.log("\n > clockwork bridge <bridgeName>");
console.log(" Uses the specified bridge to export the game");
}
module.exports = function (cwd, getData, logFunction, showErrorMessage) {
rootPath = cwd;
if (logFunction) {
log = logFunction;
}
if (showErrorMessage) {
showError = showErrorMessage;
}
return {
createProject: createProject,
buildProject: buildProject,
listPackages: listPackages,
addPackage: addPackage.bind(null, getData),
updatePackage: updatePackage,
register: register,
tryPublish: tryPublish.bind(null, getData),
runBridge: runBridge
}
};
})();