-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Unit Tests, GitHub actions, fixed loop way
- Loading branch information
1 parent
6efd30d
commit 3dbcfda
Showing
15 changed files
with
2,736 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: Pull Request Check | ||
on: | ||
pull_request: | ||
branches: | ||
- dev/* | ||
- master | ||
jobs: | ||
unit-tests: | ||
name: Unit Tests | ||
uses: ./.github/workflows/unit-tests.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Publish | ||
on: | ||
push: | ||
branches: master | ||
jobs: | ||
unit-tests: | ||
name: Unit Tests | ||
uses: ./.github/workflows/unit-tests.yml | ||
publish: | ||
name: Publish | ||
needs: unit-tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref }} | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
registry-url: https://registry.npmjs.org/ | ||
- name: Get package.json | ||
id: get-package | ||
run: echo PACKAGE=$(cat ./package.json) >> $GITHUB_OUTPUT | ||
- name: Get package version | ||
id: get-package-version | ||
run: echo VERSION="${{ fromJson(steps.get-package.outputs.PACKAGE).version }}" >> $GITHUB_OUTPUT | ||
- name: Install | ||
run: npm ci | ||
- name: Build | ||
run: npm run build | ||
- name: Publish | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Tag | ||
run: | | ||
git config --global user.name "ponlawat-w" | ||
git config --global user.email "[email protected]" | ||
git tag -fa ${{ steps.get-package-version.outputs.VERSION }} | ||
git push --force origin ${{ steps.get-package-version.outputs.VERSION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Unit Tests | ||
on: workflow_call | ||
jobs: | ||
unit-tests: | ||
name: Unit Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref }} | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
- name: Install | ||
run: npm ci | ||
- name: Test | ||
run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,55 +110,6 @@ mao.addInteraction(interaction); | |
|
||
### Using as CDN | ||
|
||
```html | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/ol.css"> | ||
<style> | ||
#map { | ||
width: 100%; | ||
height: 90vh; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="map"></div> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ol.js"></script> | ||
<script src="https://www.unpkg.com/ol-osmwaysnap/dist/webpack/index.js"></script> | ||
<script lang="js"> | ||
const basemap = new ol.layer.Tile({ source: new ol.source.OSM() }); | ||
const targetFeaturesLayer = new ol.layer.Vector({ | ||
source: new ol.source.Vector(), | ||
style: new ol.style.Style({ | ||
stroke: new ol.style.Stroke({ | ||
width: 4, | ||
color: '#ff0000' | ||
}) | ||
}) | ||
}); | ||
const map = new ol.Map({ | ||
target: 'map', | ||
layers: [basemap, targetFeaturesLayer], | ||
view: new ol.View({ | ||
center: [11018989, 2130015], | ||
zoom: 16 | ||
}) | ||
}); | ||
const interaction = new OSMWaySnap.OSMWaySnap({ | ||
source: targetFeaturesLayer.getSource(), | ||
maximumResolution: 5, | ||
fetchBufferSize: 250, | ||
overpassEndpointURL: 'https://...' // Choose one instance from https://wiki.openstreetmap.org/wiki/Overpass_API#Public_Overpass_API_instances | ||
}); | ||
map.addInteraction(interaction); | ||
</script> | ||
</body> | ||
</html> | ||
``` | ||
[HTML Example](./examples/index.html) | ||
|
||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,8 +41,7 @@ | |
|
||
<div id="status"></div> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ol.js"></script> | ||
<script src="../dist/webpack/index.js"></script> | ||
<!-- <script src="https://www.unpkg.com/ol-osmwaysnap/dist/webpack/index.js"></script> --> | ||
<script src="https://www.unpkg.com/ol-osmwaysnap/dist/bundle/index.js"></script> | ||
<script lang="js"> | ||
const basemap = new ol.layer.Tile({ source: new ol.source.OSM() }); | ||
|
||
|
Oops, something went wrong.