This repository has been archived by the owner on Mar 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
43 lines (37 loc) · 1.46 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
'use strict';
var AwesomeModule = require('awesome-module');
var Dependency = AwesomeModule.AwesomeModuleDependency;
var glob = require('glob-all');
var moduleName = 'linagora.esn.emoticon';
var FRONTEND_JS_PATH = __dirname + '/frontend/js/';
const path = require('path');
var AwesomeEmoticonModule = new AwesomeModule(moduleName, {
dependencies: [
new Dependency(Dependency.TYPE_NAME, 'linagora.esn.core.logger', 'logger'),
new Dependency(Dependency.TYPE_NAME, 'linagora.esn.core.webserver.wrapper', 'webserver-wrapper'),
new Dependency(Dependency.TYPE_NAME, 'linagora.esn.core.i18n', 'i18n')
],
states: {
deploy: function(dependencies, callback) {
// Register the webapp
var app = require('./backend/webserver')(dependencies);
var webserverWrapper = dependencies('webserver-wrapper');
const lessFile = path.resolve(__dirname, './frontend/css/style.less');
var jsFiles = glob.sync([
FRONTEND_JS_PATH + '**/*.module.js',
FRONTEND_JS_PATH + '**/!(*spec).js'
]).map(function(filepath) {
return filepath.replace(FRONTEND_JS_PATH, '');
});
webserverWrapper.injectAngularModules(moduleName, jsFiles, [moduleName], ['esn']);
webserverWrapper.injectLess(moduleName, [lessFile], 'esn');
webserverWrapper.addApp(moduleName, app);
return callback();
}
}
});
/**
* The main AwesomeModule describing the application.
* @type {AwesomeModule}
*/
module.exports = AwesomeEmoticonModule;