react-map-gl/website/docusaurus.config.js
2023-08-09 11:16:31 -07:00

200 lines
5.4 KiB
JavaScript

// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
const webpack = require('webpack');
const {resolve} = require('path');
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'React Map GL',
tagline: 'React wrapper for Mapbox GL JS',
url: 'https://visgl.github.io/',
baseUrl: '/react-map-gl/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: '/favicon.ico',
organizationName: 'visgl', // Usually your GitHub org/user name.
projectName: 'react-map-gl', // Usually your repo name.
trailingSlash: false,
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
path: '../docs',
sidebarPath: resolve('./src/docs-sidebar.js'),
// Point to to the website directory in your repo.
editUrl: 'https://github.com/visgl/react-map-gl/tree/master/docs'
},
theme: {
customCss: [
resolve('./src/styles.css'),
resolve('../node_modules/mapbox-gl/dist/mapbox-gl.css'),
resolve('./node_modules/@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css'),
resolve('./node_modules/@mapbox/mapbox-gl-geocoder/dist/mapbox-gl-geocoder.css')
]
}
})
]
],
plugins: [
[
'./ocular-docusaurus-plugin',
{
debug: true,
resolve: {
modules: [resolve('node_modules'), resolve('../node_modules')],
alias: {
'react-map-gl': resolve('../src'),
'mapbox-gl': resolve('../node_modules/mapbox-gl'),
'maplibre-gl': resolve('../node_modules/maplibre-gl'),
'website-examples': resolve('../examples'),
react: resolve('node_modules/react'),
'react-dom': resolve('node_modules/react-dom'),
}
},
plugins: [
new webpack.EnvironmentPlugin([
'MapboxAccessToken'
]),
// These modules break server side bundling
new webpack.IgnorePlugin({
resourceRegExp: /asciify-image/
})
],
module: {
rules: [
// https://github.com/Esri/calcite-components/issues/2865
{
test: /\.m?js/,
resolve: {
fullySpecified: false
}
}
]
}
}
],
[
'@docusaurus/plugin-content-docs',
{
id: 'examples',
path: './src/examples',
routeBasePath: 'examples',
sidebarPath: resolve('./src/examples-sidebar.js'),
breadcrumbs: false,
docItemComponent: resolve('./src/components/example/doc-item-component.jsx')
}
]
],
themes: [
[
'@easyops-cn/docusaurus-search-local',
{
// https://github.com/easyops-cn/docusaurus-search-local#theme-options
// `hashed` is recommended as long-term-cache of index file is possible.
hashed: true,
},
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
title: 'react-map-gl',
logo: {
alt: 'vis.gl Logo',
src: 'images/visgl-logo-dark.png',
srcDark: 'images/visgl-logo-light.png'
},
items: [
{
to: '/examples',
position: 'left',
label: 'Examples'
},
{
to: '/docs',
position: 'left',
label: 'Docs'
},
{
href: 'https://github.com/visgl/react-map-gl',
label: 'GitHub',
position: 'right'
}
]
},
footer: {
style: 'dark',
links: [
{
title: 'Resources',
items: [
{
label: 'API Reference',
to: '/docs/api-reference/map'
},
{
label: 'Starter templates',
href: 'https://github.com/visgl/react-map-gl/tree/master/examples/get-started'
}
]
},
{
title: 'Other vis.gl Libraries',
items: [
{
label: 'deck.gl',
href: 'https://deck.gl'
},
{
label: 'luma.gl',
href: 'https://luma.gl'
},
{
label: 'loaders.gl',
href: 'https://loaders.gl'
},
{
label: 'nebula.gl',
href: 'https://nebula.gl'
}
]
},
{
title: 'More',
items: [
{
label: 'Open Visualization',
href: 'https://www.openvisualization.org/#'
},
{
label: 'vis.gl blog on Medium',
href: 'https://medium.com/vis-gl'
},
{
label: 'GitHub',
href: 'https://github.com/visgl/react-map-gl'
}
]
}
],
copyright: `Copyright © ${new Date().getFullYear()} OpenJS Foundation`
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme
}
})
};
module.exports = config;