airport-data-js 3.1.0 → 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 +35 -24
- package/dist/airport-data.min.js +1 -1
- package/lib/index.js +1 -1
- package/lib/tools.js +1 -1
- package/package.json +34 -25
- package/types/index.d.ts +15 -18
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"
|
|
@@ -474,38 +475,48 @@ npm run build
|
|
|
474
475
|
```
|
|
475
476
|
airport-data-js/
|
|
476
477
|
├── src/
|
|
477
|
-
│ ├── index.
|
|
478
|
-
│
|
|
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)
|
|
479
482
|
├── lib/ # Node.js CJS build output
|
|
480
483
|
├── dist/ # Browser build output
|
|
481
484
|
├── data/
|
|
482
|
-
│
|
|
485
|
+
│ ├── airports.csv # Raw source data
|
|
486
|
+
│ └── airports.json # Converted JSON (source of truth for compression)
|
|
483
487
|
├── scripts/
|
|
484
|
-
│ ├──
|
|
485
|
-
│ ├──
|
|
486
|
-
│ ├──
|
|
487
|
-
│
|
|
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
|
|
488
493
|
├── tests/
|
|
489
|
-
│ └── index.test.
|
|
494
|
+
│ └── index.test.ts # Vitest test suite
|
|
490
495
|
├── webpack.node.cjs # Webpack config for Node.js bundle
|
|
491
|
-
|
|
496
|
+
├── webpack.browser.cjs # Webpack config for browser bundle
|
|
497
|
+
└── webpack.tools.cjs # Webpack config for the tools bundle
|
|
492
498
|
```
|
|
493
499
|
|
|
500
|
+
Scripts are plain TypeScript run directly via [`tsx`](https://github.com/privatenumber/tsx) (no separate compile step needed for dev tooling).
|
|
501
|
+
|
|
494
502
|
### Available Scripts
|
|
495
503
|
|
|
496
504
|
| Command | Description |
|
|
497
505
|
|---------|-------------|
|
|
498
|
-
| `npm test` | Run the
|
|
499
|
-
| `npm run build` | Build
|
|
506
|
+
| `npm test` | Run the Vitest test suite |
|
|
507
|
+
| `npm run build` | Build declarations, transpile, then bundle Node.js (`lib/`) and browser (`dist/`) output |
|
|
500
508
|
| `npm run build:lib` | Build only the Node.js bundle |
|
|
501
509
|
| `npm run build:dist` | Build only the browser bundle |
|
|
502
|
-
| `npm run check:duplicates` |
|
|
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 |
|
|
503
514
|
|
|
504
515
|
### Development Workflow
|
|
505
516
|
|
|
506
517
|
1. **Create a branch** from `main` for your changes
|
|
507
|
-
2. **Make your changes** in `src/index.
|
|
508
|
-
3. **Add or update tests** in `tests/index.test.
|
|
518
|
+
2. **Make your changes** in `src/index.ts` or `data/airports.json`
|
|
519
|
+
3. **Add or update tests** in `tests/index.test.ts`
|
|
509
520
|
4. **Run tests** to make sure everything passes: `npm test`
|
|
510
521
|
5. **Build** to verify the bundles compile: `npm run build`
|
|
511
522
|
6. **Submit a pull request** against `main`
|
|
@@ -515,10 +526,10 @@ airport-data-js/
|
|
|
515
526
|
If you are adding or updating airport entries:
|
|
516
527
|
|
|
517
528
|
1. Edit `data/airports.json` directly
|
|
518
|
-
2. Run `npm run
|
|
519
|
-
3. Run `
|
|
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)
|
|
520
531
|
4. Run `npm test` to verify the changes
|
|
521
|
-
5. Submit a pull request with both the JSON and
|
|
532
|
+
5. Submit a pull request with both the JSON and generated data changes
|
|
522
533
|
|
|
523
534
|
## Publishing a New Version
|
|
524
535
|
|
|
@@ -532,7 +543,7 @@ Releases are automated via the [release workflow](.github/workflows/release.yml)
|
|
|
532
543
|
```
|
|
533
544
|
4. **Commit your changes** to `main`
|
|
534
545
|
5. **Push or merge to the `release` branch** -- this triggers the CI pipeline which will:
|
|
535
|
-
- Run tests across Node.js
|
|
546
|
+
- Run tests across Node.js 22.x and 24.x
|
|
536
547
|
- Run a security audit (`npm audit --audit-level=critical`)
|
|
537
548
|
- Check for duplicate airport codes
|
|
538
549
|
- Build the package
|