Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(examples) using vite in website examples #271

Merged
merged 6 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/website/basic-basemap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export MapboxAccessToken=<mapbox_access_token>

Or set `MAPBOX_TOKEN` directly in `app.js`.

Other options can be found at [using with Mapbox GL](../../../docs/get-started/using-with-mapbox-gl.md).
Other options can be found at [using with Mapbox GL](https://deck.gl/docs/developer-guide/base-maps/using-with-mapbox).

### Installation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import React, {useState, useRef, useEffect} from 'react';
import {render} from 'react-dom';
import DeckGL from '@deck.gl/react';
import {BasicControls, useHubbleGl, useDeckAnimation} from '@hubble.gl/react';
import {StaticMap} from 'react-map-gl';
Expand Down Expand Up @@ -175,3 +176,14 @@ export default function App({mapStyle = 'mapbox://styles/mapbox/streets-v11'}) {
</Container>
);
}

export async function renderToDOM(container) {
render(<App />, container);

// const root = createRoot(container);
// root.render(<App />);

// const resp = await fetch(DATA_URL);
// const {features} = await resp.json();
// root.render(<App data={features} />);
}
19 changes: 19 additions & 0 deletions examples/website/basic-basemap/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>hubble.gl Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {margin: 0; font-family: sans-serif; width: 100vw; height: 100vh; overflow: hidden;}
#app {width: 100%; height: 100%;}
</style>
</head>
<body>
<div id="app"></div>
</body>
<script type="module">
import {renderToDOM} from './app.jsx';
renderToDOM(document.getElementById('app'));
</script>
</html>
11 changes: 0 additions & 11 deletions examples/website/basic-basemap/index.js

This file was deleted.

21 changes: 8 additions & 13 deletions examples/website/basic-basemap/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"name": "hubblegl-examples-basic-basemap",
"version": "0.0.0",
"private": true,
"license": "MIT",
"scripts": {
"start": "webpack-dev-server --progress --hot --open",
"start-local": "webpack-dev-server --env.local --progress --hot --open",
"start-local-luma": "webpack-dev-server --env.local --env.local-luma --progress --hot --open",
"clean": "rm -rf yarn.lock ./node_modules",
"bootstrap": "yarn clean && yarn"
"start": "vite --open",
"start-local": "vite --config ../../vite.config.local.mjs",
"build": "vite build"
},
"dependencies": {
"deck.gl": "^8.3.8",
Expand All @@ -16,14 +18,7 @@
"popmotion": "9.3.1"
},
"devDependencies": {
"@babel/core": "^7.12.1",
"@babel/preset-env": "^7.12.1",
"@babel/preset-react": "^7.12.1",
"babel-loader": "^8.0.5",
"html-webpack-plugin": "^3.0.7",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.11"
"vite": "^4.0.0"
},
"resolutions_comments": [
"mapbox-gl: pinned to v1 for open license"
Expand Down
5 changes: 5 additions & 0 deletions examples/website/basic-basemap/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
define: {
'process.env.MapboxAccessToken': JSON.stringify(process.env.MapboxAccessToken)
}
};
34 changes: 0 additions & 34 deletions examples/website/basic-basemap/webpack.config.js

This file was deleted.

12 changes: 12 additions & 0 deletions examples/website/camera/app.js → examples/website/camera/app.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, {useState, useRef, useEffect} from 'react';
import {render} from 'react-dom';
import DeckGL from '@deck.gl/react';
import {useHubbleGl, BasicControls} from '@hubble.gl/react';
import {vignette, fxaa} from '@luma.gl/shadertools';
Expand Down Expand Up @@ -148,3 +149,14 @@ export default function App() {
</Container>
);
}

