@wollemia/remote-metadata 0.1.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 +98 -0
- package/package.json +21 -0
- package/remote-data.json +31377 -0
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# @wollemia/remote-metadata
|
|
2
|
+
|
|
3
|
+
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.).
|
|
4
|
+
|
|
5
|
+
## What this package provides
|
|
6
|
+
|
|
7
|
+
The published npm package contains one file at the top level:
|
|
8
|
+
|
|
9
|
+
- `remote-data.json` – a JSON object with the following top‑level keys:
|
|
10
|
+
- `countries`
|
|
11
|
+
- `worldRegionToAlpha2`
|
|
12
|
+
- `continentToAlpha2`
|
|
13
|
+
- `regionToAlpha2`
|
|
14
|
+
- `subregionToAlpha2`
|
|
15
|
+
- `timezoneOffsets`
|
|
16
|
+
- `offsetToCountries`
|
|
17
|
+
- `countryNameToAlpha2`
|
|
18
|
+
- `timezoneLabels`
|
|
19
|
+
- `allowedShortTags`
|
|
20
|
+
- `friendlyTimezoneMapping`
|
|
21
|
+
- `friendlyTimezoneShortMapping`
|
|
22
|
+
- `worldRegionCopy`
|
|
23
|
+
- `worldRegionToTz`
|
|
24
|
+
- `alpha2ToWorldRegion`
|
|
25
|
+
|
|
26
|
+
The shape of these values matches the exports from `@kit/data-remote`.
|
|
27
|
+
|
|
28
|
+
## How it is generated
|
|
29
|
+
|
|
30
|
+
Inside this monorepo, the JSON is generated by:
|
|
31
|
+
|
|
32
|
+
- Script: `packages/data/remote-metadata/scripts/export-json.ts`
|
|
33
|
+
- Command (from repo root):
|
|
34
|
+
`pnpm --filter @wollemia/remote-metadata run build`
|
|
35
|
+
|
|
36
|
+
This script imports from `@kit/data-remote`, builds the aggregate payload, and writes `remote-data.json`.
|
|
37
|
+
|
|
38
|
+
## CI publishing
|
|
39
|
+
|
|
40
|
+
GitHub Actions workflow: `.github/workflows/publish-remote-metadata.yml`
|
|
41
|
+
|
|
42
|
+
- Triggers:
|
|
43
|
+
- Manual: `workflow_dispatch`
|
|
44
|
+
- Tag push: `remote-metadata-v*`
|
|
45
|
+
- Steps:
|
|
46
|
+
- Install deps with `pnpm install`
|
|
47
|
+
- Build JSON with `pnpm --filter @wollemia/remote-metadata run build`
|
|
48
|
+
- Publish with `npm publish --access public` from `packages/data/remote-metadata`
|
|
49
|
+
|
|
50
|
+
## Consuming from other repositories
|
|
51
|
+
|
|
52
|
+
### TypeScript / JavaScript
|
|
53
|
+
|
|
54
|
+
If you depend on the published package directly:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import data from '@wollemia/remote-metadata/remote-data.json' assert { type: 'json' };
|
|
58
|
+
|
|
59
|
+
const countries = data.countries;
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Python
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
import json
|
|
66
|
+
import requests
|
|
67
|
+
|
|
68
|
+
VERSION = "0.1.0"
|
|
69
|
+
url = f"https://unpkg.com/@wollemia/remote-metadata@{VERSION}/remote-data.json"
|
|
70
|
+
|
|
71
|
+
resp = requests.get(url, timeout=5)
|
|
72
|
+
resp.raise_for_status()
|
|
73
|
+
data = resp.json()
|
|
74
|
+
|
|
75
|
+
countries = data["countries"]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Ruby
|
|
79
|
+
|
|
80
|
+
```ruby
|
|
81
|
+
require "net/http"
|
|
82
|
+
require "json"
|
|
83
|
+
|
|
84
|
+
VERSION = "0.1.0"
|
|
85
|
+
url = URI("https://unpkg.com/@wollemia/remote-metadata@#{VERSION}/remote-data.json")
|
|
86
|
+
|
|
87
|
+
res = Net::HTTP.get_response(url)
|
|
88
|
+
data = JSON.parse(res.body)
|
|
89
|
+
|
|
90
|
+
COUNTRIES = data["countries"].freeze
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Update cadence
|
|
94
|
+
|
|
95
|
+
Publish a new version when:
|
|
96
|
+
|
|
97
|
+
- `@kit/data-remote` logic changes, or
|
|
98
|
+
- Its underlying data sources (`world-countries`, `@vvo/tzdb`) are updated and you want those changes reflected downstream.
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wollemia/remote-metadata",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "tsx scripts/export-json.ts"
|
|
7
|
+
},
|
|
8
|
+
"main": "remote-data.json",
|
|
9
|
+
"files": [
|
|
10
|
+
"remote-data.json"
|
|
11
|
+
],
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@kit/data-remote": "workspace:*"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@kit/tsconfig": "workspace:*"
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
}
|
|
21
|
+
}
|