Skip to content

Commit a0dec33

Browse files
committed
feat: Add GitHub Pages showcase with interactive demo
- Create comprehensive interactive demo at docs/index.html - Add GitHub Actions workflow for automatic Pages deployment - Include all library features: validation, generation, bulk processing - Support for 11+ shipping carriers with live examples - Beautiful responsive UI with Tailwind CSS - Copy built dist files to docs/ for GitHub Pages serving
1 parent 531cc9c commit a0dec33

File tree

5 files changed

+118
-8
lines changed

5 files changed

+118
-8
lines changed

.github/workflows/build.js.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,25 @@ name: Node.js CI
55

66
on:
77
push:
8-
branches: [master]
8+
branches: [master, main, v3]
99
pull_request:
10-
branches: [master]
10+
branches: [master, main, v3]
1111

1212
jobs:
13-
build:
13+
test:
1414
runs-on: ubuntu-latest
1515

1616
strategy:
1717
matrix:
18-
node-version: [14.x]
18+
node-version: [16.x, 18.x, 20.x]
1919

2020
steps:
21-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v4
2222
- name: Use Node.js ${{ matrix.node-version }}
23-
uses: actions/setup-node@v2
23+
uses: actions/setup-node@v4
2424
with:
2525
node-version: ${{ matrix.node-version }}
26+
cache: 'npm'
2627
- run: npm ci
2728
- run: npm run build --if-present
2829
- run: npm test

.github/workflows/deploy-pages.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# GitHub Pages Deployment Workflow
2+
name: Deploy to GitHub Pages
3+
4+
on:
5+
push:
6+
branches: [ v3, main, master ]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build-and-deploy:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '18'
30+
cache: 'npm'
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Build the library
36+
run: npm run build
37+
38+
- name: Copy dist files to docs
39+
run: cp -r dist docs/
40+
41+
- name: Setup Pages
42+
uses: actions/configure-pages@v4
43+
44+
- name: Upload artifact
45+
uses: actions/upload-pages-artifact@v3
46+
with:
47+
path: './docs'
48+
49+
- name: Deploy to GitHub Pages
50+
id: deployment
51+
uses: actions/deploy-pages@v4

_config.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
theme: jekyll-theme-minimal
1+
# GitHub Pages configuration
2+
# Use docs/ directory for GitHub Pages
3+
# The index.html in docs/ will be served as the main page
4+
5+
# Optional: If you want to use Jekyll theme for other pages
6+
# theme: jekyll-theme-minimal
7+
8+
# GitHub Pages will serve docs/index.html directly
9+
# No Jekyll processing needed for our HTML showcase

docs/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Tracking Number Validation - Interactive Demo
2+
3+
This directory contains the GitHub Pages showcase for the tracking-number-validation library.
4+
5+
## 🌐 Live Demo
6+
7+
Visit the live demo at: [https://niradler.github.io/tracking-number-validation/](https://niradler.github.io/tracking-number-validation/)
8+
9+
## 📁 Contents
10+
11+
- `index.html` - The main showcase page with interactive demos
12+
- `dist/` - Built library files (copied from the main build process)
13+
14+
## 🚀 Features Demonstrated
15+
16+
The interactive demo showcases all the library features:
17+
18+
1. **Basic Validation** - Test tracking numbers and see results
19+
2. **Courier Detection** - Automatically identify shipping carriers
20+
3. **URL Generation** - Get tracking URLs for validated numbers
21+
4. **Bulk Validation** - Validate multiple tracking numbers at once
22+
5. **Pattern Injection** - Add custom patterns to existing couriers
23+
6. **Number Generation** - Generate valid tracking numbers for testing
24+
25+
## 🔧 Local Development
26+
27+
To run this locally:
28+
29+
1. Build the library: `pnpm build`
30+
2. Copy dist files: `cp -r dist docs/`
31+
3. Serve the docs directory with any static file server
32+
33+
## 📦 Supported Carriers
34+
35+
The demo supports all 11+ carriers including:
36+
- UPS
37+
- FedEx
38+
- USPS
39+
- DHL
40+
- Amazon
41+
- OnTrac
42+
- Canada Post
43+
- China Post
44+
- Australia Post
45+
- Royal Mail
46+
- And more...
47+
48+
## 🛠 GitHub Pages Deployment
49+
50+
This site is automatically deployed to GitHub Pages via GitHub Actions whenever changes are pushed to the main branch.

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ <h3 class="text-2xl font-bold mb-4">Ready to Get Started?</h3>
525525
</footer>
526526

527527
<!-- Load the tracking validation library -->
528-
<script src="../dist/index.js"></script>
528+
<script src="./dist/index.js"></script>
529529

530530
<!-- Custom JavaScript for interactivity -->
531531
<script>

0 commit comments

Comments
 (0)