nominatim-ui: rewrite packaging to add missing files

* Rewrite packaging to add missing files which needs to be
  built by yarn

* Drop usage of finalAttrs which is failing when used with
  mkYarnPackage
This commit is contained in:
Ivan Mincik
2025-07-01 12:45:48 +02:00
parent 5de2d661db
commit cb468f8dc7
2 changed files with 84 additions and 6 deletions
+48
View File
@@ -0,0 +1,48 @@
{
"name": "nominatim-ui",
"description": "Debug web interface for Nominatim geocoder",
"version": "3.7.1",
"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/",
"test": "rollup -c && mocha --recursive test/",
"start": "static-server dist"
},
"devDependencies": {
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.12.0",
"@rollup/plugin-commonjs": "^28.0",
"@rollup/plugin-node-resolve": "^16.0",
"eslint": "^9.0",
"eslint-config-prettier": "^10.1.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-mocha": "^11.0",
"eslint-plugin-prettier": "^5.2.6",
"eslint-plugin-security": "^3.0.1",
"eslint-plugin-svelte": "^3.5.0",
"fs-extra": "^11.0.0",
"globals": "^16.0.0",
"http": "^0.0.1-security",
"http-proxy": "^1.18.1",
"mocha": "^11.0",
"puppeteer": "^24.0",
"rollup": "^4.22.4",
"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",
"static-server": "^2.2.1",
"svelte": "^5.0.0"
},
"dependencies": {
"bootstrap": "^5.0.0",
"escape-html": "^1.0.3",
"leaflet": "1.9.4",
"leaflet-minimap": "^3.6.1",
"timeago.js": "^4.0.2"
},
"type": "module"
}
+36 -6
View File
@@ -1,28 +1,58 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchYarnDeps,
mkYarnPackage,
}:
stdenv.mkDerivation (finalAttrs: {
# Notes for the upgrade:
# * Download the tarball of the new version to use.
# * Replace new `package.json` here.
# * Update `version`+`hash` and rebuild.
mkYarnPackage rec {
pname = "nominatim-ui";
version = "3.7.1";
src = fetchFromGitHub {
owner = "osm-search";
repo = "nominatim-ui";
tag = "v${finalAttrs.version}";
tag = "v${version}";
hash = "sha256-TliTWDKdIp7Z0uYw5P65i06NQAUNwNymUsSYrihVZFE=";
};
offlineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
hash = "sha256-IqwsXEd9RSJhkA4BONTJT4xYMTyG9+zddIpD47v6AFc=";
};
packageJSON = ./package.json;
buildPhase = ''
runHook preBuild
yarn --offline build
runHook postBuild
'';
# Minimal configuration
# See https://nominatim.org/release-docs/latest/admin/Setup-Nominatim-UI/#installing-nominatim-ui
preInstall = ''
echo "Nominatim_Config.Nominatim_API_Endpoint='https://localhost/';" \
> deps/nominatim-ui/dist/theme/config.theme.js
'';
installPhase = ''
runHook preInstall
cp --archive dist $out
cp --archive deps/nominatim-ui/dist $out
runHook postInstall
'';
doDist = false;
meta = {
description = "Debugging user interface for Nominatim geocoder";
homepage = "https://github.com/osm-search/nominatim-ui";
@@ -31,6 +61,6 @@ stdenv.mkDerivation (finalAttrs: {
geospatial
ngi
];
changelog = "https://github.com/osm-search/nominatim-ui/releases/tag/v${finalAttrs.version}";
changelog = "https://github.com/osm-search/nominatim-ui/releases/tag/v${version}";
};
})
}