From 13beef1516750fbb797516f7fc38ce2916e68f89 Mon Sep 17 00:00:00 2001 From: George Goodall Date: Fri, 12 Apr 2024 10:54:27 +0100 Subject: [PATCH] add rollup for maplibre --- Makefile | 1 + application/templates/national-map.html | 2 +- package.json | 7 ++++--- rollup.config.js | 10 ++++++++++ 4 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 rollup.config.js diff --git a/Makefile b/Makefile index 0f377e7c..08533840 100644 --- a/Makefile +++ b/Makefile @@ -110,6 +110,7 @@ govukAssets:: npx nps copy.govukAssets javascripts: + npm run build rsync -r assets/javascripts static/ robots: diff --git a/application/templates/national-map.html b/application/templates/national-map.html index 83d5a309..76e0d138 100644 --- a/application/templates/national-map.html +++ b/application/templates/national-map.html @@ -14,7 +14,7 @@ %} {%- block mapAssets %} - + {{ super() }} {% endblock -%} diff --git a/package.json b/package.json index 2c98795b..e8ca351f 100644 --- a/package.json +++ b/package.json @@ -31,13 +31,14 @@ "test": "vitest run", "coverage": "vitest run --coverage", "test-unit": "vitest run --dir tests/unit/javascript", - "test-integration": "vitest run --dir tests/integration/javascript" + "test-integration": "vitest run --dir tests/integration/javascript", + "build": "rollup -c" }, "dependencies": { "copyfiles": "^2.4.1", "govuk-frontend": "4.2.0", - "node-sass": "^9.0.0", - "nps": "^5.10.0" + "maplibre-gl": "^4.1.2", + "node-sass": "^9.0.0" }, "devDependencies": { "@vitest/coverage-v8": "^0.34.1", diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 00000000..57ea7535 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,10 @@ +// get the config object from the package file +module.exports = [ + { + input: `./node_modules/maplibre-gl/dist/maplibre-gl.js`, + output: { + file: `static/javascripts/maplibre-gl.js`, + format: "iife", + } + }, +];