From 9667506acab57748bc47063ad876e7d3fc60b5bd Mon Sep 17 00:00:00 2001 From: Joxit Date: Fri, 23 Jul 2021 10:41:55 +0200 Subject: [PATCH] ci: add workflow for build and type check --- .github/workflows/release.yml | 38 ++++++++++++++++++++++++++++++++ README.md | 41 +++++++++++++++++++++++++++++++++++ package.json | 28 +++++++++++++++++++----- test/jawg-places.ts | 9 ++++++++ 4 files changed, 111 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 test/jawg-places.ts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5a49890 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/README.md b/README.md index 09dd5d9..a350698 100644 --- a/README.md +++ b/README.md @@ -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 + +``` + +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: '' }); + +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. \ No newline at end of file diff --git a/package.json b/package.json index 2eb0567..8d7644c 100644 --- a/package.json +++ b/package.json @@ -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 ", + "license": "MIT", "files": [ "src/index.js", "dist/jawg-js-loader.js", @@ -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", @@ -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" diff --git a/test/jawg-places.ts b/test/jawg-places.ts new file mode 100644 index 0000000..9fe5437 --- /dev/null +++ b/test/jawg-places.ts @@ -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 }); +});