forked from ionic-team/ionic-app-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
35 lines (29 loc) · 812 Bytes
/
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
var fs = require('fs'),
IonicAppLib = module.exports,
path = require('path');
var capitalize = function capitalize(str) {
return str && str[0].toUpperCase() + str.slice(1);
};
var camelCase = function camelCase(input) {
return input.toLowerCase().replace(/-(.)/g, function(match, group1) {
return group1.toUpperCase();
});
};
//
// Setup all modules as lazy-loaded getters.
//
fs.readdirSync(path.join(__dirname, 'lib')).forEach(function (file) {
file = file.replace('.js', '');
var command;
if (file.indexOf('-') > 0) {
command = camelCase(file);
} else {
command = file;
}
IonicAppLib.__defineGetter__(command, function () {
return require('./lib/' + file);
});
});
IonicAppLib.__defineGetter__('semver', function () {
return require('semver');
});