airline-codes 1.1.4 → 1.1.6

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.
@@ -0,0 +1 @@
1
+ 2026-09-08T01:07:56Z
@@ -3,6 +3,9 @@ name: Publish to npm
3
3
  on:
4
4
  push:
5
5
  branches: [master]
6
+ paths-ignore:
7
+ - '.github/**'
8
+ - '*.md'
6
9
  workflow_dispatch:
7
10
 
8
11
  jobs:
@@ -14,9 +17,9 @@ jobs:
14
17
  - uses: actions/checkout@v4
15
18
  - uses: actions/setup-node@v4
16
19
  with:
17
- node-version: '20'
20
+ node-version: '22'
18
21
  registry-url: 'https://registry.npmjs.org'
19
- - run: npm install -g npm@latest
22
+ - run: npm install -g npm@11
20
23
  - run: npm install
21
24
  - name: Publish if version not already published
22
25
  run: |
@@ -14,7 +14,7 @@ jobs:
14
14
  - uses: actions/checkout@v4
15
15
  - uses: actions/setup-node@v4
16
16
  with:
17
- node-version: '20'
17
+ node-version: '22'
18
18
  registry-url: 'https://registry.npmjs.org'
19
19
  - run: npm ci
20
20
  - name: Fetch latest airlines.dat from OpenFlights
@@ -28,10 +28,27 @@ jobs:
28
28
  git config user.name "github-actions[bot]"
29
29
  git config user.email "github-actions[bot]@users.noreply.github.com"
30
30
  if git diff --quiet airlines.dat airlines.json; then
31
- echo "No data changes, skipping."
31
+ echo "No data changes."
32
+ # GitHub automatically disables scheduled workflows if there are no repository commits for 60 days.
33
+ # If no commits have been made in the last 40 days, create a keepalive commit to reset the timer.
34
+ LAST_COMMIT_TS=$(git log -1 --format=%ct)
35
+ NOW_TS=$(date +%s)
36
+ DAYS_SINCE=$(( (NOW_TS - LAST_COMMIT_TS) / 86400 ))
37
+ echo "Days since last commit: $DAYS_SINCE"
38
+ if [ "$DAYS_SINCE" -ge 40 ]; then
39
+ echo "Repository inactive for $DAYS_SINCE days (>= 40 days); creating keepalive commit to prevent workflow disable."
40
+ date -u +"%Y-%m-%dT%H:%M:%SZ" > .github/.keepalive
41
+ git add .github/.keepalive
42
+ if ! git diff --staged --quiet; then
43
+ git commit -m "chore(keepalive): touch .github/.keepalive [skip ci]"
44
+ git pull --rebase origin master
45
+ git push origin master
46
+ fi
47
+ fi
32
48
  else
33
49
  npm version patch --no-git-tag-version
34
50
  git add airlines.dat airlines.json package.json package-lock.json
35
51
  git commit -m "chore: update airline data from OpenFlights"
52
+ git pull --rebase origin master
36
53
  git push origin master
37
54
  fi
package/AGENTS.md ADDED
@@ -0,0 +1,26 @@
1
+ # AGENTS.md — guidance for AI coding agents
2
+
3
+ ## How data corrections work
4
+
5
+ `airlines.dat` and `airlines.json` are **generated files**. Do not edit them directly.
6
+
7
+ - `airlines.dat` is fetched weekly from [jpatokal/openflights](https://github.com/jpatokal/openflights/blob/master/data/airlines.dat).
8
+ - `airlines.json` is regenerated from `airlines.dat` by running `node convert.js`.
9
+ - `normalize.js` applies local corrections **after** every upstream fetch, before `convert.js` runs.
10
+
11
+ ## How to add a correction
12
+
13
+ 1. Open `normalize.js`.
14
+ 2. For a country name fix, add an entry to `COUNTRY_CORRECTIONS`.
15
+ 3. For any other field fix (name, IATA, ICAO, callsign, active status, etc.), add an entry to `ID_CORRECTIONS` keyed by the airline's numeric ID (as a string). Include a comment explaining the reason.
16
+ 4. Regenerate both data files:
17
+ ```
18
+ node normalize.js # patches airlines.dat in-place
19
+ node convert.js # regenerates airlines.json
20
+ ```
21
+ 5. Verify the corrected entry appears correctly in `airlines.json`.
22
+ 6. Commit `normalize.js`, `airlines.dat`, and `airlines.json` together.
23
+
24
+ ## Verifying issues
25
+
26
+ Before implementing a reported data correction, verify the claim against at least one authoritative source (e.g. [airhex.com](https://airhex.com), [IATA code search](https://www.iata.org/en/publications/directories/code-search/), or [avcodes.co.uk](https://www.avcodes.co.uk/airlcodesearch.asp)).