Skip to content

Commit fe3183c

Browse files
committed
Harden widget lifecycle and browser behavior
1 parent 9f01ee2 commit fe3183c

7 files changed

Lines changed: 1319 additions & 43 deletions

File tree

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
groups:
8+
development-dependencies:
9+
dependency-type: development
10+
11+
- package-ecosystem: github-actions
12+
directory: "/"
13+
schedule:
14+
interval: weekly

.github/workflows/test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 10
14+
steps:
15+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
16+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
17+
with:
18+
node-version: 22
19+
cache: npm
20+
- run: npm ci
21+
- run: npm test

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Get a free publishable API key at [vehiclesdb.com](https://vehiclesdb.com/settin
1414
<select id="make"></select>
1515
<select id="model"></select>
1616

17-
<script src="https://cdn.jsdelivr.net/npm/make-model-dropdown"></script>
17+
<script src="https://cdn.jsdelivr.net/npm/make-model-dropdown@0.1.4"></script>
1818
<script>
1919
VehiclesDropdown.attach({
2020
key: "vdb_pk_your_key",
@@ -85,7 +85,16 @@ The vehicle identity data is [CC-BY 4.0](https://vehiclesdb.com/attribution) —
8585

8686
## The API underneath
8787

88-
The widget speaks three documented endpoints — [`GET /api/v1/makes`](https://vehiclesdb.com/api), `GET /api/v1/makes/{slug}/models` and `GET /api/v1/search` — which cost 0 credits and accept publishable keys, so the dropdown never spends your quota. The same key unlocks the rest of the [VehiclesDB API](https://vehiclesdb.com/api): resolve free-text vehicle strings to canonical ids, full spec records, imagery, license plate validation.
88+
The widget speaks the documented Dropdown Data endpoints — [`GET /api/v1/makes`](https://vehiclesdb.com/api), `GET /api/v1/makes/{slug}/models`, `GET /api/v1/search`, and make logos — which cost 0 credits and accept publishable keys, so the dropdown never spends your quota. Public keys are deliberately refused everywhere else. Use a private `vdb_sk_…` key from your backend for the rest of the [VehiclesDB API](https://vehiclesdb.com/api): resolving free-text vehicle strings, full records, imagery, and license-plate validation.
89+
90+
## Development
91+
92+
```bash
93+
npm ci
94+
npm test
95+
```
96+
97+
The test suite runs the published UMD artifact in a real DOM implementation and covers dependent loading, credential-scoped caches, combobox keyboard/blur behavior, labels, callback isolation, and object-URL cleanup.
8998

9099
## License
91100

@@ -94,5 +103,5 @@ MIT for this library. Data: identity layer CC-BY 4.0, enrichment proprietary —
94103
## Releasing (maintainers)
95104

96105
1. Bump `version` in `package.json` AND the `version:` string in `make-model-dropdown.js`, keep them equal.
97-
2. Re-vendor the dist into the website so the live demo ships the same bytes npm does: `cp make-model-dropdown.js ../vehiclesdb-web/vendor/javascript/make-model-dropdown.js`. The website's system test drives the vendored copy against the real API, so a broken dist fails their CI.
106+
2. Re-vendor the dist into the website and verify the two files are byte-for-byte identical. The website's system test drives that copy against the real API, so a broken dist fails its CI.
98107
3. `npm publish` (owner ritual, like gem releases).

0 commit comments

Comments
 (0)