Skip to content

Commit

Permalink
docs: Use shared module to build website (#2230)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress authored and ibgreen committed Sep 18, 2024
1 parent 9a82784 commit ece2af5
Show file tree
Hide file tree
Showing 84 changed files with 376 additions and 4,190 deletions.
4 changes: 1 addition & 3 deletions docs/developer-guide/installing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ However, the `@luma.gl/core` module cannot be used on its own: it relies on bein
that implements the API. luma.gl provides adapters (implementations of the abstract API)
through the `@luma.gl/webgl` and `@luma.gl/webgpu` modules.

The `@luma.gl/core` module is not usable on its own. A device adapter module must
be imported.
The `@luma.gl/core` module is not usable on its own. A device adapter module must be imported.

```bash
yarn add @luma.gl/core
yarn add @luma.gl/webgl
yarn add @luma.gl/webgpu
```

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/tutorials/hello-cube.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {HelloCubeExample} from '@site';
import {HelloCubeExample} from '@site/src/examples';

# Hello Cube

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/hello-instancing.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {HelloInstancingExample} from '@site';
import {HelloInstancingExample} from '@site/src/examples';

# Hello Instancing

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/hello-triangle.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {HelloTriangleExample} from '@site';
import {HelloTriangleExample} from '@site/src/examples';

# Hello Triangle

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/lighting.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {LightingExample} from '@site';
import {LightingExample} from '@site/src/examples';

# Lighting

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/shader-hooks.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {ShaderHooksExample} from '@site';
import {ShaderHooksExample} from '@site/src/examples';

# Shader Hooks

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/shader-modules.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {ShaderModulesExample} from '@site';
import {ShaderModulesExample} from '@site/src/examples';

# Shader Modules

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/transform-feedback.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {TransformFeedbackExample} from '@site';
import {TransformFeedbackExample} from '@site/src/examples';

# Transform Feedback

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/transform.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {TransformExample} from '@site';
import {TransformExample} from '@site/src/examples';

# Transform

Expand Down
83 changes: 4 additions & 79 deletions website/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,79 +1,4 @@
// Copied from '@docusaurus/core/lib/babel/preset' template
const ESM_TARGETS = ['>0.2% and supports async-functions', 'maintained node versions', 'not dead'];

"use strict";
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const path_1 = tslib_1.__importDefault(require("path"));
function getTransformOptions(isServer) {
const absoluteRuntimePath = path_1.default.dirname(require.resolve(`@babel/runtime/package.json`));
return {
// All optional newlines and whitespace will be omitted when generating code
// in compact mode
compact: true,
presets: [
isServer
? [
require.resolve('@babel/preset-env'),
{
targets: {
node: 16,
},
},
]
: [
require.resolve('@babel/preset-env'),
{
targets: ESM_TARGETS,
useBuiltIns: 'entry',
loose: true,
corejs: '3',
// Do not transform modules to CJS
modules: false,
// Exclude transforms that make all code slower
exclude: ['transform-typeof-symbol', 'transform-regenerator', 'transform-async-to-generator'],
},
],
require.resolve('@babel/preset-react'),
require.resolve('@babel/preset-typescript'),
],
plugins: [
// // Polyfills the runtime needed for async/await, generators, and friends
// // https://babeljs.io/docs/en/babel-plugin-transform-runtime
// [
// require.resolve('@babel/plugin-transform-runtime'),
// {
// corejs: false,
// helpers: false,
// // By default, it assumes @babel/[email protected]. Since we use >7.0.0,
// // better to explicitly specify the version so that it can reuse the
// // helper better. See https://github.com/babel/babel/issues/10261
// // eslint-disable-next-line @typescript-eslint/no-var-requires, global-require
// version: require('@babel/runtime/package.json')
// .version,
// regenerator: false,
// useESModules: true,
// // Undocumented option that lets us encapsulate our runtime, ensuring
// // the correct version is used
// // https://github.com/babel/babel/blob/090c364a90fe73d36a30707fc612ce037bdbbb24/packages/babel-plugin-transform-runtime/src/index.js#L35-L42
// absoluteRuntime: absoluteRuntimePath,
// },
// ],
// Adds syntax support for import()
isServer
? require.resolve('babel-plugin-dynamic-import-node')
: require.resolve('@babel/plugin-syntax-dynamic-import'),
],
};
}
function babelPresets(api) {
const callerName = api.caller((caller) => caller?.name);
return getTransformOptions(callerName === 'server');
}
exports.default = babelPresets;
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
plugins: ["styled-components"]
};
2 changes: 1 addition & 1 deletion website/content/examples/api/animation.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {AnimationExample} from '@site';
import {AnimationExample} from '@site/src/examples';

# Animation

Expand Down
2 changes: 1 addition & 1 deletion website/content/examples/api/cubemap.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {CubemapExample} from '@site';
import {CubemapExample} from '@site/src/examples';

# Cubemap

