Skip to content

Commit

Permalink
ci: add workflow for build and type check
Browse files Browse the repository at this point in the history
  • Loading branch information
Joxit committed Jul 23, 2021
1 parent d19c7bd commit 9667506
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 5 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release NPM Package

on:
push:
tags: '*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
scope: '@jawg'
- run: npm install
- run: npm test
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_JS_ACCESS_TOKEN }}
- name: Install kokai
run: cargo install kokai
- name: Create Release Note
run: kokai release --ref ${{ github.ref }} --tag-from-ref . > RELEASE_NOTE.md
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: RELEASE_NOTE.md
draft: false
prerelease: false
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,43 @@
# js-loader

[![npm](https://img.shields.io/npm/v/@jawg/js-loader)](https://www.npmjs.com/package/@jawg/js-loader)

Load the Jawg Maps JavaScript libraries dynamically.

## Install

Available via npm as the package [@jawg/js-loader](https://www.npmjs.com/package/@jawg/js-loader).

```sh
npm i @jawg/js-loader
```

or

```sh
yarn add @jawg/js-loader
```

Alternatively you may add the umd package directly to the html document using the unpkg link.

```html
<script src="https://unpkg.com/@jawg/js-loader@1.0.0/dist/jawg-js-loader.js"></script>
```

When adding via unpkg, the loader can be accessed at `JawgJSLoader`.

## Load Jawg Places JS

```javascript
import JawgJSLoader from '@jawg/js-loader';

let loader = new JawgJSLoader({ accessToken: '<YOUR_ACCESS_TOKEN>' });

loader.loadJawgPlaces().then((JawgPlaces) => {
let jawgPlaces = new JawgPlaces.Input({ input: '#my-input' });
});
```

## Feedback

Please submint an [issue](https://github.com/jawg/js-loader/issues) for new features or when something is not working properly.
28 changes: 23 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
{
"name": "@jawg/js-loader",
"version": "0.0.0",
"version": "1.0.0",
"description": "A library to load jawg js libraries",
"main": "./dist/jawg-js-loader.js",
"types": "./index.d.ts",
"typeScriptVersion": "2.3",
"scripts": {
"build": "rollup -c",
"watch": "rollup -c -w",
"start": "ROLLUP_SERVE=true rollup -c -w"
"start": "ROLLUP_SERVE=true rollup -c -w",
"test": "tsc --noEmit test/*.ts"
},
"author": "Jawg",
"license": "SEE LICENSE IN LICENSE",
"repository": {
"type": "git",
"url": "git+https://github.com/jawg/js-loader.git"
},
"keywords": [
"maps",
"osm",
"api",
"typescript",
"js-loader"
],
"author": "Jawg Maps <contact@jawg.io>",
"license": "MIT",
"files": [
"src/index.js",
"dist/jawg-js-loader.js",
Expand All @@ -19,6 +32,10 @@
"index.d.ts",
"packages.json"
],
"bugs": {
"url": "https://github.com/jawg/js-loader/issues"
},
"homepage": "https://github.com/jawg/js-loader#readme",
"devDependencies": {
"@babel/core": "^7.14.8",
"@babel/plugin-transform-runtime": "^7.14.5",
Expand All @@ -32,7 +49,8 @@
"rollup": "^2.53.3",
"rollup-plugin-app-utils": "^1.0.6",
"rollup-plugin-serve": "^1.1.0",
"rollup-plugin-terser": "^7.0.2"
"rollup-plugin-terser": "^7.0.2",
"typescript": "^4.3.5"
},
"dependencies": {
"@jawg/types": "^1.0.0"
Expand Down
9 changes: 9 additions & 0 deletions test/jawg-places.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import JawgJSLoader from '../';
import L = require('leaflet');

new JawgJSLoader({ accessToken: 'test' }).loadJawgPlaces().then((JawgPlaces) => {
new JawgPlaces.Input({ input: '#my-input' });
new JawgPlaces.MapLibre({ searchOnTyping: true });
new JawgPlaces.Mapbox({ searchOnTyping: true });
new JawgPlaces.Leaflet({ searchOnTyping: true, L });
});

0 comments on commit 9667506

Please sign in to comment.