Skip to content
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
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Mapbox API Token (optional - a default token is provided for demo purposes)
# Get your own token at: https://account.mapbox.com/access-tokens/
VITE_MAPBOX_TOKEN=your_mapbox_token_here
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- run: yarn install --frozen-lockfile
- run: yarn ts:check
- run: yarn build
node-version: '20'
- run: npm ci
- run: npm run ts:check
- run: npm run build
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- run: yarn install --frozen-lockfile
node-version: '20'
- run: npm ci
- id: changesets
uses: changesets/action@v1
with:
publish: yarn release
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
55 changes: 42 additions & 13 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,62 @@
name: Deploy static content to Pages
name: Deploy Storybook to GitHub Pages

on:
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: true
cancel-in-progress: false

jobs:
deploy:
# Build job
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- run: yarn install --frozen-lockfile
- run: yarn build:stories
- uses: actions/configure-pages@v4
- uses: actions/upload-pages-artifact@v3
node-version: '20'
cache: 'npm'

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Install dependencies
run: npm ci

- name: Build Storybook
run: npm run build:storybook
env:
NODE_OPTIONS: --max_old_space_size=4096

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: build
- uses: actions/deploy-pages@v4
path: ./storybook-static

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- run: yarn install --frozen-lockfile
- run: yarn test
node-version: '20'
- run: npm ci
- run: npm test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ build

.vscode

coverage
coverage
storybook-static
1 change: 0 additions & 1 deletion .ladle/burger.svg

This file was deleted.

59 changes: 0 additions & 59 deletions .ladle/components.tsx

This file was deleted.

28 changes: 0 additions & 28 deletions .ladle/config.mjs

This file was deleted.

1 change: 0 additions & 1 deletion .ladle/head.html

This file was deleted.

65 changes: 0 additions & 65 deletions .ladle/style.css

This file was deleted.

7 changes: 0 additions & 7 deletions .ladle/vite.config.ts

This file was deleted.

4 changes: 2 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.*
.changeset
.ladle
.storybook
.github
.npmrc
.vscode
*.tgz
node_modules
vite.config.ts
yarn-error.log
npm-debug.log*
public
node_modules
build
Expand Down
69 changes: 69 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import type { StorybookConfig } from '@storybook/react-vite';
import { loadEnv } from 'vite';

const config: StorybookConfig = {
stories: [
'../stories/src/**/*.stories.@(js|jsx|mjs|ts|tsx)',
'../example-mapbox/src/**/*.stories.@(js|jsx|mjs|ts|tsx)',
'../example-maplibre/src/**/*.stories.@(js|jsx|mjs|ts|tsx)'
],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-links',
'@chromatic-com/storybook'
],
framework: {
name: '@storybook/react-vite',
options: {},
},
docs: {
autodocs: 'tag',
},
viteFinal: async (config, { configType }) => {
const { default: path } = await import('path');

// Load environment variables from .env file
const env = loadEnv(configType || 'development', process.cwd(), '');

// Ensure the token is properly set
const mapboxToken = env.VITE_MAPBOX_TOKEN || process.env.VITE_MAPBOX_TOKEN || 'pk.eyJ1IjoibWJhbGV4OTkiLCJhIjoiY2o1cGttZTJjMGJ5NDMycHFwY2h0amZieSJ9.fHqdZDfrCz6dEYTdnQ-hjQ';

return {
...config,
define: {
...config.define,
'import.meta.env.VITE_MAPBOX_TOKEN': JSON.stringify(mapboxToken),
'process.env.VITE_MAPBOX_TOKEN': JSON.stringify(mapboxToken),
},
resolve: {
...config.resolve,
alias: {
...config.resolve?.alias,
'react-three-map/maplibre': path.resolve(__dirname, '../src/maplibre.index.ts'),
'react-three-map/mapbox': path.resolve(__dirname, '../src/mapbox.index.ts'),
'react-three-map': path.resolve(__dirname, '../src/maplibre.index.ts'),
// Deduplicate three.js
'three': path.resolve(__dirname, '../node_modules/three')
},
dedupe: ['three', '@react-three/fiber', '@react-three/drei']
},
optimizeDeps: {
...config.optimizeDeps,
include: [
...(config.optimizeDeps?.include || []),
'maplibre-gl',
'mapbox-gl',
'three',
'@react-three/postprocessing',
'postprocessing'
],
exclude: [
...(config.optimizeDeps?.exclude || [])
],
force: true
}
};
}
};

export default config;
Loading
Loading