Skip to content

Commit c45eac2

Browse files
committed
v2.0.0
1 parent ff62337 commit c45eac2

File tree

7 files changed

+96
-42
lines changed

7 files changed

+96
-42
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ _Breaking changes, which may affect downstream projects, are marked with a_ ⚠
1616
[#xxx]: https://github.com/rapideditor/location-conflation/issues/xxx
1717
-->
1818

19+
# 2.0.0
20+
##### 2025-Nov-21
21+
* Switch the project code to TypeScript
22+
* ⚠️ While everything should backward compatible, generated files have moved:
23+
* `dist/js/*` - Built JavaScript files
24+
* `dist/ts/*` - Built TypeScript declaration file
25+
* Update all dependencies
26+
27+
1928
# 1.7.0
2029
##### 2025-Oct-21
2130
* This project uses [`bun`](https://bun.com/) now, for simpler developer tooling ([#71])

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ You can also use **location-conflation** directly in a web browser. A good way
6565
When you load this file in a `<script>` tag, you'll get a `LocationConflation` global to use elsewhere in your scripts:
6666
```html
6767
<head>
68-
<script src="https://cdn.jsdelivr.net/npm/@rapideditor/location-conflation@latest/dist/location-conflation.iife.min.js"></script>
68+
<script src="https://cdn.jsdelivr.net/npm/@rapideditor/location-conflation@latest/dist/js/location-conflation.iife.min.js"></script>
6969
</head>
7070
7171
<script>

RELEASE.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,3 @@ Set as latest release on GitHub:
2525
- Open https://github.com/rapideditor/location-conflation/tags and pick the new tag you just pushed
2626
- There should be a link like "create a release from the tag", click that, and paste in the link to the changelog.
2727

28-
29-
### Purge JSDelivr CDN cache
30-
Include any URLs that anyone might request.
31-
32-
```bash
33-
curl 'https://purge.jsdelivr.net/npm/@rapideditor/location-conflation@latest/dist/location-conflation.iife.js'
34-
curl 'https://purge.jsdelivr.net/npm/@rapideditor/location-conflation@latest/dist/location-conflation.iife.min.js'
35-
curl 'https://purge.jsdelivr.net/npm/@rapideditor/location-conflation@1/dist/location-conflation.iife.js'
36-
curl 'https://purge.jsdelivr.net/npm/@rapideditor/location-conflation@1/dist/location-conflation.iife.min.js'
37-
```

bun.lock

Lines changed: 24 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ <h3>Try these!</h3>
199199
if (qs.referrer === 'oci') {
200200
_fcPromise = fetch('https://cdn.jsdelivr.net/npm/osmlab/osm-community-index@latest/dist/json/featureCollection.min.json');
201201
} else if (qs.referrer === 'nsi') {
202-
_fcPromise = fetch('https://cdn.jsdelivr.net/gh/osmlab/name-suggestion-index@main/dist/featureCollection.min.json');
202+
_fcPromise = fetch('https://cdn.jsdelivr.net/npm/osmlab/name-suggestion-index@latest/dist/json/featureCollection.min.json');
203203
} else if (qs.referrer === 'ii') {
204204
_fcPromise = fetch('https://cdn.jsdelivr.net/gh/rapideditor/imagery-index@main/dist/featureCollection.min.json');
205205
} else {

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rapideditor/location-conflation",
3-
"version": "1.7.0",
3+
"version": "2.0.0",
44
"license": "ISC",
55
"repository": "github:rapideditor/location-conflation",
66
"description": "Define complex geographic regions by including and excluding country codes and geojson shapes",
@@ -35,6 +35,7 @@
3535
"build:ts": "tsc --project tsconfig.declarations.json",
3636
"clean": "bun ./scripts/clean.ts",
3737
"lint": "eslint ./scripts ./src ./test",
38+
"postpublish": "bun ./scripts/postpublish.ts",
3839
"start": "bun ./scripts/server.ts",
3940
"test": "bun test --dots --coverage ./test"
4041
},
@@ -47,14 +48,14 @@
4748
"polyclip-ts": "~0.16.8"
4849
},
4950
"devDependencies": {
50-
"@eslint/js": "^9.38.0",
51-
"@types/bun": "^1.3.1",
51+
"@eslint/js": "^9.39.1",
52+
"@types/bun": "^1.3.2",
5253
"@types/geojson": "^7946.0.16",
53-
"eslint": "^9.38.0",
54-
"globals": "^16.4.0",
54+
"eslint": "^9.39.1",
55+
"globals": "^16.5.0",
5556
"npm-run-all2": "^8.0.4",
5657
"typescript": "^5.9.3",
57-
"typescript-eslint": "^8.46.2"
58+
"typescript-eslint": "^8.47.0"
5859
},
5960
"publishConfig": {
6061
"access": "public"

scripts/postpublish.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { Glob } from 'bun';
2+
import { styleText } from 'node:util';
3+
4+
const CDNRoot = 'https://purge.jsdelivr.net/npm/@rapideditor/location-conflation';
5+
const packageJSON = await Bun.file('./package.json').json();
6+
7+
// Gather versions that need cache invalidation
8+
const versions = ['@latest'];
9+
const match = packageJSON.version.match(/^(\d+)\.(\d+)/);
10+
if (match[1]) {
11+
versions.push(`@${match[1]}`); // major
12+
if (match[2]) {
13+
versions.push(`@${match[1]}.${match[2]}`); // minor
14+
}
15+
}
16+
17+
18+
postpublish();
19+
20+
async function postpublish() {
21+
const START = '🏗 ' + styleText('yellow', 'Running postpublish…');
22+
const END = '👍 ' + styleText('green', 'postpublish done');
23+
24+
console.log('');
25+
console.log(START);
26+
27+
console.log(styleText('blueBright', 'Pausing 10 seconds…'));
28+
await Bun.sleep(10000);
29+
30+
// Purge the JSDelivr CDN caches.
31+
// https://www.jsdelivr.com/documentation#id-purge-cache
32+
console.log('');
33+
console.log(styleText('blueBright', 'Purging JSDelivr caches…'));
34+
35+
const promises = [];
36+
const glob = new Glob('./dist/**/*');
37+
for (const filepath of glob.scanSync()) {
38+
// Keep just the end part of the path without extension, e.g. `dist/json/file.json`
39+
const path = filepath.replace(/(.*)(\/dist.*)/i, '$2');
40+
41+
for (const version of versions) {
42+
const url = `${CDNRoot}${version}${path}`;
43+
const promise = fetch(url)
44+
.then(response => response.json())
45+
.then(json => console.log(styleText('greenBright', `'${url}' → ${json.status}`)))
46+
.catch(err => console.log(styleText('redBright', `'${url}' → ${err}`)));
47+
48+
promises.push(promise);
49+
}
50+
}
51+
52+
await Promise.all(promises);
53+
console.log(END);
54+
}

0 commit comments

Comments
 (0)