Skip to content

Commit

Permalink
Use shared module to build website (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress authored Aug 27, 2024
1 parent d25e64f commit df70bfb
Show file tree
Hide file tree
Showing 50 changed files with 34 additions and 14,256 deletions.
File renamed without changes.
2 changes: 0 additions & 2 deletions website/.eslintignore

This file was deleted.

222 changes: 17 additions & 205 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,215 +1,27 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion

const webpack = require('webpack');
const {getDocusaurusConfig} = require('@vis.gl/docusaurus-website');
const {resolve} = require('path');

const {themes} = require('prism-react-renderer');
const lightCodeTheme = themes.github;
const darkCodeTheme = themes.dracula;

/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'math.gl',
const config = getDocusaurusConfig({
projectName: 'math.gl',
tagline: 'A collection of math modules for Geospatial and 3D visualization use cases',
url: 'https://math.gl',
baseUrl: '/math.gl',
onBrokenLinks: 'warn',
onBrokenMarkdownLinks: 'warn',
favicon: '/favicon.png',
organizationName: 'visgl', // Usually your GitHub org/user name.
projectName: 'math.gl', // Usually your repo name.
trailingSlash: false,
siteUrl: 'https://visgl.github.io/math.gl',
repoUrl: 'https://github.com/visgl/math.gl',

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/math.gl/tree/master/website',
},
theme: {
customCss: [
resolve('./src/styles.css'),
// resolve('./node_modules/maplibre-gl/dist/maplibre-gl.css')
],
},
}),
]
],
docsTableOfContents: require('../docs/table-of-contents.json'),

plugins: [
[
'./ocular-docusaurus-plugin',
{
debug: true,
resolve: {
modules: [resolve('node_modules'), resolve('../node_modules')],
alias: {
'website-examples': resolve('../examples'),
// examplesDir: './src/examples',
// exampleTableOfContents: require('./src/examples/table-of-contents.json'),

'@math.gl/types': resolve('../modules/types/src'),
'@math.gl/core': resolve('../modules/core/src'),
'@math.gl/culling': resolve('../modules/culling/src'),
'@math.gl/geospatial': resolve('../modules/geospatial/src'),
'@math.gl/geoid': resolve('../modules/geoid/src'),
'@math.gl/polygon': resolve('../modules/polygon/src'),
'@math.gl/proj4': resolve('../modules/proj4/src'),
'@math.gl/web-mercator': resolve('../modules/web-mercator/src'),
'@math.gl/sun': resolve('../modules/sun/src'),
'@math.gl/ddgs-geohash': resolve('../modules/ddgs-geohash/src'),
'@math.gl/dggs-quadkey': resolve('../modules/dggs-quadkey/src'),
'@math.gl/dggs-s2': resolve('../modules/dggs-s2/src'),
search: 'local',

'@probe.gl/bench': resolve('../node_modules/@probe.gl/bench')
}
},
plugins: [
// new webpack.EnvironmentPlugin(['MapboxAccessToken', 'GoogleMapsAPIKey', 'GoogleMapsMapId']),
// 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')
},
],
[
require.resolve('@cmfcmf/docusaurus-search-local'),
{
// Options here
webpackConfig: {
resolve: {
alias: {
'website-examples': resolve('../examples'),
'@probe.gl/bench': resolve('../node_modules/@probe.gl/bench')
}
],
[
'@docusaurus/plugin-client-redirects',
{
createRedirects(existingPath) {
// docs/modules/*/api-reference <= modules/*/docs/api-reference
if (existingPath.includes('/docs/modules/')) {
return [
existingPath
.replace('/docs/modules/', '/modules/')
// Replaces api-reference if present
.replace('/api-reference/', '/docs/api-reference/')
];
}
return undefined; // Return a falsy value: no redirect created
}
}
]
],

themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
title: 'math.gl',
logo: {
alt: 'vis.gl Logo',
src: 'images/visgl-logo-dark.png',
},
items: [
{
to: '/examples',
position: 'left',
label: 'Examples',
},
{
to: '/docs',
position: 'left',
label: 'Docs',
},
// {
// to: '/showcase',
// position: 'left',
// label: 'Showcase',
// },
{
to: 'https://medium.com/vis-gl',
label: 'Blog',
position: 'left'
},
{
href: 'https://github.com/visgl/math.gl',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Other vis.gl Libraries',
items: [
{
label: 'luma.gl',
href: 'https://luma.gl',
},
{
label: 'loaders.gl',
href: 'https://loaders.gl',
},
{
label: 'deck.gl',
href: 'https:/deck.gl',
},
{
label: 'vis.gl',
href: 'https://vis.gl',
},
],
},
{
title: 'More',
items: [
{
label: 'deck.gl slack',
href: 'https://join.slack.com/t/deckgl/shared_invite/zt-7oeoqie8-NQqzSp5SLTFMDeNSPxi7eg',
},
{
label: 'vis.gl blog on Medium',
href: 'https://medium.com/vis-gl',
},
{
label: 'GitHub',
href: 'https://github.com/visgl/math.gl',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} OpenJS Foundation`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
}),
};
}
}
});

module.exports = config;
49 changes: 0 additions & 49 deletions website/ocular-docusaurus-plugin/index.js

This file was deleted.

33 changes: 4 additions & 29 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,14 @@
"swizzle": "docusaurus swizzle",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-heading-ids": "ts-node scripts/write-heading-ids.ts",
"write-heading-ids": "ocular-doc-headers ../docs",
"deploy": "docusaurus deploy"
},
"dependencies": {
"@algolia/autocomplete-js": "^1.8.3",
"@docusaurus/core": "^3.0.0",
"@docusaurus/preset-classic": "^3.0.0",
"@loaders.gl/i3s": "^3.3.1",
"@loaders.gl/las": "^3.3.1",
"@loaders.gl/obj": "^3.3.1",
"@loaders.gl/ply": "^3.3.1",
"@material-ui/core": "^4.10.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.57",
"@mdx-js/react": "^3.0.0",
"docusaurus-mdx-checker": "^3.0.0",
"d3-color": "^3.1.0",
"d3-request": "^1.0.6",
"mapbox-gl": "^2.0.0",
"maplibre-gl": "^2.4.0",
"@docusaurus/core": "^2.0.0",
"@vis.gl/docusaurus-website": "1.0.0-alpha.10",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-map-gl": "^7.0.0",
"styled-components": "^5.3.3"
},
"devDependencies": {
"@cmfcmf/docusaurus-search-local": "^1.0.0",
"@docusaurus/module-type-aliases": "^3.0.0",
"@docusaurus/plugin-client-redirects": "^3.0.0",
"@docusaurus/plugin-content-docs": "^3.0.0",
"babel-plugin-styled-components": "^2.0.0",
"prism-react-renderer": "^2.1.0",
"ts-node": "~10.9.1"
"react-dom": "^18.2.0"
},
"browserslist": [
">0.2% and supports async-functions",
Expand Down
36 changes: 0 additions & 36 deletions website/scripts/build.sh

This file was deleted.

Loading

0 comments on commit df70bfb

Please sign in to comment.