-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
batfish.config.js
88 lines (84 loc) · 3.35 KB
/
batfish.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
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
const webpack = require('webpack');
const mapboxAssembly = require('@mapbox/mbx-assembly');
const path = require('path');
const apiNavigation = require('./docs/data/api-navigation');
const { buildApiSearch } = require('./docs/util/build-api-search');
const {
buildNavigation,
buildFilters
} = require('@mapbox/dr-ui/helpers/batfish/index.js');
const addPages = [
{
title: 'Style Specification',
path: 'https://maplibre.org/maplibre-style-spec/',
navOrder: 5
}
];
const siteBasePath = '/maplibre-gl-js-docs';
module.exports = () => {
const config = {
siteBasePath: siteBasePath,
siteOrigin: 'https://maplibre.github.io', // TODO: move to Radar domain
pagesDirectory: `${__dirname}/docs/pages`,
outputDirectory: path.join(__dirname, '_site'),
browserslist: mapboxAssembly.browsersList,
postcssPlugins: mapboxAssembly.postcssPipeline.plugins,
productionDevtool: 'source-map',
stylesheets: [
require.resolve('@mapbox/mbx-assembly/dist/assembly.css'),
require.resolve('@mapbox/dr-ui/css/docs-prose.css'),
`${__dirname}/docs/components/site.css`,
require.resolve('@mapbox/dr-ui/css/prism.css'),
`${__dirname}/vendor/docs-page-shell/page-shell-styles.css`
],
applicationWrapperPath: `${__dirname}/docs/components/application-wrapper.js`,
webpackLoaders: [
// Use raw loader to get the HTML string contents of examples
{
test: /\.html$/,
use: 'raw-loader'
}
],
ignoreWithinPagesDirectory: ['example/*.html'],
webpackPlugins: [
// Make environment variables available within JS that Webpack compiles.
new webpack.DefinePlugin({
// DEPLOY_ENV is used in config to pick between local/production.
'process.env.DEPLOY_ENV': `"${process.env.DEPLOY_ENV}"`
})
],
inlineJs: [
{
filename: `${__dirname}/vendor/docs-page-shell/page-shell-script.js`
}
],
jsxtremeMarkdownOptions: {
getWrapper: () => {
return path.join(__dirname, './docs/components/page-shell.js');
},
rehypePlugins: [
require('rehype-slug'),
require('@mapbox/rehype-prism'),
require('@mapbox/dr-ui/plugins/add-links-to-headings'),
require('@mapbox/dr-ui/plugins/make-table-scroll')
]
},
dataSelectors: {
apiSearch: () => buildApiSearch(),
apiNavigation: () => apiNavigation,
navigation: (data) =>
buildNavigation({ siteBasePath, data, addPages }),
filters: (data) => buildFilters(data)
},
devBrowserslist: false,
babelInclude: ['documentation', 'fuse.js'],
webpackStaticIgnore: [/util\/util\.js$/]
};
// Local builds treat the `dist` directory as static assets, allowing you to test examples against the
// local branch build. Non-local builds ignore the `dist` directory, and examples load assets from the CDN.
config.unprocessedPageFiles = ['**/dist/**/*.*'];
if (process.env.DEPLOY_ENV !== 'local') {
config.ignoreWithinPagesDirectory.push('**/dist/**/*.*');
}
return config;
};