-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
67 lines (60 loc) · 1.54 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
/* eslint no-console: [0, { allow: ["log","warn", "error"] }] */
'use strict'
const Trailpack = require('trailpack')
const lib = require('./lib')
const _ = require('lodash')
module.exports = class TreefrogTrailpack extends Trailpack {
/**
* Validate Treefrog Configuration (Generated by generator-treefrog)
*/
validate () {
const treefrog = _.get(this.app.config, 'treefrog')
if (treefrog && Object.keys(treefrog).length === 0) {
this.app.log.warn('Treefrog was not configured at config.treefrog')
}
else {
// this.app.log.info('Treefrog validated')
}
return Promise.all([
lib.Validator.validateConfig(this.app.config.treefrog)
])
}
/**
* Configure Treefrog
*
* Should configure angular/react routes from trails routes
*/
configure () {
return Promise.resolve()
}
/**
* Initialize Treefrog
*/
initialize () {
// this.app.log.info('Treefrog is initialized')
// We don't need to write angular config because it can be dyn
// switch(this.app.config.treefrog.frontend) {
// case 'angular':
// lib.Utils.Angular.buildRoutes(this.app)
// .then(rotues => {
// return Promise.resolve()
// })
// default:
// return Promise.resolve()
// }
return Promise.resolve()
}
/**
* Expose the "util" module on the public API
*/
get util () {
return lib.Util
}
constructor (app) {
super(app, {
config: require('./config'),
api: require('./api'),
pkg: require('./package')
})
}
}