Skip to content

Commit

Permalink
Make aws/cloudflare depend on pmtiles from npm [#455] (#515)
Browse files Browse the repository at this point in the history
* Make aws/cloudflare depend on pmtiles from npm [#455]

This is clearer to developers than relying on the local code being built.

* update check_examples.py
* bump openlayers to v2 with upgrade of pmtiles to v4 [#455]
* update to 4.2.1
  • Loading branch information
bdon authored Jan 14, 2025
1 parent d374044 commit 61e60c6
Show file tree
Hide file tree
Showing 12 changed files with 95 additions and 33 deletions.
11 changes: 11 additions & 0 deletions .github/check_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@
name = j["name"]
version = j["version"]

for dependent in glob.glob("**/package.json",recursive=True):
if "node_modules" in dependent:
continue
with open(dependent,"r") as f:
j2 = json.loads(f.read())
if 'dependencies' in j2 and name in j2["dependencies"]:
dependent_version = j2["dependencies"]["pmtiles"]
if dependent_version != "^" + version:
print(dependent,"should be ^",version,"was",dependent_version)
fail = 1

for html in glob.glob("**/*.html",recursive=True):
if "node_modules" in html:
continue
Expand Down
2 changes: 1 addition & 1 deletion js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ See [protomaps-leaflet](https://github.com/protomaps/protomaps-leaflet)
Example of a PMTiles archive displayed in MapLibre GL JS:

```js
import { Protocol } from "pmtiles";
import { Protocol } from "pmtiles";
let protocol = new Protocol();
maplibregl.addProtocol("pmtiles",protocol.tile);
var style = {
Expand Down
2 changes: 1 addition & 1 deletion openlayers/examples/raster.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8"/>
<script src="https://cdn.jsdelivr.net/npm/ol@v9.0.0/dist/ol.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v9.0.0/ol.css">
<script src="https://unpkg.com/ol-pmtiles@1.0.2/dist/olpmtiles.js"></script>
<script src="https://unpkg.com/ol-pmtiles@2.0.0/dist/olpmtiles.js"></script>
<style>
body, #map {
height:100vh;
Expand Down
2 changes: 1 addition & 1 deletion openlayers/examples/vector.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8"/>
<script src="https://cdn.jsdelivr.net/npm/ol@v9.0.0/dist/ol.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v9.0.0/ol.css">
<script src="https://unpkg.com/ol-pmtiles@1.0.2/dist/olpmtiles.js"></script>
<script src="https://unpkg.com/ol-pmtiles@2.0.0/dist/olpmtiles.js"></script>
<style>
body, #map {
height:100vh;
Expand Down
35 changes: 11 additions & 24 deletions openlayers/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions openlayers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ol-pmtiles",
"version": "1.0.2",
"version": "2.0.0",
"description": "PMTiles sources for OpenLayers",
"type": "module",
"main": "dist/cjs/index.cjs",
Expand Down Expand Up @@ -42,7 +42,7 @@
"prettier-check": "prettier --check *.js"
},
"dependencies": {
"pmtiles": "^3.1.0"
"pmtiles": "^4.2.1"
},
"devDependencies": {
"tsup": "^8.2.3",
Expand Down
31 changes: 30 additions & 1 deletion serverless/aws/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion serverless/aws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"dependencies": {
"@aws-sdk/client-s3": "^3.637.0",
"@smithy/node-http-handler": "^3.1.4"
"@smithy/node-http-handler": "^3.1.4",
"pmtiles": "^4.2.1"
}
}
2 changes: 1 addition & 1 deletion serverless/aws/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
ResolvedValueCache,
Source,
TileType,
} from "../../../js/src/index";
} from "pmtiles";
import { pmtiles_path, tile_path } from "../../shared/index";

import { createHash } from "crypto";
Expand Down
31 changes: 31 additions & 0 deletions serverless/cloudflare/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions serverless/cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
"build": "wrangler deploy --outdir dist --dry-run",
"biome": "biome check --config-path=../../js/ src/index.ts --apply",
"biome-check": "biome check --config-path=../../js src/index.ts"
},
"dependencies": {
"pmtiles": "^4.2.1"
}
}
2 changes: 1 addition & 1 deletion serverless/cloudflare/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ResolvedValueCache,
Source,
TileType,
} from "../../../js/src/index";
} from "pmtiles";
import { pmtiles_path, tile_path } from "../../shared/index";

interface Env {
Expand Down

0 comments on commit 61e60c6

Please sign in to comment.