export async function renderToDOM(container) {
render(<App />, container);

// const root = createRoot(container);
// root.render(<App />);

// const resp = await fetch(DATA_URL);
// const {features} = await resp.json();
// root.render(<App data={features} />);
}
19 changes: 19 additions & 0 deletions examples/website/camera/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>hubble.gl Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {margin: 0; font-family: sans-serif; width: 100vw; height: 100vh; overflow: hidden;}
#app {width: 100%; height: 100%;}
</style>
</head>
<body>
<div id="app"></div>
</body>
<script type="module">
import {renderToDOM} from './app.jsx';
renderToDOM(document.getElementById('app'));
</script>
</html>
11 changes: 0 additions & 11 deletions examples/website/camera/index.js

This file was deleted.

21 changes: 8 additions & 13 deletions examples/website/camera/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"name": "hubblegl-examples-camera",
"version": "0.0.0",
"private": true,
"license": "MIT",
"scripts": {
"start": "webpack-dev-server --progress --hot --open",
"start-local": "webpack-dev-server --env.local --progress --hot --open",
"start-local-luma": "webpack-dev-server --env.local --env.local-luma --progress --hot --open",
"clean": "rm -rf yarn.lock ./node_modules",
"bootstrap": "yarn clean && yarn"
"start": "vite --open",
"start-local": "vite --config ../../vite.config.local.mjs",
"build": "vite build"
},
"dependencies": {
"d3-color": "^1.4.1",
Expand All @@ -15,13 +17,6 @@
"popmotion": "9.3.1"
},
"devDependencies": {
"@babel/core": "^7.12.1",
"@babel/preset-env": "^7.12.1",
"@babel/preset-react": "^7.12.1",
"babel-loader": "^8.0.5",
"html-webpack-plugin": "^3.0.7",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.11"
"vite": "^4.0.0"
}
}
34 changes: 0 additions & 34 deletions examples/website/camera/webpack.config.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import {render} from 'react-dom';
import {ScatterplotLayer, TextLayer} from '@deck.gl/layers';
import {QuickAnimation, hold, useDeckAnimation} from 'hubble.gl';
import {anticipate, easeIn, reverseEasing} from 'popmotion';
Expand Down Expand Up @@ -99,3 +100,14 @@ export default function App() {
</Container>
);
}

export async function renderToDOM(container) {
render(<App />, container);

// const root = createRoot(container);
// root.render(<App />);

// const resp = await fetch(DATA_URL);
// const {features} = await resp.json();
// root.render(<App data={features} />);
}
19 changes: 19 additions & 0 deletions examples/website/quick-start/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>hubble.gl Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {margin: 0; font-family: sans-serif; width: 100vw; height: 100vh; overflow: hidden;}
#app {width: 100%; height: 100%;}
</style>
</head>
<body>
<div id="app"></div>
</body>
<script type="module">
import {renderToDOM} from './app.jsx';
renderToDOM(document.getElementById('app'));
</script>
</html>
11 changes: 0 additions & 11 deletions examples/website/quick-start/index.js

This file was deleted.

28 changes: 12 additions & 16 deletions examples/website/quick-start/package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
{
"name": "hubblegl-examples-quick-start",
"version": "0.0.0",
"private": true,
"license": "MIT",
"scripts": {
"start": "webpack-dev-server --progress --hot --open",
"start-local": "webpack-dev-server --env.local --progress --hot --open",
"start-local-luma": "webpack-dev-server --env.local --env.local-luma --progress --hot --open",
"clean": "rm -rf yarn.lock ./node_modules",
"bootstrap": "yarn clean && yarn"
"start": "vite --open",
"start-local": "vite --config ../../vite.config.local.mjs",
"build": "vite build"
},
"dependencies": {
"d3-color": "^1.4.1",
"hubble.gl": "^1.3.0",
"deck.gl": "^8.3.8",
"deck.gl": "8.8.6",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"popmotion": "9.3.1"
},
"devDependencies": {
"@babel/core": "^7.12.1",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-transform-runtime": "^7.12.1",
"@babel/preset-env": "^7.12.1",
"@babel/preset-react": "^7.12.1",
"babel-loader": "^8.0.5",
"html-webpack-plugin": "^3.0.7",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.11"
"vite": "^4.0.0"
},
"resolutions": {
"@luma.gl/core": "8.5.16"
}
}
Loading
Loading