This repository has been archived by the owner on Sep 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-manifest.js
executable file
·91 lines (84 loc) · 1.88 KB
/
make-manifest.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
#!/usr/bin/env node
'use strict'
// core
const fs = require('fs')
const isProd = process.argv[2] === 'prod'
const manifest = {
server: {
app: {
siteTitle: 'Committed Streaker',
nav: {
left: [
{ path: '/', text: 'Accueil' },
{ path: '/today', text: 'Codeurs actifs' }
],
right: [
{ path: '/a-propos', text: 'À propos' }
]
}
},
load: { sampleInterval: 1000 }
},
connections: [{ port: 3040, address: '127.0.0.1' }],
registrations: [
{ plugin: 'hapi-context-credentials' },
{ plugin: 'hapi-auth-cookie' },
{ plugin: 'bell' },
{ plugin: 'hapi-context-app' },
{
plugin: {
register: './plugins/login',
options: { secureCookies: false }
}
},
{ plugin: 'vision' },
{
plugin: {
register: 'visionary',
options: {
engines: { 'ejs': 'ejs' },
path: 'views',
isCached: isProd
}
}
},
{
plugin: {
register: 'hapi-favicon',
options: { path: './favicon.ico', auth: false }
}
}
]
}
const devRegistrations = [
{ plugin: 'inert' },
{ plugin: 'lout' },
{
plugin: {
register: 'good',
options: {
reporters: {
console: [
{
module: 'good-squeeze',
name: 'Squeeze',
args: [{
response: '*',
log: '*'
}]
},
{ module: 'good-console' },
'stdout'
]
}
}
}
}
]
if (!isProd) {
manifest.registrations = manifest.registrations.concat(devRegistrations)
manifest.server.app.nav.right.push({ path: '/docs', text: 'API docs' })
}
fs.writeFile('manifest.json', JSON.stringify(manifest, null, ' '), () => {
console.log(`${isProd ? 'prod' : 'dev'} "manifest.json" written`)
})