airport-data-js 3.0.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -6
- package/dist/airport-data.min.js +1 -2
- package/lib/index.js +1 -1
- package/lib/tools.js +1 -0
- package/package.json +53 -23
- package/types/index.d.ts +514 -0
- package/types/tools.d.ts +50 -0
- package/dist/airport-data.min.js.LICENSE.txt +0 -1
package/README.md
CHANGED
|
@@ -32,18 +32,19 @@ Each airport object contains the following fields:
|
|
|
32
32
|
{
|
|
33
33
|
iata: "SIN", // 3-letter IATA code
|
|
34
34
|
icao: "WSSS", // 4-letter ICAO code
|
|
35
|
-
time: "Asia/Singapore", //
|
|
35
|
+
time: "Asia/Singapore", // IANA timezone identifier
|
|
36
|
+
utc: 8, // UTC offset in hours (DST-aware snapshot, not a fixed standard offset)
|
|
36
37
|
country_code: "SG", // 2-letter country code
|
|
37
38
|
continent: "AS", // 2-letter continent code (AS, EU, NA, SA, AF, OC, AN)
|
|
38
39
|
airport: "Singapore Changi Airport", // Airport name
|
|
39
|
-
latitude:
|
|
40
|
-
longitude:
|
|
41
|
-
|
|
40
|
+
latitude: 1.35019, // Latitude in decimal degrees
|
|
41
|
+
longitude: 103.994003, // Longitude in decimal degrees
|
|
42
|
+
elevation_ft: 22, // Elevation in feet, or null when unknown
|
|
42
43
|
type: "large_airport", // Airport type
|
|
43
|
-
scheduled_service:
|
|
44
|
+
scheduled_service: "TRUE", // "TRUE" or "FALSE" (has scheduled commercial service)
|
|
44
45
|
wikipedia: "https://en.wikipedia.org/wiki/Singapore_Changi_Airport",
|
|
45
46
|
website: "https://www.changiairport.com",
|
|
46
|
-
runway_length:
|
|
47
|
+
runway_length: 13200, // Longest runway in feet, or null when unknown
|
|
47
48
|
flightradar24_url: "https://www.flightradar24.com/airport/SIN",
|
|
48
49
|
radarbox_url: "https://www.radarbox.com/airport/WSSS",
|
|
49
50
|
flightaware_url: "https://www.flightaware.com/live/airport/WSSS"
|
|
@@ -451,3 +452,109 @@ This project is licensed under the Creative Commons Attribution 4.0 Internationa
|
|
|
451
452
|
## Contributing
|
|
452
453
|
|
|
453
454
|
Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/aashishvanand/airport-data-js/issues).
|
|
455
|
+
|
|
456
|
+
### Getting Started
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
# Clone the repository
|
|
460
|
+
git clone https://github.com/aashishvanand/airport-data-js.git
|
|
461
|
+
cd airport-data-js
|
|
462
|
+
|
|
463
|
+
# Install dependencies
|
|
464
|
+
npm install
|
|
465
|
+
|
|
466
|
+
# Run the test suite
|
|
467
|
+
npm test
|
|
468
|
+
|
|
469
|
+
# Build both Node.js and browser bundles
|
|
470
|
+
npm run build
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### Project Structure
|
|
474
|
+
|
|
475
|
+
```
|
|
476
|
+
airport-data-js/
|
|
477
|
+
├── src/
|
|
478
|
+
│ ├── index.ts # Library source code
|
|
479
|
+
│ ├── tools.ts # LLM tool-definition exports
|
|
480
|
+
│ └── airports.data.json # Gzip+base64 airport dataset (generated)
|
|
481
|
+
├── .tsbuild/ # Intermediate tsc output (generated, not committed)
|
|
482
|
+
├── lib/ # Node.js CJS build output
|
|
483
|
+
├── dist/ # Browser build output
|
|
484
|
+
├── data/
|
|
485
|
+
│ ├── airports.csv # Raw source data
|
|
486
|
+
│ └── airports.json # Converted JSON (source of truth for compression)
|
|
487
|
+
├── scripts/
|
|
488
|
+
│ ├── csv_to_json.ts # Converts airports.csv to airports.json
|
|
489
|
+
│ ├── compress_json.ts # Gzips airports.json into src/airports.data.json
|
|
490
|
+
│ ├── check_duplicates.ts # Validates no duplicate IATA/ICAO codes
|
|
491
|
+
│ ├── extract_latest_changelog.ts # Extracts changelog for GitHub releases
|
|
492
|
+
│ └── benchmark.ts # Performance benchmarks
|
|
493
|
+
├── tests/
|
|
494
|
+
│ └── index.test.ts # Vitest test suite
|
|
495
|
+
├── webpack.node.cjs # Webpack config for Node.js bundle
|
|
496
|
+
├── webpack.browser.cjs # Webpack config for browser bundle
|
|
497
|
+
└── webpack.tools.cjs # Webpack config for the tools bundle
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
Scripts are plain TypeScript run directly via [`tsx`](https://github.com/privatenumber/tsx) (no separate compile step needed for dev tooling).
|
|
501
|
+
|
|
502
|
+
### Available Scripts
|
|
503
|
+
|
|
504
|
+
| Command | Description |
|
|
505
|
+
|---------|-------------|
|
|
506
|
+
| `npm test` | Run the Vitest test suite |
|
|
507
|
+
| `npm run build` | Build declarations, transpile, then bundle Node.js (`lib/`) and browser (`dist/`) output |
|
|
508
|
+
| `npm run build:lib` | Build only the Node.js bundle |
|
|
509
|
+
| `npm run build:dist` | Build only the browser bundle |
|
|
510
|
+
| `npm run check:duplicates` | Validate the dataset: duplicate IATA/ICAO codes, coordinate ranges, continent/type enums, country code format, `scheduled_service`/`utc` types, plus a data-completeness report |
|
|
511
|
+
| `npm run generate:json` | Regenerate `data/airports.json` from `data/airports.csv` |
|
|
512
|
+
| `npm run generate:compressed` | Regenerate `src/airports.data.json` from `data/airports.json` |
|
|
513
|
+
| `npm run benchmark` | Run performance benchmarks against the built browser bundle |
|
|
514
|
+
|
|
515
|
+
### Development Workflow
|
|
516
|
+
|
|
517
|
+
1. **Create a branch** from `main` for your changes
|
|
518
|
+
2. **Make your changes** in `src/index.ts` or `data/airports.json`
|
|
519
|
+
3. **Add or update tests** in `tests/index.test.ts`
|
|
520
|
+
4. **Run tests** to make sure everything passes: `npm test`
|
|
521
|
+
5. **Build** to verify the bundles compile: `npm run build`
|
|
522
|
+
6. **Submit a pull request** against `main`
|
|
523
|
+
|
|
524
|
+
### Updating Airport Data
|
|
525
|
+
|
|
526
|
+
If you are adding or updating airport entries:
|
|
527
|
+
|
|
528
|
+
1. Edit `data/airports.json` directly
|
|
529
|
+
2. Run `npm run generate:compressed` to regenerate `src/airports.data.json`
|
|
530
|
+
3. Run `npm run check:duplicates` to validate the dataset (it reads the compressed file)
|
|
531
|
+
4. Run `npm test` to verify the changes
|
|
532
|
+
5. Submit a pull request with both the JSON and generated data changes
|
|
533
|
+
|
|
534
|
+
## Publishing a New Version
|
|
535
|
+
|
|
536
|
+
Releases are automated via the [release workflow](.github/workflows/release.yml). To publish a new version:
|
|
537
|
+
|
|
538
|
+
1. **Update the version** in `package.json` (follow [Semantic Versioning](https://semver.org/))
|
|
539
|
+
2. **Update `CHANGELOG.md`** with a new section for the version (follow [Keep a Changelog](https://keepachangelog.com/) format)
|
|
540
|
+
3. **Build and test locally** to confirm everything works:
|
|
541
|
+
```bash
|
|
542
|
+
npm run build && npm test
|
|
543
|
+
```
|
|
544
|
+
4. **Commit your changes** to `main`
|
|
545
|
+
5. **Push or merge to the `release` branch** -- this triggers the CI pipeline which will:
|
|
546
|
+
- Run tests across Node.js 22.x and 24.x
|
|
547
|
+
- Run a security audit (`npm audit --audit-level=critical`)
|
|
548
|
+
- Check for duplicate airport codes
|
|
549
|
+
- Build the package
|
|
550
|
+
- Compare the version in `package.json` against the published npm version
|
|
551
|
+
- **Publish to npm** with provenance (if the version is new)
|
|
552
|
+
- **Create a GitHub Release** with notes extracted from `CHANGELOG.md`
|
|
553
|
+
|
|
554
|
+
The workflow can also be triggered manually via `workflow_dispatch` from the Actions tab.
|
|
555
|
+
|
|
556
|
+
### Version Policy
|
|
557
|
+
|
|
558
|
+
- **Patch** (e.g., 3.0.1 -> 3.0.2): Data updates, bug fixes, performance improvements, dependency bumps
|
|
559
|
+
- **Minor** (e.g., 3.0.x -> 3.1.0): New functions or non-breaking feature additions
|
|
560
|
+
- **Major** (e.g., 3.x.x -> 4.0.0): Breaking API changes or data format changes
|