-
Notifications
You must be signed in to change notification settings - Fork 67
/
site.js
124 lines (106 loc) · 5.01 KB
/
site.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//require('dotenv').load();
//require('bixby')('org.kerouacjs/main', { dev: true });
//return;
require('dotenv').config()
var kerouac = require('kerouac');
var book = require('kerouac-book');
var blog = require('kerouac-blog');
var moment = require('moment');
var site = kerouac();
site.engine('pug', require('pug').renderFile);
site.set('output', 'www');
site.set('base url', 'https://www.passportjs.org');
site.set('layout engine', 'pug');
site.set('output', 'www');
site.locals.pretty = true;
/*
//site.use('/packages', require('kerouac-npm-packages/app/www/site')());
site.use('/packages/-/v1', require('kerouac-npm-packages').api.esc.v1());
// FIXME: Why can't this be mounted below the /packages?
site.use('/packages/-', require('kerouac-npm-packages').api.esc());
//site.use('/packages', require('kerouac-npm-packages').api());
site.use('/packages', require('kerouac-npm-packages')());
site.page('/packages/sitemap.xml', require('kerouac-sitemap')());
*/
var packagesApp = kerouac();
packagesApp.set('output', 'www'); // FIXME: why is this needed?
packagesApp.locals.pretty = true;
packagesApp.locals.timeAgo = function(time) {
return moment(time).fromNow();
}
packagesApp.set('layout engine', 'pug');
packagesApp.use('/', require('kerouac-manifest')()); // FIXME: why is this needed
packagesApp.use('/-/v1', require('kerouac-npm-packages').api.esc.v1());
packagesApp.use('/-', require('kerouac-npm-packages').api.esc());
packagesApp.use('/', require('kerouac-npm-packages')());
packagesApp.page('/sitemap.xml', require('kerouac-sitemap')());
site.use('/packages', packagesApp);
var blogApp = kerouac();
site.use('/blog', blogApp);
//site.use('/docs/howto', kerouac.content('howto'));
site.use('/concepts/authentication', book('docs'));
site.use('/concepts/api-authentication', book('books/concepts/api-authentication'));
site.use('/concepts/bearer-token', book('books/concepts/bearer-token'));
site.use('/concepts/delegated-authorization', book('books/concepts/delegated-authorization'));
site.use('/concepts/google', book('books/concepts/google'));
site.use('/concepts/oauth', book('books/concepts/oauth'));
site.use('/concepts/oauth2', book('books/concepts/oauth2'));
site.use('/concepts/twitter', book('books/concepts/twitter'));
site.use('/howtos/password', book('books/howtos/password'));
site.use('/howtos/session', book('books/howtos/session'));
//site.use('/howtos/google', book('books/howtos/google'));
site.use('/reference/normalized-profile', book('books/reference/normalized-profile'));
site.use('/tutorials/password', book('books/tutorials/password'));
site.use('/tutorials/google', book('books/tutorials/google'))
site.use('/tutorials/facebook', book('books/tutorials/facebook'))
site.use('/tutorials/email', book('books/tutorials/email'))
site.use('/tutorials/auth0', book('books/tutorials/auth0'))
site.use(kerouac.content('content'));
//site.assets('assets');
//site.use('/howto', kerouac.content('howto'));
//site.use('/blog', require('kerouac-blog')({ layout: 'blog' }));
site.use('/', require('kerouac-manifest')());
site.page('/sitemap.xml', require('kerouac-sitemap')());
site.page('/sitemap-index.xml', require('kerouac-sitemap').index());
site.use(require('kerouac-robotstxt')());
site.use(kerouac.assets('assets'));
// TODO: .well-known/security.txt
////[ '/packages', require('kerouac-sitemap').browser(), false ],
site.generate({
'/packages': [
//require('kerouac-npm-packages').createMapper(),
//require('kerouac-sitemap').createMapper(),
],
'/': [
kerouac.content.createMapper(),
kerouac.assets.createMapper(),
require('kerouac-sitemap').createMapper({ index: 'sitemap-index.xml' }),
require('kerouac-robotstxt').createMapper()
],
'/concepts/authentication': book.createMapper('docs', true),
'/concepts/api-authentication': book.createMapper('books/concepts/api-authentication'),
'/concepts/delegated-authorization': book.createMapper('books/concepts/delegated-authorization'),
'/concepts/bearer-token': book.createMapper('books/concepts/bearer-token'),
'/concepts/google': book.createMapper('books/concepts/google'),
'/concepts/oauth': book.createMapper('books/concepts/oauth'),
'/concepts/oauth2': book.createMapper('books/concepts/oauth2'),
'/concepts/twitter': book.createMapper('books/concepts/twitter'),
'/howtos/password': book.createMapper('books/howtos/password'),
'/howtos/session': book.createMapper('books/howtos/session'),
//'/howtos/google': book.createMapper('books/howtos/google'),
'/reference/normalized-profile': book.createMapper('books/reference/normalized-profile'),
'/tutorials/password': book.createMapper('books/tutorials/password'),
'/tutorials/google': book.createMapper('books/tutorials/google'),
'/tutorials/facebook': book.createMapper('books/tutorials/facebook'),
'/tutorials/email': book.createMapper('books/tutorials/email'),
'/tutorials/auth0': book.createMapper('books/tutorials/auth0'),
//'/blog': blog.createMapper(),
},
function(err) {
console.log('DONE!');
if (err) {
console.error(err.message);
console.error(err.stack);
return;
}
});