Skip to content

Commit

Permalink
Merge with kirtan-desai/ol-geocoder changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominique Cavailhez committed Sep 2, 2023
1 parent 1f44326 commit bca9da1
Show file tree
Hide file tree
Showing 30 changed files with 6,502 additions and 23,693 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/dist
7 changes: 1 addition & 6 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ root: true
env:
browser: true
node: true
parser: babel-eslint
parser: "@babel/eslint-parser"
parserOptions:
ecmaVersion: 2020
ecmaFeatures:
Expand All @@ -13,7 +13,6 @@ globals:
ol: true
extends:
- airbnb-base
- hardcore
- plugin:prettier/recommended
rules:
no-sync: 0
Expand Down Expand Up @@ -136,10 +135,6 @@ rules:
unicorn/prefer-node-remove: 0
unicorn/no-null: 0
unicorn/prevent-abbreviations: 0
sonarjs/no-small-switch: 0
sonarjs/cognitive-complexity:
- error
- 40

overrides:
- files:
Expand Down
30 changes: 12 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# MAINTAINER WANTED
As I am no longer using ol-geocoder in my day-to-day life, it has been mostly ignored as you can likely see from the issues/PRs. If you are interested in taking over and becoming the maintainer of ol-geocoder, please open an issue and we can start talking about transitioning it.
# MAINTENANCE TAKEOVER
While Jonathan & Kirtan ask for a new maintainer, Dominique takeover ol-geocoder.
I would like to thank them and the entire development team for the fantastic work done so far.

# OpenLayers Control Geocoder
<p align="center">
Expand All @@ -10,20 +11,13 @@ As I am no longer using ol-geocoder in my day-to-day life, it has been mostly ig
<img src="https://img.shields.io/npm/v/ol-geocoder.svg"
alt="npm version">
</a>
<a href="https://github.com/jonataswalker/ol-geocoder/blob/master/LICENSE">
<a href="https://github.com/Dominique92/ol-geocoder/blob/master/LICENSE">
<img src="https://img.shields.io/npm/l/ol-geocoder.svg"
alt="license">
</a>
<a href="https://david-dm.org/jonataswalker/ol-geocoder">
<img src="https://david-dm.org/jonataswalker/ol-geocoder/status.svg"
alt="dependency status">
</a>
<a href="https://david-dm.org/jonataswalker/ol-geocoder">
<img src="https://david-dm.org/jonataswalker/ol-geocoder/dev-status.svg" alt="devDependency status">
</a>
</p>

