Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update docs & minor housekeeping #72

Merged
merged 8 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions .github/workflows/shipjs-manual-prepare.yml

This file was deleted.

16 changes: 6 additions & 10 deletions .github/workflows/shipjs-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,22 @@ name: Ship js trigger
on:
push:
branches:
- master
- main
jobs:
build:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: master

ref: main
- uses: actions/setup-node@v1
with:
registry-url: "https://npm.pkg.github.com"
- run: |
if [ -f "yarn.lock" ]; then
yarn install
else
npm install
fi

scope: '@geospoc'
- run: npm install
env:
NODE_AUTH_TOKEN: ${{ secrets.READ_PACKAGES_PAT }}
- run: npm run release:trigger
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
12 changes: 0 additions & 12 deletions .prettierrc

This file was deleted.

11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/geospoc/v-mapbox-geocoder?sort=semver)](https://github.com/geospoc/v-mapbox-geocoder/packages) [![Ship js trigger](https://github.com/geospoc/v-mapbox-geocoder/workflows/Ship%20js%20trigger/badge.svg)](https://github.com/geospoc/v-mapbox-geocoder/actions?query=workflow%3A%22Ship+js+trigger%22) [![GitHub Release Date](https://img.shields.io/github/release-date/geospoc/v-mapbox-geocoder)](https://github.com/geospoc/v-mapbox-geocoder/releases) [![deploy](https://img.shields.io/badge/deploy-🛳%20Ship.js-blue?style=flat)](https://github.com/algolia/shipjs) [![David](https://img.shields.io/david/peer/geospoc/v-mapbox-geocoder)](https://david-dm.org/geospoc/v-mapbox-geocoder?type=peer) [![David](https://img.shields.io/david/dev/geospoc/v-mapbox-geocoder)](http://david-dm.org/geospoc/v-mapbox-geocoder?type=dev) [![GitHub issues](https://img.shields.io/github/issues/geospoc/v-mapbox-geocoder)](https://github.com/geospoc/v-mapbox-geocoder) [![GitHub last commit](https://img.shields.io/github/last-commit/geospoc/v-mapbox-geocoder)](https://github.com/geospoc/v-mapbox-geocoder/master) ![Maintenance](https://img.shields.io/maintenance/yes/2020) [![GitHub contributors](https://img.shields.io/github/contributors/geospoc/v-mapbox-geocoder)](https://github.com/geospoc/v-mapbox-geocoder/graphs/contributors) [![DeepScan grade](https://deepscan.io/api/teams/9381/projects/11871/branches/177149/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=9381&pid=11871&bid=177149)

[vue-mapbox](https://github.com/soal/vue-mapbox) plugin for [mapbox-gl-geocoder](https://github.com/mapbox/mapbox-gl-geocoder) support.
[v-mapbox](https://github.com/vinayakkulkarni/v-mapbox) plugin for [mapbox-gl-geocoder](https://github.com/mapbox/mapbox-gl-geocoder) support.

## Usage

First of all you need to install Mapbox GL and vue-mapbox. [See vue-mapbox doc](https://soal.github.io/vue-mapbox/#/quickstart)

First of all you need to install Mapbox GL and v-mapbox. [See v-mapbox doc](https://v-mapbox.netlify.app)

```bash
# Install mabbox-gl-geocoder and vue-mapbox-geocoder:
$ npm i @mapbox/mapbox-gl-geocoder vue-mapbox @geospoc/v-mapbox-geocoder
# Install mapbox-gl-geocoder v-mapbox and v-mapbox-geocoder:
$ npm i @mapbox/mapbox-gl-geocoder v-mapbox @geospoc/v-mapbox-geocoder
```

Now you can add geocoder control like other controls:
Expand All @@ -33,7 +32,7 @@ Now you can add geocoder control like other controls:
</template>

<script>
import { MglMap } from 'vue-mapbox';
import { MglMap } from 'v-mapbox';
import MglGeocoderControl from '@geospoc/v-mapbox-geocoder';
// you can also import this in your main.js or nuxt.config.js
// or even main/global (s)css file
Expand Down
8 changes: 4 additions & 4 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default [
commonjs(),
vue(),
],
external: ['@mapbox/mapbox-gl-geocoder', 'vue-mapbox'],
external: ['@mapbox/mapbox-gl-geocoder', 'v-mapbox'],
},
// CommonJS build
{
Expand All @@ -37,7 +37,7 @@ export default [
commonjs(),
vue(),
],
external: ['@mapbox/mapbox-gl-geocoder', 'vue-mapbox'],
external: ['@mapbox/mapbox-gl-geocoder', 'v-mapbox'],
},
// UMD build.
{
Expand All @@ -48,7 +48,7 @@ export default [
file: 'dist/v-mapbox-geocoder.js',
globals: {
'@mapbox/mapbox-gl-geocoder': 'MapboxGeocoder',
'vue-mapbox': 'vueMapbox',
'v-mapbox': 'vMapbox',
},
},
plugins: [
Expand All @@ -59,6 +59,6 @@ export default [
commonjs(),
vue(),
],
external: ['@mapbox/mapbox-gl-geocoder', 'vue-mapbox'],
external: ['@mapbox/mapbox-gl-geocoder', 'v-mapbox'],
},
];
4 changes: 2 additions & 2 deletions build/rollup.min.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
file: 'dist/v-mapbox-geocoder.min.js',
globals: {
'@mapbox/mapbox-gl-geocoder': 'MapboxGeocoder',
'vue-mapbox': 'vueMapbox',
'v-mapbox': 'vMapbox',
},
},
plugins: [
Expand All @@ -23,5 +23,5 @@ export default {
terser(),
vue(),
],
external: ['@mapbox/mapbox-gl-geocoder', 'vue-mapbox'],
external: ['@mapbox/mapbox-gl-geocoder', 'v-mapbox'],
};
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@geospoc/v-mapbox-geocoder",
"version": "0.2.0",
"description": "Geocoder plugin for VueMapbox",
"description": "Geocoder plugin for VMapbox",
"repository": {
"type": "git",
"url": "git@github.com:geospoc/v-mapbox-geocoder.git"
Expand Down Expand Up @@ -35,14 +35,18 @@
"build": "npm run bundle && npm run bundle:min",
"bundle": "rollup -c build/rollup.config.js",
"bundle:min": "rollup -c build/rollup.min.config.js",
"lint": "eslint 'src/**/*.{js,vue}'",
"lintfix": "eslint --fix 'src/**/*.{js,vue}'",
"lint": "npm run lint:eslint && npm run lint:prettier",
"lintfix": "npm run lint:eslint:fix && npm run lint:prettier:fix",
"lint:eslint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"lint:eslint:fix": "eslint --fix --ext .js,.vue --ignore-path .gitignore .",
"lint:prettier": "prettier --check \"{,!(node_modules|dist)/**/}*.{js,vue}\" --ignore-path .gitignore",
"lint:prettier:fix": "prettier --write \"{,!(node_modules|dist)/**/}*.{js,vue}\" --ignore-path .gitignore",
"release:prepare": "shipjs prepare",
"release:trigger": "shipjs trigger"
},
"peerDependencies": {
"mapbox-gl": "^1.10.1",
"vue-mapbox": "^0.4.1",
"mapbox-gl": "^1.11.0",
"v-mapbox": "^1.3.2",
"@mapbox/mapbox-gl-geocoder": "^4.5.1"
},
"devDependencies": {
Expand All @@ -51,6 +55,7 @@
"@babel/preset-env": "^7.10.4",
"@commitlint/cli": "^9.0.1",
"@commitlint/config-conventional": "^9.0.1",
"@geospoc/prettier-config-standard": "^1.0.0",
"@rollup/plugin-commonjs": "^13.0.0",
"ava": "^3.10.1",
"babel-eslint": "^10.1.0",
Expand Down
4 changes: 4 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
...require('@geospoc/prettier-config-standard'),
vueIndentScriptAndStyle: true,
};
58 changes: 8 additions & 50 deletions src/GeocoderControl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import MapboxGeocoder from '@mapbox/mapbox-gl-geocoder';
import { $helpers } from 'vue-mapbox';
import { $helpers } from 'v-mapbox';

const geocoderEvents = {
clear: 'clear',
Expand Down Expand Up @@ -29,58 +29,10 @@ export default {
type: String,
required: true,
},
zoom: {
type: Number,
default: 16,
},
flyTo: {
type: Boolean,
default: true,
},
placeholder: {
type: String,
default: 'Search',
},
proximity: {
type: Object,
default: null,
},
trackProximity: {
type: Boolean,
default: false,
},
bbox: {
type: Array,
default: null,
},
types: {
type: String,
default: null,
},
country: {
type: String,
default: null,
},
minLength: {
type: Number,
default: 2,
},
limit: {
type: Number,
default: 5,
},
language: {
type: String,
default: null,
},
filter: {
type: Function,
default: null,
},
localGeocoder: {
type: Function,
default: null,
},
// Component options
input: {
type: String,
Expand Down Expand Up @@ -119,7 +71,13 @@ export default {
if (this.accessToken && !this.mapbox.accessToken) {
this.mapbox.accessToken = this.accessToken;
}
this.control = new MapboxGeocoder(this.$props);

this.control = new MapboxGeocoder({
...this.$attrs,
proximity: this.proximity,
accessToken: this.accessToken,
});

this.control.on('results', this.$_updateInput);

this.$_deferredMount();
Expand Down