This repository has been archived by the owner on May 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
static.config.js
60 lines (52 loc) · 1.49 KB
/
static.config.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
'use strict';
const fs = require('fs');
const path = require('path');
const {combineReducers} = require('redux');
const useUrls = require('./lib/utils/useUrls').default;
const languageData = require('./docs/public/i18n/en-us.json');
const {formReducer} = require('./lib/input-redux');
const getCode = relativePath => {
const data = {};
const folderPath = path.resolve(__dirname, relativePath);
fs.readdirSync(folderPath)
.forEach(file => {
if((/.js/).test(file))
data[file.replace(/.js/, '')] = fs.readFileSync(
path.resolve(folderPath, file),
{encoding: 'utf-8'}
).replace(/[ ]*\/\*.*\*\/[ ||\n]/g, '');
});
return data;
};
const data = Object.assign({},
getCode('./docs/src/components/'),
getCode('./docs/src/components/multiple')
);
module.exports = useUrls(['/', '/multiple/'], {
name: 'docs',
component: './lib/docs/components/index/Index',
redux: true,
js: 'index',
languageData: JSON.stringify(languageData),
data: JSON.stringify(data),
props: {
defaultData: languageData,
data,
redux: {
reducer: combineReducers(formReducer)
}
}
}).concat(useUrls(['/login/', '/register/'], {
name: 'docs',
component: './lib/docs/components/templates/login/Login',
js: 'login',
props: {
redux: {
reducer: combineReducers(formReducer)
}
}
})).concat(useUrls(['/', '/page1/', '/page2/'], {
name: 'docs/dashboard',
component: './lib/docs/components/templates/dashboard/Dashboard',
js: 'dashboard'
}));