A geocoder extension for [OpenLayers](http://openlayers.org/). **Requires** OpenLayers **v3.11.0** or higher.
A geocoder extension compatible with OpenLayers v7. **Requires** OpenLayers **v6.15.0** or higher.

![geocoder anim](https://raw.githubusercontent.com/jonataswalker/ol-geocoder/screenshots/images/anim.gif)

Expand Down Expand Up @@ -76,11 +70,11 @@ Load CSS and Javascript:
<script src="https://unpkg.com/ol-geocoder"></script>
```
##### Self hosted
Download [latest release](https://github.com/jonataswalker/ol-geocoder/releases/latest) and (obviously) load CSS and Javascript.
Download [latest release](https://github.com/Dominique92/ol-geocoder/releases/latest) and (obviously) load CSS and Javascript.

##### Instantiate with some options and add the Control
```javascript
var geocoder = new Geocoder('nominatim', {
const geocoder = new Geocoder('nominatim', {
provider: 'mapquest',
key: '__some_key__',
lang: 'pt-BR', //en-US, fr-FR
Expand All @@ -94,12 +88,12 @@ map.addControl(geocoder);

##### Listen and do something when an address is chosen
```javascript
geocoder.on('addresschosen', function(evt){
var feature = evt.feature,
coord = evt.coordinate,
address = evt.address;
geocoder.on('addresschosen', (evt) => {
const feature = evt.feature,
coord = evt.coordinate,
address = evt.address;
// some popup solution
content.innerHTML = '<p>'+ address.formatted +'</p>';
content.innerHTML = '<p>' + address.formatted + '</p>';
overlay.setPosition(coord);
});
```
Expand Down
13 changes: 1 addition & 12 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],

env: {
test: {
presets: [['@babel/preset-env']],
plugins: ['@babel/plugin-transform-modules-commonjs'],
},
},
};
8 changes: 4 additions & 4 deletions build/banner.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* ${name} - v${version}
* ${description}
* ${homepage}
* Built: ${time}
* {name} - v{version}
* {description}
* {homepage}
* Built: {time}
*/
78 changes: 39 additions & 39 deletions build/build-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ const postcssReport = require('postcss-reporter');
const cssnano = require('cssnano');
const pkg = require('../package.json');

var banner = readFileSync('./build/banner.js', 'utf-8')
.replace('${name}', pkg.name)
.replace('${description}', pkg.description)
.replace('${homepage}', pkg.homepage)
.replace('${version}', pkg.version)
.replace('${time}', new Date());
const banner = readFileSync('./build/banner.js', 'utf-8')
.replace('{name}', pkg.name)
.replace('{description}', pkg.description)
.replace('{homepage}', pkg.homepage)
.replace('{version}', pkg.version)
.replace('{time}', new Date());

sass.render(
{
Expand All @@ -26,48 +26,48 @@ sass.render(
(err, result) => {
if (err) throw err.message;

const prefixer = postcss([
autoprefixer(),
postcssReport({ clearMessages: true }),
]);
const prefixer = postcss([autoprefixer(), postcssReport({ clearMessages: true })]);

prefixer.process(result.css, { from: undefined }).then((res) => {
res.warnings().forEach((warn) => {
console.warn(warn.toString());
});

writeFileSync('./dist/ol-geocoder.css', banner + res.css);

cssnano.process(res.css).then((min) => {
writeFileSync('./dist/ol-geocoder.min.css', banner + min.css);
cssnano()
.process(res.css)
.then((min) => {
writeFileSync('./dist/ol-geocoder.min.css', banner + min.css);

const cssSize = bytes(Buffer.byteLength(res.css));
const cssMinSize = bytes(Buffer.byteLength(min.css));
const cssGzip = bytes(gzip.sync(res.css));
const cssMinGzip = bytes(gzip.sync(min.css));
const cssSize = bytes(Buffer.byteLength(res.css));
const cssMinSize = bytes(Buffer.byteLength(min.css));
const cssGzip = bytes(gzip.sync(res.css));
const cssMinGzip = bytes(gzip.sync(min.css));

// eslint-disable-next-line no-console
console.log(
boxen(
[
chalk.green.bold('CSS: '),
chalk.yellow.bold(cssSize),
', ',
chalk.green.bold('Gzipped: '),
chalk.yellow.bold(cssGzip),
'\n',
chalk.green.bold('Minified: '),
chalk.yellow.bold(cssMinSize),
', ',
chalk.green.bold('Gzipped: '),
chalk.yellow.bold(cssMinGzip),
'\n',
chalk.green.bold('Now: '),
chalk.yellow.bold(new Date()),
].join(''),
{ padding: 1 }
)
);
});
// eslint-disable-next-line no-console
console.log(
boxen(
[
chalk.green.bold('CSS: '),
chalk.yellow.bold(cssSize),
', ',
chalk.green.bold('Gzipped: '),
chalk.yellow.bold(cssGzip),
'\n',
chalk.green.bold('Minified: '),
chalk.yellow.bold(cssMinSize),
', ',
chalk.green.bold('Gzipped: '),
chalk.yellow.bold(cssMinGzip),
'\n',
chalk.green.bold('Now: '),
chalk.yellow.bold(new Date()),
].join(''),
{ padding: 1 }
)
);
});
});
}
);
19 changes: 7 additions & 12 deletions build/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import { readFileSync } from 'fs';
import nodeResolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import buble from '@rollup/plugin-buble';
import { terser } from 'rollup-plugin-terser';

const pkg = JSON.parse(readFileSync('./package.json', 'utf-8'));
const external = Object.keys(pkg.dependencies);
const globals = {};

const ol = [
const openlayers = [
['ol/control/Control', 'ol.control.Control'],
['ol/style/Style', 'ol.style.Style'],
['ol/style/Icon', 'ol.style.Icon'],
Expand All @@ -20,17 +19,17 @@ const ol = [
['ol/Feature', 'ol.Feature'],
];

ol.forEach((each) => {
openlayers.forEach((each) => {
external.push(each[0]);
globals[each[0]] = each[1];
});

const banner = readFileSync('./build/banner.js', 'utf-8')
.replace('${name}', pkg.name)
.replace('${description}', pkg.description)
.replace('${homepage}', pkg.homepage)
.replace('${version}', pkg.version)
.replace('${time}', new Date());
.replace('{name}', pkg.name)
.replace('{description}', pkg.description)
.replace('{homepage}', pkg.homepage)
.replace('{version}', pkg.version)
.replace('{time}', new Date());

export default [
{
Expand All @@ -47,11 +46,9 @@ export default [
plugins: [
nodeResolve(),
commonjs({
exclude: 'src/**',
include: 'node_modules/**',
}),
json({ exclude: 'node_modules/**' }),
buble({ target: { ie: 11 } }),
terser({ output: { comments: /^!/ } }),
],
},
Expand All @@ -69,11 +66,9 @@ export default [
plugins: [
nodeResolve(),
commonjs({
exclude: 'src/**',
include: 'node_modules/**',
}),
json({ exclude: 'node_modules/**' }),
buble({ target: { ie: 11 } }),
],
},
];
Loading

0 comments on commit bca9da1

Please sign in to comment.