forked from ionic-team/ionic-app-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
31 lines (26 loc) · 770 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
var fs = require('fs');
var IonicAppLib = module.exports;
var path = require('path');
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() { // eslint-disable-line no-underscore-dangle
return require('./lib/' + file);
});
});
IonicAppLib.__defineGetter__('semver', function() { // eslint-disable-line no-underscore-dangle
return require('semver');
});