Expand Down
2 changes: 1 addition & 1 deletion website/content/examples/api/texture-3d.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {Texture3DExample} from '@site';
import {Texture3DExample} from '@site/src/examples';

# Texture 3D

Expand Down
2 changes: 1 addition & 1 deletion website/content/examples/index.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Examples

import {ExamplesIndex} from '@site/src/examples/components';
import {ExamplesIndex} from '@vis.gl/docusaurus-website/components';

<ExamplesIndex
getThumbnail={item => {
Expand Down
2 changes: 1 addition & 1 deletion website/content/examples/showcase/instancing.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {InstancingExample} from '@site';
import {InstancingExample} from '@site/src/examples';

# Instancing

Expand Down
2 changes: 1 addition & 1 deletion website/content/examples/showcase/persistence.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {PersistenceExample} from '@site';
import {PersistenceExample} from '@site/src/examples';

# Persistence

Expand Down
2 changes: 1 addition & 1 deletion website/content/examples/showcase/postprocessing.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {PostprocessingExample} from '@site';
import {PostprocessingExample} from '@site/src/examples';

# Postprocessing

Expand Down
42 changes: 42 additions & 0 deletions website/content/examples/table-of-contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[
{
"type": "doc",
"label": "Overview",
"id": "index"
},
{
"type": "category",
"label": "Showcase",
"items": [
"showcase/instancing",
"showcase/persistence",
"showcase/postprocessing"
]
},
{
"type": "category",
"label": "API",
"items": [
"api/animation",
"api/cubemap",
"api/texture-3d"
]
},
{
"type": "category",
"label": "Tutorials",
"items": [
"tutorials/hello-triangle",
"tutorials/hello-cube",
"tutorials/lighting",
"tutorials/hello-gltf",
"tutorials/two-cubes",
"tutorials/instanced-cubes",
"tutorials/hello-instancing",
"tutorials/shader-modules",
"tutorials/shader-hooks",
"tutorials/transform-feedback",
"tutorials/transform"
]
}
]
2 changes: 1 addition & 1 deletion website/content/examples/tutorials/hello-cube.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {HelloCubeExample} from '@site';
import {HelloCubeExample} from '@site/src/examples';

# Hello Cube

Expand Down
2 changes: 1 addition & 1 deletion website/content/examples/tutorials/hello-gltf.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {HelloGLTFExample} from '@site';
import {HelloGLTFExample} from '@site/src/examples';

# Hello glTF

Expand Down
2 changes: 1 addition & 1 deletion website/content/examples/tutorials/hello-instancing.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {HelloInstancingExample} from '@site';
import {HelloInstancingExample} from '@site/src/examples';

# Hello Instancing

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {HelloTriangleGeometryExample} from '@site';
import {HelloTriangleGeometryExample} from '@site/src/examples';

# Triangle

Expand Down
2 changes: 1 addition & 1 deletion website/content/examples/tutorials/hello-triangle.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {HelloTriangleExample} from '@site';
import {HelloTriangleExample} from '@site/src/examples';

# Hello Triangle

Expand Down
2 changes: 1 addition & 1 deletion website/content/examples/tutorials/instanced-cubes.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {InstancedCubesExample} from '@site';
import {InstancedCubesExample} from '@site/src/examples';

# Instanced Cubes

Expand Down
2 changes: 1 addition & 1 deletion website/content/examples/tutorials/lighting.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {LightingExample} from '@site';
import {LightingExample} from '@site/src/examples';

# Hello Lighting

Expand Down
2 changes: 1 addition & 1 deletion website/content/examples/tutorials/shader-hooks.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {ShaderHooksExample} from '@site';
import {ShaderHooksExample} from '@site/src/examples';

# Shader Hooks

Expand Down
2 changes: 1 addition & 1 deletion website/content/examples/tutorials/shader-modules.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {ShaderModulesExample} from '@site';
import {ShaderModulesExample} from '@site/src/examples';

# Shader Modules

Expand Down
2 changes: 1 addition & 1 deletion website/content/examples/tutorials/transform-feedback.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {TransformFeedbackExample} from '@site';
import {TransformFeedbackExample} from '@site/src/examples';

# Transform Feedback

Expand Down
2 changes: 1 addition & 1 deletion website/content/examples/tutorials/transform.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {TransformExample} from '@site';
import {TransformExample} from '@site/src/examples';

# Transform

Expand Down
2 changes: 1 addition & 1 deletion website/content/examples/tutorials/two-cubes.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeviceTabs} from '@site/src/react-luma';
import {TwoCubesExample} from '@site';
import {TwoCubesExample} from '@site/src/examples';

# Two Cubes

Expand Down
9 changes: 0 additions & 9 deletions website/content/showcase.json

This file was deleted.

12 changes: 0 additions & 12 deletions website/content/sidebars.js

This file was deleted.

Loading

0 comments on commit ece2af5

Please sign in to comment.