Skip to content

Commit 9667506

Browse files
committed
ci: add workflow for build and type check
1 parent d19c7bd commit 9667506

File tree

4 files changed

+111
-5
lines changed

4 files changed

+111
-5
lines changed

.github/workflows/release.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release NPM Package
2+
3+
on:
4+
push:
5+
tags: '*'
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
fetch-depth: 0
14+
- uses: actions/setup-node@v2
15+
with:
16+
node-version: '12.x'
17+
registry-url: 'https://registry.npmjs.org'
18+
scope: '@jawg'
19+
- run: npm install
20+
- run: npm test
21+
- run: npm publish --access public
22+
env:
23+
NODE_AUTH_TOKEN: ${{ secrets.NPM_JS_ACCESS_TOKEN }}
24+
- name: Install kokai
25+
run: cargo install kokai
26+
- name: Create Release Note
27+
run: kokai release --ref ${{ github.ref }} --tag-from-ref . > RELEASE_NOTE.md
28+
- name: Create Release
29+
id: create_release
30+
uses: actions/create-release@v1
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
with:
34+
tag_name: ${{ github.ref }}
35+
release_name: Release ${{ github.ref }}
36+
body_path: RELEASE_NOTE.md
37+
draft: false
38+
prerelease: false

README.md

+41
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,43 @@
11
# js-loader
2+
3+
[![npm](https://img.shields.io/npm/v/@jawg/js-loader)](https://www.npmjs.com/package/@jawg/js-loader)
4+
25
Load the Jawg Maps JavaScript libraries dynamically.
6+
7+
## Install
8+
9+
Available via npm as the package [@jawg/js-loader](https://www.npmjs.com/package/@jawg/js-loader).
10+
11+
```sh
12+
npm i @jawg/js-loader
13+
```
14+
15+
or
16+
17+
```sh
18+
yarn add @jawg/js-loader
19+
```
20+
21+
Alternatively you may add the umd package directly to the html document using the unpkg link.
22+
23+
```html
24+
<script src="https://unpkg.com/@jawg/[email protected]/dist/jawg-js-loader.js"></script>
25+
```
26+
27+
When adding via unpkg, the loader can be accessed at `JawgJSLoader`.
28+
29+
## Load Jawg Places JS
30+
31+
```javascript
32+
import JawgJSLoader from '@jawg/js-loader';
33+
34+
let loader = new JawgJSLoader({ accessToken: '<YOUR_ACCESS_TOKEN>' });
35+
36+
loader.loadJawgPlaces().then((JawgPlaces) => {
37+
let jawgPlaces = new JawgPlaces.Input({ input: '#my-input' });
38+
});
39+
```
40+
41+
## Feedback
42+
43+
Please submint an [issue](https://github.com/jawg/js-loader/issues) for new features or when something is not working properly.

package.json

+23-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
11
{
22
"name": "@jawg/js-loader",
3-
"version": "0.0.0",
3+
"version": "1.0.0",
44
"description": "A library to load jawg js libraries",
55
"main": "./dist/jawg-js-loader.js",
66
"types": "./index.d.ts",
7+
"typeScriptVersion": "2.3",
78
"scripts": {
89
"build": "rollup -c",
910
"watch": "rollup -c -w",
10-
"start": "ROLLUP_SERVE=true rollup -c -w"
11+
"start": "ROLLUP_SERVE=true rollup -c -w",
12+
"test": "tsc --noEmit test/*.ts"
1113
},
12-
"author": "Jawg",
13-
"license": "SEE LICENSE IN LICENSE",
14+
"repository": {
15+
"type": "git",
16+
"url": "git+https://github.com/jawg/js-loader.git"
17+
},
18+
"keywords": [
19+
"maps",
20+
"osm",
21+
"api",
22+
"typescript",
23+
"js-loader"
24+
],
25+
"author": "Jawg Maps <[email protected]>",
26+
"license": "MIT",
1427
"files": [
1528
"src/index.js",
1629
"dist/jawg-js-loader.js",
@@ -19,6 +32,10 @@
1932
"index.d.ts",
2033
"packages.json"
2134
],
35+
"bugs": {
36+
"url": "https://github.com/jawg/js-loader/issues"
37+
},
38+
"homepage": "https://github.com/jawg/js-loader#readme",
2239
"devDependencies": {
2340
"@babel/core": "^7.14.8",
2441
"@babel/plugin-transform-runtime": "^7.14.5",
@@ -32,7 +49,8 @@
3249
"rollup": "^2.53.3",
3350
"rollup-plugin-app-utils": "^1.0.6",
3451
"rollup-plugin-serve": "^1.1.0",
35-
"rollup-plugin-terser": "^7.0.2"
52+
"rollup-plugin-terser": "^7.0.2",
53+
"typescript": "^4.3.5"
3654
},
3755
"dependencies": {
3856
"@jawg/types": "^1.0.0"

test/jawg-places.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import JawgJSLoader from '../';
2+
import L = require('leaflet');
3+
4+
new JawgJSLoader({ accessToken: 'test' }).loadJawgPlaces().then((JawgPlaces) => {
5+
new JawgPlaces.Input({ input: '#my-input' });
6+
new JawgPlaces.MapLibre({ searchOnTyping: true });
7+
new JawgPlaces.Mapbox({ searchOnTyping: true });
8+
new JawgPlaces.Leaflet({ searchOnTyping: true, L });
9+
});

0 commit comments

Comments
 (0)