@wollemia/remote-metadata
v0.1.6
Published
Read‑only snapshot of Cavuno's country and timezone metadata, exported as a single JSON file for use in any language (TS/JS, Python, Ruby, etc.).
Readme
@wollemia/remote-metadata
Read‑only snapshot of Cavuno's country and timezone metadata, exported as a single JSON file for use in any language (TS/JS, Python, Ruby, etc.).
What this package provides
The published npm package contains one file at the top level:
remote-data.json– a JSON object with the following top‑level keys:countriesworldRegionToAlpha2continentToAlpha2regionToAlpha2subregionToAlpha2timezoneOffsetsoffsetToCountriescountryNameToAlpha2timezoneLabelsallowedShortTagstimezoneLabelToOffsetHourstimezoneLabelToAbbreviationworldRegionCopyworldRegionToTzalpha2ToWorldRegion
You can validate this JSON with the schema in:
packages/data/remote-metadata/remote-data.schema.json
The shape of these values matches the exports from @kit/data-remote.
How it is generated
Inside this monorepo, the JSON is generated by:
- Script:
packages/data/remote-metadata/scripts/export-json.ts - Command (from repo root):
pnpm --filter @wollemia/remote-metadata run build
This script imports from @kit/data-remote, builds the aggregate payload, and writes remote-data.json.
CI publishing
GitHub Actions workflow: .github/workflows/publish-remote-metadata.yml
- Triggers:
- Manual:
workflow_dispatch - Tag push:
remote-metadata-v*
- Manual:
- Steps:
- Install deps with
pnpm install - Build JSON with
pnpm --filter @wollemia/remote-metadata run build - Publish with
npm publish --access publicfrompackages/data/remote-metadata
- Install deps with
Consuming from other repositories
TypeScript / JavaScript
If you depend on the published package directly:
import data from '@wollemia/remote-metadata/remote-data.json' assert { type: 'json' };
const countries = data.countries;Python
import json
import requests
VERSION = "0.1.0"
url = f"https://unpkg.com/@wollemia/remote-metadata@{VERSION}/remote-data.json"
resp = requests.get(url, timeout=5)
resp.raise_for_status()
data = resp.json()
countries = data["countries"]Ruby
require "net/http"
require "json"
VERSION = "0.1.0"
url = URI("https://unpkg.com/@wollemia/remote-metadata@#{VERSION}/remote-data.json")
res = Net::HTTP.get_response(url)
data = JSON.parse(res.body)
COUNTRIES = data["countries"].freezeUpdate cadence
Publish a new version when:
@kit/data-remotelogic changes, or- Its underlying data sources (
world-countries,@vvo/tzdb) are updated and you want those changes reflected downstream.
