Skip to content

Commit 057a640

Browse files
kochizufanclaude
andcommitted
feat: initial implementation of @c4h/beatbox
- Mapbox scheme URL parser and MVT configuration translator - Convert mapbox:// URLs to HTTP endpoints - Parse and translate style configurations - Extract resource URLs from styles - Comprehensive test suite - CI/CD with GitHub Actions - Full TypeScript support with type definitions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a444c47 commit 057a640

28 files changed

+5358
-130
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Bug Report
2+
description: Create a report to help us improve
3+
title: "[Bug]: "
4+
labels: ["bug", "triage"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to fill out this bug report!
10+
11+
- type: textarea
12+
id: description
13+
attributes:
14+
label: Bug Description
15+
description: A clear and concise description of what the bug is.
16+
placeholder: When I try to convert a mapbox URL...
17+
validations:
18+
required: true
19+
20+
- type: textarea
21+
id: reproduction
22+
attributes:
23+
label: Steps to Reproduce
24+
description: Steps to reproduce the behavior
25+
placeholder: |
26+
1. Create a BeatBox instance with...
27+
2. Call toHttpUrl with...
28+
3. See error
29+
validations:
30+
required: true
31+
32+
- type: textarea
33+
id: expected
34+
attributes:
35+
label: Expected Behavior
36+
description: A clear and concise description of what you expected to happen.
37+
validations:
38+
required: true
39+
40+
- type: textarea
41+
id: actual
42+
attributes:
43+
label: Actual Behavior
44+
description: What actually happened instead.
45+
validations:
46+
required: true
47+
48+
- type: textarea
49+
id: code-sample
50+
attributes:
51+
label: Code Sample
52+
description: If applicable, add a minimal code example to help reproduce the problem.
53+
render: typescript
54+
placeholder: |
55+
import { BeatBox } from '@c4h/beatbox';
56+
57+
const beatbox = new BeatBox({ accessToken: 'token' });
58+
const result = beatbox.toHttpUrl('mapbox://...');
59+
60+
- type: dropdown
61+
id: environment
62+
attributes:
63+
label: Environment
64+
description: Where are you running the code?
65+
options:
66+
- Node.js
67+
- Browser (Chrome)
68+
- Browser (Firefox)
69+
- Browser (Safari)
70+
- Browser (Edge)
71+
- Other
72+
validations:
73+
required: true
74+
75+
- type: input
76+
id: version
77+
attributes:
78+
label: BeatBox Version
79+
description: What version of @c4h/beatbox are you using?
80+
placeholder: 0.1.0
81+
validations:
82+
required: true
83+
84+
- type: input
85+
id: node-version
86+
attributes:
87+
label: Node.js Version (if applicable)
88+
description: What version of Node.js are you using?
89+
placeholder: 20.x
90+
91+
- type: textarea
92+
id: additional
93+
attributes:
94+
label: Additional Context
95+
description: Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: Ask a Question
4+
url: https://github.com/code4history/BeatBox/discussions/new?category=q-a
5+
about: Ask questions and discuss with other community members
6+
- name: Code for History Website
7+
url: https://code4history.dev/
8+
about: Visit our website for more information about our projects
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Feature Request
2+
description: Suggest an idea for this project
3+
title: "[Feature]: "
4+
labels: ["enhancement"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for suggesting a new feature!
10+
11+
- type: textarea
12+
id: problem
13+
attributes:
14+
label: Is your feature request related to a problem?
15+
description: A clear and concise description of what the problem is.
16+
placeholder: I'm always frustrated when...
17+
18+
- type: textarea
19+
id: solution
20+
attributes:
21+
label: Describe the solution you'd like
22+
description: A clear and concise description of what you want to happen.
23+
validations:
24+
required: true
25+
26+
- type: textarea
27+
id: alternatives
28+
attributes:
29+
label: Describe alternatives you've considered
30+
description: A clear and concise description of any alternative solutions or features you've considered.
31+
32+
- type: textarea
33+
id: example
34+
attributes:
35+
label: Example Usage
36+
description: Show how this feature would be used in code.
37+
render: typescript
38+
placeholder: |
39+
import { BeatBox } from '@c4h/beatbox';
40+
41+
const beatbox = new BeatBox();
42+
// Your proposed API usage here
43+
44+
- type: textarea
45+
id: additional
46+
attributes:
47+
label: Additional Context
48+
description: Add any other context or screenshots about the feature request here.

.github/dependabot.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for npm
4+
- package-ecosystem: "npm"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
time: "04:00"
10+
open-pull-requests-limit: 10
11+
groups:
12+
# Group all ESLint-related updates
13+
eslint:
14+
patterns:
15+
- "eslint*"
16+
- "@eslint/*"
17+
- "typescript-eslint"
18+
# Group all testing-related updates
19+
testing:
20+
patterns:
21+
- "vitest*"
22+
- "@vitest/*"
23+
- "@playwright/*"
24+
- "jsdom"
25+
# Group all build tool updates
26+
build-tools:
27+
patterns:
28+
- "vite*"
29+
- "typescript"
30+
- "cross-env"
31+
# Ignore major versions for certain packages
32+
ignore:
33+
- dependency-name: "typescript"
34+
update-types: ["version-update:semver-major"]
35+
- dependency-name: "vite"
36+
update-types: ["version-update:semver-major"]
37+
38+
# Enable version updates for GitHub Actions
39+
- package-ecosystem: "github-actions"
40+
directory: "/"
41+
schedule:
42+
interval: "weekly"
43+
day: "monday"
44+
time: "04:00"

.github/pull_request_template.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## Description
2+
<!-- Brief description of what this PR does -->
3+
4+
## Type of Change
5+
- [ ] Bug fix (non-breaking change which fixes an issue)
6+
- [ ] New feature (non-breaking change which adds functionality)
7+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
8+
- [ ] Documentation update
9+
- [ ] Performance improvement
10+
- [ ] Code refactoring
11+
12+
## Changes Made
13+
<!-- List the specific changes made in this PR -->
14+
-
15+
-
16+
-
17+
18+
## Testing
19+
<!-- Describe the tests you ran to verify your changes -->
20+
- [ ] All existing tests pass
21+
- [ ] Added new tests for the changes
22+
- [ ] Manually tested the following scenarios:
23+
-
24+
-
25+
26+
## Checklist
27+
- [ ] My code follows the style guidelines of this project
28+
- [ ] I have performed a self-review of my own code
29+
- [ ] I have added/updated documentation as needed
30+
- [ ] I have added tests that prove my fix is effective or that my feature works
31+
- [ ] New and existing unit tests pass locally with my changes
32+
- [ ] Any dependent changes have been merged and published
33+
34+
## Related Issues
35+
<!-- Link any related issues here -->
36+
Closes #
37+
38+
## Additional Context
39+
<!-- Add any other context or screenshots about the PR here -->

.github/workflows/ci.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
pull_request:
7+
branches: [ main, master, develop ]
8+
9+
jobs:
10+
test:
11+
name: Test on Node ${{ matrix.node-version }}
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: [18.x, 20.x, 22.x]
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Install pnpm
22+
uses: pnpm/action-setup@v4
23+
# Version is determined from packageManager field in package.json
24+
25+
- name: Setup Node.js ${{ matrix.node-version }}
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
cache: 'pnpm'
30+
31+
- name: Install dependencies
32+
run: pnpm install --frozen-lockfile
33+
34+
- name: Run linter
35+
run: pnpm run lint
36+
37+
- name: Run type check
38+
run: pnpm run typecheck
39+
40+
- name: Run tests
41+
run: pnpm test
42+
43+
- name: Run test coverage
44+
run: pnpm run coverage
45+
46+
- name: Build library
47+
run: pnpm run build
48+
49+
- name: Upload coverage reports
50+
if: matrix.node-version == '20.x'
51+
uses: codecov/codecov-action@v4
52+
with:
53+
file: ./coverage/lcov.info
54+
fail_ci_if_error: false
55+
56+
build-check:
57+
name: Build and Package Check
58+
runs-on: ubuntu-latest
59+
60+
steps:
61+
- name: Checkout code
62+
uses: actions/checkout@v4
63+
64+
- name: Install pnpm
65+
uses: pnpm/action-setup@v4
66+
67+
- name: Setup Node.js
68+
uses: actions/setup-node@v4
69+
with:
70+
node-version: 20.x
71+
cache: 'pnpm'
72+
73+
- name: Install dependencies
74+
run: pnpm install --frozen-lockfile
75+
76+
- name: Build
77+
run: pnpm run build
78+
79+
- name: Check build output
80+
run: |
81+
# Check if all expected files are generated
82+
test -f dist/beatbox.js
83+
test -f dist/beatbox.cjs
84+
test -f dist/beatbox.umd.js
85+
test -f dist/index.d.ts
86+
echo "✓ All build files generated successfully"
87+
88+
- name: Pack for npm
89+
run: pnpm pack
90+
91+
- name: Check package size
92+
run: |
93+
# Display package size
94+
ls -lh *.tgz
95+
# Check if package size is reasonable (< 1MB)
96+
size=$(stat -c%s *.tgz)
97+
if [ $size -gt 1048576 ]; then
98+
echo "⚠️ Warning: Package size is larger than 1MB"
99+
else
100+
echo "✓ Package size is reasonable"
101+
fi
102+
103+
- name: Upload build artifacts
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: build-output
107+
path: |
108+
dist/
109+
*.tgz
110+
retention-days: 7

.github/workflows/codeql.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
pull_request:
7+
branches: [ main, master, develop ]
8+
schedule:
9+
- cron: '30 5 * * 1'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [ 'javascript' ]
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@v3
31+
with:
32+
languages: ${{ matrix.language }}
33+
queries: security-extended,security-and-quality
34+
35+
- name: Autobuild
36+
uses: github/codeql-action/autobuild@v3
37+
38+
- name: Perform CodeQL Analysis
39+
uses: github/codeql-action/analyze@v3
40+
with:
41+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)