Skip to content

Commit d59f0ce

Browse files
authored
Initial commit
0 parents  commit d59f0ce

43 files changed

Lines changed: 7530 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/dependabot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "docker"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"
12+
- package-ecosystem: "pip"
13+
directory: "/"
14+
schedule:
15+
interval: "weekly"
16+
- package-ecosystem: "github-actions"
17+
directory: "/"
18+
schedule:
19+
interval: "weekly"

.github/workflows/deploy-pages.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Deploy Examples to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v6
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v6
26+
with:
27+
node-version: '24'
28+
cache: 'npm'
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Run tests
34+
run: npm test
35+
36+
- name: Build library
37+
run: npm run build
38+
39+
- name: Build examples for deployment
40+
run: npm run build:examples
41+
42+
- name: Setup Pages
43+
uses: actions/configure-pages@v6
44+
with:
45+
enablement: true
46+
47+
- name: Upload artifact
48+
uses: actions/upload-pages-artifact@v5
49+
with:
50+
path: './dist-examples'
51+
52+
deploy:
53+
environment: github-pages
54+
runs-on: ubuntu-latest
55+
needs: build
56+
steps:
57+
- name: Deploy to GitHub Pages
58+
id: deployment
59+
uses: actions/deploy-pages@v5
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build and Publish Docker Image
2+
3+
on:
4+
release:
5+
types: [published]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
14+
jobs:
15+
build-and-push:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v6
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v4
27+
28+
- name: Log in to Container Registry
29+
if: github.event_name == 'release'
30+
uses: docker/login-action@v4
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Extract metadata (tags, labels)
37+
id: meta
38+
uses: docker/metadata-action@v6
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
tags: |
42+
type=semver,pattern={{version}}
43+
type=semver,pattern={{major}}.{{minor}}
44+
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
45+
46+
- name: Build and push Docker image
47+
uses: docker/build-push-action@v7
48+
with:
49+
context: .
50+
push: ${{ github.event_name == 'release' }}
51+
tags: ${{ steps.meta.outputs.tags }}
52+
labels: ${{ steps.meta.outputs.labels }}
53+
cache-from: type=gha
54+
cache-to: type=gha,mode=max

.github/workflows/publish.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish to npm
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
id-token: write
12+
contents: read
13+
steps:
14+
- uses: actions/checkout@v6
15+
- uses: actions/setup-node@v6
16+
with:
17+
node-version: '24'
18+
registry-url: 'https://registry.npmjs.org'
19+
20+
- name: Install dependencies
21+
run: npm ci
22+
23+
- name: Run tests
24+
run: npm test
25+
26+
- name: Build
27+
run: npm run build
28+
29+
- name: Publish to npm
30+
run: npx -y npm@latest publish --provenance --access public

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
# Dependencies
11+
node_modules
12+
dist
13+
dist-ssr
14+
*.local
15+
geolibre-plugin/dist/
16+
geolibre-plugin/*.zip
17+
18+
# Editor directories and files
19+
.vscode/*
20+
!.vscode/extensions.json
21+
.idea
22+
.DS_Store
23+
*.suo
24+
*.ntvs*
25+
*.njsproj
26+
*.sln
27+
*.sw?
28+
29+
# Testing
30+
coverage
31+
32+
# Build
33+
dist/
34+
dist-examples/
35+
36+
# Environment
37+
.env
38+
.env.local
39+
.env.*.local
40+
.vite/

.npmignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
src/
2+
tests/
3+
examples/
4+
docs/
5+
.github/
6+
.vscode/
7+
*.test.ts
8+
*.test.tsx
9+
tsconfig.json
10+
tsconfig.build.json
11+
vite.config.ts
12+
vite.geolibre.config.ts
13+
vite.examples.config.ts
14+
vitest.config.ts
15+
scripts/
16+
geolibre-plugin/
17+
.gitignore
18+
.eslintrc
19+
.prettierrc
20+
index.html
21+
node_modules/
22+
*.log
23+
.DS_Store
24+
coverage/
25+
dist-examples/

.pre-commit-config.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v6.0.0
4+
hooks:
5+
- id: check-toml
6+
- id: check-yaml
7+
- id: end-of-file-fixer
8+
types: [python]
9+
- id: trailing-whitespace
10+
- id: requirements-txt-fixer
11+
- id: check-added-large-files
12+
args: ["--maxkb=500"]
13+
14+
- repo: https://github.com/psf/black-pre-commit-mirror
15+
rev: 26.5.1
16+
hooks:
17+
- id: black-jupyter
18+
19+
- repo: https://github.com/codespell-project/codespell
20+
rev: v2.4.2
21+
hooks:
22+
- id: codespell
23+
args:
24+
[
25+
"--ignore-words-list=aci,acount,acounts,fallow,ges,hart,hist,nd,ned,ois,wqs,watermask,tre,mape",
26+
"--skip=*.csv,*.geojson,*.json,*.yml,*.min.js,*.bundle.js,*.html,*cff,*.pdf",
27+
]
28+
29+
- repo: https://github.com/kynan/nbstripout
30+
rev: 0.9.1
31+
hooks:
32+
- id: nbstripout

Dockerfile

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Build stage
2+
FROM node:26-alpine AS builder
3+
4+
WORKDIR /app
5+
6+
# Copy package files
7+
COPY package*.json ./
8+
9+
# Install dependencies
10+
RUN npm ci
11+
12+
# Copy source files
13+
COPY . .
14+
15+
# Run tests
16+
RUN npm test
17+
18+
# Build library and examples
19+
RUN npm run build && npm run build:examples
20+
21+
# Production stage
22+
FROM nginx:alpine
23+
24+
# Copy built examples to nginx (served under /geolibre-plugin-template/ to match Vite base path)
25+
COPY --from=builder /app/dist-examples /usr/share/nginx/html/geolibre-plugin-template
26+
27+
# Copy custom nginx config
28+
RUN echo 'server { \
29+
listen 80; \
30+
server_name localhost; \
31+
root /usr/share/nginx/html; \
32+
index index.html; \
33+
\
34+
location /geolibre-plugin-template/ { \
35+
try_files $uri $uri/ /geolibre-plugin-template/index.html; \
36+
} \
37+
\
38+
location = / { \
39+
return 302 /geolibre-plugin-template/; \
40+
} \
41+
}' > /etc/nginx/conf.d/default.conf
42+
43+
EXPOSE 80
44+
45+
# Startup script that prints URL and starts nginx
46+
RUN printf '#!/bin/sh\n\
47+
echo ""\n\
48+
echo "======================================================"\n\
49+
echo " MapLibre GL Plugin Template Examples"\n\
50+
echo "======================================================"\n\
51+
echo ""\n\
52+
echo " Server running on port 80"\n\
53+
echo ""\n\
54+
echo " If you ran: docker run -p 8080:80 ..."\n\
55+
echo " Open: http://localhost:8080/geolibre-plugin-template/"\n\
56+
echo ""\n\
57+
echo "======================================================"\n\
58+
echo ""\n\
59+
exec nginx -g "daemon off;"\n' > /start.sh && chmod +x /start.sh
60+
61+
CMD ["/start.sh"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Qiusheng Wu
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)