From: Sarah Hoffmann Date: Thu, 5 Jan 2023 14:52:00 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/master' X-Git-Url: https://git.openstreetmap.org/nominatim-ui.git/commitdiff_plain/7ed97d6aceab15f29088f45aa6fbf1eda551173d?hp=eed669c677633190b4a440346d26c8a0ce691dc4 Merge remote-tracking branch 'upstream/master' --- diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 95d8b34..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,59 +0,0 @@ -module.exports = { - extends: [ - 'airbnb-base/legacy', - 'plugin:mocha/recommended' - ], - parserOptions: { - ecmaVersion: 2019, - sourceType: 'module' - }, - env: { - browser: true, - jquery: true - }, - plugins: [ - 'svelte3', - 'mocha' - ], - overrides: [ - { - files: ['*'], - globals: { - L: true, // leaflet library - Nominatim_Config: true - }, - rules: { - camelcase: 'off', // my_var is fine, no need for myVar - 'func-names': 'off', // anonymous 'function()' is fine - 'vars-on-top': 'off', - 'new-cap': 'off', // constructor name can start lowercase (as Leaflet does) - 'no-multiple-empty-lines': 'off', - 'no-use-before-define': ['error', { functions: false }], - 'padded-blocks': 'off', - 'no-param-reassign': 'off', - 'max-len': [ - 'error', - 100, - 2, - { - ignoreUrls: true, - ignoreComments: false - } - ] - } - }, - { - files: ['*.svelte'], - processor: 'svelte3/svelte3', - rules: { - 'no-label-var': 'off' // eslint thinks $: (https://svelte.dev/tutorial/reactive-statements) are labels - } - }, - { - files: ['test/**'], - globals: { - browser: true - } - } - ] -}; diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..908eb4d --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,59 @@ +// https://eslint.org/docs/latest/user-guide/configuring/configuration-files +{ + "extends": [ + "airbnb-base/legacy", + "plugin:mocha/recommended" + ], + "parserOptions": { + "ecmaVersion": 2019, + "sourceType": "module" + }, + "env": { + "browser": true + }, + "plugins": [ + "svelte3", + "mocha" + ], + "overrides": [ + { + "files": ["*"], + "globals": { + "L": true, // leaflet library + "Nominatim_Config": true + }, + "rules": { + "camelcase": "off", // my_var is fine, no need for myVar + "func-names": "off", // anonymous "function()" is fine + "vars-on-top": "off", + "new-cap": "off", // constructor name can start lowercase (as Leaflet does) + "no-multiple-empty-lines": "off", + "no-use-before-define": ["error", { "functions": false }], + "padded-blocks": "off", + "no-param-reassign": "off", + "max-len": [ + "error", + 100, + 2, + { + "ignoreUrls": true, + "ignoreComments": false + } + ] + } + }, + { + "files": ["*.svelte"], + "processor": "svelte3/svelte3", + "rules": { + "no-label-var": "off" // eslint thinks $: (https://svelte.dev/tutorial/reactive-statements) are labels + } + }, + { + "files": ["test/**"], + "globals": { + "browser": true + } + } + ] +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8c25ac..adecae3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,9 +10,9 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: node-version: '16.x' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 23b2050..a239e48 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,9 +10,9 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: node-version: '16.x' @@ -33,7 +33,6 @@ jobs: GITREF: ${{ github.ref }} - - uses: AButler/upload-release-assets@v2.0 + - uses: softprops/action-gh-release@v1 with: files: 'artifacts/*' - repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.mocharc.js b/.mocharc.js deleted file mode 100644 index 4ee1dd1..0000000 --- a/.mocharc.js +++ /dev/null @@ -1,9 +0,0 @@ -// https://github.com/mochajs/mocha/blob/master/example/config/.mocharc.js - -'use strict'; - -module.exports = { - ignore: ['test/_bootstrap.js'], - require: ['test/_bootstrap.js'], - timeout: '5s' -}; diff --git a/.mocharc.json b/.mocharc.json new file mode 100644 index 0000000..49e0f0e --- /dev/null +++ b/.mocharc.json @@ -0,0 +1,6 @@ +// https://github.com/mochajs/mocha/blob/master/example/config/.mocharc.json +{ + "ignore": ["test/_bootstrap.js"], + "require": ["test/_bootstrap.js"], + "timeout": "5s" +} \ No newline at end of file diff --git a/CHANGES.md b/CHANGES.md index 60bd3fc..35260da 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,13 @@ # CHANGES +* version 3.2.9 - 2022-11-16 + + * Fix: For places tagged bulding=yes display the formatted label 'Building', not 'Yes' + * migrate remaining modules to ESM style (import instead of require) + * NPM package updates + * test suite: use JSON files for mocha and eslint configuration + * test suite: update outdated Github Actions + * version 3.2.8 - 2022-09-26 * Use OSM's preferred tile URL for faster map loading diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md index c9b7b9c..9f98597 100644 --- a/CONTRIBUTE.md +++ b/CONTRIBUTE.md @@ -36,7 +36,7 @@ Svelte. Version 3 added theme and easier configuration. The `test/` setup uses [Mocha](https://mochajs.org/) to run tests. Tests use [Puppeteer](https://pptr.dev/) to control a Google Chrome headless browser and evaluate with [Assert](https://nodejs.org/api/assert.html). -* Run integration test suite (configuration in `.mocharc.js`) +* Run integration test suite (configuration in `.mocharc.json`) ``` yarn test @@ -53,7 +53,7 @@ The `test/` setup uses [Mocha](https://mochajs.org/) to run tests. Tests use [Pu yarn run rollup -c && yarn run mocha test/details.js ``` -* Run syntax linter (configuration in `.eslint.js`) +* Run syntax linter (configuration in `.eslint.json`) ``` yarn lint diff --git a/dist/theme/config.theme.js.example b/dist/theme/config.theme.js.example index 4c14a90..d9b6b60 100644 --- a/dist/theme/config.theme.js.example +++ b/dist/theme/config.theme.js.example @@ -2,4 +2,4 @@ // The file should be named 'config.theme.js' Nominatim_Config.Nominatim_API_Endpoint = 'http://myserver.example.com:1234/nominatim/'; -Nominatim_Config.Page_Title = 'My Server demo; +Nominatim_Config.Page_Title = 'My Server demo'; diff --git a/package.json b/package.json index bd2d910..7dd0046 100644 --- a/package.json +++ b/package.json @@ -1,27 +1,27 @@ { "name": "nominatim-ui", "description": "Debug web interface for Nominatim geocoder", - "version": "3.2.8", + "version": "3.2.9", "license": "GPL-2.0", "scripts": { "build": "rollup -c", "dev": "rollup -c -w", - "lint": "eslint --quiet .*.js src/ test/", - "lint:fix": "eslint --fix .*.js src/ test/", + "lint": "eslint --quiet *.js src/ test/", + "lint:fix": "eslint --fix *.js src/ test/", "test": "rollup -c && mocha --recursive test/", "start": "static-server dist" }, "devDependencies": { - "@rollup/plugin-commonjs": "^22.0", - "@rollup/plugin-node-resolve": "^14.0", + "@rollup/plugin-commonjs": "^23.0", + "@rollup/plugin-node-resolve": "^15.0", "eslint-plugin-mocha": "^10.0", - "fs-extra": "^10.0.0", + "fs-extra": "^11.0.0", "http": "^0.0.1-security", "http-proxy": "^1.18.1", "mocha": "^10.0", - "puppeteer": "^18.0", - "rollup": "^2.3.4", - "rollup-plugin-css-only": "^3.1.0", + "puppeteer": "^19.0", + "rollup": "^3.3.0", + "rollup-plugin-css-only": "^4.3.0", "rollup-plugin-livereload": "^2.0.0", "rollup-plugin-svelte": "^7.0.0", "rollup-plugin-terser": "^7.0.0", @@ -35,8 +35,9 @@ "eslint-config-airbnb-base": "^15.0", "eslint-plugin-import": "^2.22.1", "eslint-plugin-svelte3": "^4.0", - "leaflet": "1.9.1", + "leaflet": "1.9.3", "leaflet-minimap": "^3.6.1", "timeago.js": "^4.0.2" - } + }, + "type": "module" } diff --git a/rollup.config.js b/rollup.config.js index b3a25b4..757a22d 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -3,84 +3,86 @@ import commonjs from '@rollup/plugin-commonjs'; import resolve from '@rollup/plugin-node-resolve'; import livereload from 'rollup-plugin-livereload'; import { terser } from 'rollup-plugin-terser'; +import { spawn } from 'child_process'; import css from 'rollup-plugin-css-only'; import { readFileSync, writeFileSync } from 'fs'; const production = !process.env.ROLLUP_WATCH; function serve() { - let server; + let server; - function toExit() { - if (server) server.kill(0); - } + function toExit() { + if (server) server.kill(0); + } - return { - writeBundle() { - if (server) return; - server = require('child_process').spawn('yarn', ['start', '-d'], { - stdio: ['ignore', 'inherit', 'inherit'], - shell: true - }); + return { + writeBundle() { + if (server) return; + server = spawn('yarn', ['start', '-d'], { + stdio: ['ignore', 'inherit', 'inherit'], + shell: true + }); - process.on('SIGTERM', toExit); - process.on('exit', toExit); - } - }; + process.on('SIGTERM', toExit); + process.on('exit', toExit); + } + }; } export default { - input: 'src/main.js', - output: { - sourcemap: true, - format: 'iife', - name: 'app', - file: 'dist/build/bundle.js' - }, - plugins: [ - svelte({ - compilerOptions: { - // enable run-time checks when not in production - dev: !production - } - }), - css({ - output: function (styles, styleNodes) { - // make sure global_styles.css gets appended to bundle.css, - // not prepended. - // The ':global()' rules (https://svelte.dev/docs#style) get - // prepended so we can't use them to overwrite bootstrap.css - // rules - let global_styles = readFileSync('src/global_style.css'); - styles += global_styles; - writeFileSync('dist/build/bundle.css', styles); - } - }), + input: 'src/main.js', + output: { + sourcemap: true, + format: 'iife', + name: 'app', + file: 'dist/build/bundle.js' + }, + plugins: [ + svelte({ + compilerOptions: { + // enable run-time checks when not in production + dev: !production + } + }), + css({ + // output: function (styles, styleNodes) { + output: function (styles) { + // make sure global_styles.css gets appended to bundle.css, + // not prepended. + // The ':global()' rules (https://svelte.dev/docs#style) get + // prepended so we can't use them to overwrite bootstrap.css + // rules + let global_styles = readFileSync('src/global_style.css'); + styles += global_styles; + writeFileSync('dist/build/bundle.css', styles); + } + }), - // If you have external dependencies installed from - // npm, you'll most likely need these plugins. In - // some cases you'll need additional configuration - - // consult the documentation for details: - // https://github.com/rollup/plugins/tree/master/packages/commonjs - resolve({ - browser: true, - dedupe: ['svelte'] - }), - commonjs(), + // If you have external dependencies installed from + // npm, you'll most likely need these plugins. In + // some cases you'll need additional configuration - + // consult the documentation for details: + // https://github.com/rollup/plugins/tree/master/packages/commonjs + resolve({ + browser: true, + dedupe: ['svelte'] + }), + commonjs(), - // In dev mode, call `npm run start` once - // the bundle has been generated - !production && serve(), + // In dev mode, call `npm run start` once + // the bundle has been generated + !production && serve(), - // Watch the `dist` directory and refresh the - // browser on changes when not in production - !production && livereload('dist'), + // Watch the `dist` directory and refresh the + // browser on changes when not in production + !production && livereload('dist'), - // If we're building for production (npm run build - // instead of npm run dev), minify - production && terser() - ], - watch: { - clearScreen: false - } + // If we're building for production (npm run build + // instead of npm run dev), minify + production && terser() + ], + watch: { + clearScreen: false + } }; diff --git a/src/components/DetailsPostcodeHint.svelte b/src/components/DetailsPostcodeHint.svelte index 72d05b8..2399957 100644 --- a/src/components/DetailsPostcodeHint.svelte +++ b/src/components/DetailsPostcodeHint.svelte @@ -53,7 +53,7 @@ Nightly calculated from nearby places having this postcode. Documentation. - You can search for those with an Overpass Turbo query. + You can search for those with an Overpass Turbo query.