Skip to content

Commit

Permalink
change ol-pmtiles to TypeScript [#312] (#444)
Browse files Browse the repository at this point in the history
* change ol-pmtiles to TypeScript [#444]

* olpmtiles: 1.0.0
* accept either a string or pmtiles.Source for the url option
* package.json works for ESM/CJS/IIFE [#312, #443]
* replace npm install with npm ci on github actions
  • Loading branch information
bdon authored Sep 11, 2024
1 parent 089d13d commit ab5534d
Show file tree
Hide file tree
Showing 11 changed files with 2,398 additions and 549 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18.x
- run: cd js && npm install && npm run build
- run: cd js && npm ci && npm run build
- run: echo "VITE_GIT_SHA=$(git rev-parse --short HEAD)" >> app/.env
- run: cd app && npm install && ./node_modules/.bin/tsc && npm run prettier-check && ./node_modules/.bin/vite build
- run: cd serverless/aws && npm install && npx tsc && npm run biome-check && npm run build-zip && cp dist/lambda_function.zip ../../app/dist && npm run build-cloudformation-stack && cp dist/cloudformation-stack.yaml ../../app/dist
- run: cd serverless/cloudflare && cp wrangler.toml.example wrangler.toml && npm install && npx tsc && npm run biome-check && npm run build && cp dist/index.js ../../app/dist
- run: cd app && npm ci && ./node_modules/.bin/tsc && npm run prettier-check && ./node_modules/.bin/vite build
- run: cd serverless/aws && npm ci && npx tsc && npm run biome-check && npm run build-zip && cp dist/lambda_function.zip ../../app/dist && npm run build-cloudformation-stack && cp dist/cloudformation-stack.yaml ../../app/dist
- run: cd serverless/cloudflare && cp wrangler.toml.example wrangler.toml && npm ci && npx tsc && npm run biome-check && npm run build && cp dist/index.js ../../app/dist
- run: cd spec/v3 && cp *.pmtiles ../../app/dist
- run: cd js/examples && mkdir ../../app/dist/examples && cp *.html ../../app/dist/examples/
- run: cd js && npm install && npx typedoc index.ts --out ../app/dist/typedoc
- run: cd js && npm ci && npx typedoc index.ts --out ../app/dist/typedoc
- run : cd openlayers && npm ci && npm run tsc
- run: cd openlayers/examples && mkdir ../../app/dist/examples/openlayers && cp *.html ../../app/dist/examples/openlayers
- name: build_app
uses: peaceiris/actions-gh-pages@v3
Expand All @@ -46,9 +47,9 @@ jobs:
with:
node-version: 18.x
- run: python .github/check_examples.py
- run: cd js && npm install && npm test
- run: cd js && npm ci && npm test
- run: cd js && npm run biome-check
- run: cd python && python -m unittest test/test_*
- run: cd cpp && make
- run: cd serverless/cloudflare && npm install && npm test
- run: cd serverless/vtfilter && npm install && npm test
- run: cd serverless/cloudflare && npm ci && npm test
- run: cd serverless/vtfilter && npm ci && npm test
13 changes: 13 additions & 0 deletions openlayers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## 1.0.0

* Port code to TypeScript.
* add proper CJS, ESM and IIFE build artifacts.
* `url` option to `PMTilesVectorSource`/`PMTilesRasterSource` is either string URL or a `pmtiles.Source`.
* remove option `headers`, instead create a `FetchSource` and specify custom headers:

```js
const fetchSource = new pmtiles.FetchSource(
"https://r2-public.protomaps.com/protomaps-sample-datasets/nz-buildings-v3.pmtiles",
new Headers({'X-Abc':'Def'}),
);
```
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/[email protected]/dist/ol.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/ol.css">
<script src="https://unpkg.com/ol-pmtiles@0.5.0/dist/olpmtiles.js"></script>
<script src="https://unpkg.com/ol-pmtiles@1.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/[email protected]/dist/ol.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/ol.css">
<script src="https://unpkg.com/ol-pmtiles@0.5.0/dist/olpmtiles.js"></script>
<script src="https://unpkg.com/ol-pmtiles@1.0.0/dist/olpmtiles.js"></script>
<style>
body, #map {
height:100vh;
Expand Down
Loading

0 comments on commit ab5534d

Please sign in to comment.