diff --git a/.github/workflows/seed-packages.yml b/.github/workflows/seed-packages.yml new file mode 100644 index 000000000..9d0e97a80 --- /dev/null +++ b/.github/workflows/seed-packages.yml @@ -0,0 +1,43 @@ +name: Seed new packages to NPM + +# One-time bootstrap for brand-new workspace packages (providers/* and plugins/*). +# +# npm OIDC trusted publishing can only be configured for a package that already +# exists on the registry, so a new package cannot be published by the OIDC-only +# publish.yml on its first run. This workflow publishes a bare placeholder for +# any not-yet-existing package using a temporary NPM_TOKEN secret. +# +# This token is NOT meant to live in the repo long term. The procedure is: +# 1. Create a short-lived granular npm token (publish + create-package on @defra). +# 2. Add it as a repository secret named NPM_TOKEN. +# 3. Run this workflow (dry run first, then for real). +# 4. DELETE the NPM_TOKEN secret and revoke the token on npmjs.com. +# See RELEASING.md for the full procedure. + +on: + workflow_dispatch: + inputs: + dry_run: + description: 'Dry run — list what would be seeded without publishing.' + required: false + type: boolean + default: false + +permissions: + contents: read + +jobs: + seed: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v5 + with: + node-version-file: .nvmrc + registry-url: 'https://registry.npmjs.org' + + - name: Seed new packages + run: ./scripts/seed-packages.sh "${{ inputs.dry_run }}" + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 000000000..aa2a0d2d7 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,241 @@ +# Releasing + +This repo is an npm workspaces monorepo. A single release publishes the core +package and every provider/plugin **in lockstep at the same version**: + +| Package | npm name | +| --- | --- | +| Core | `@defra/interactive-map` | +| Providers | `@defra/interactive-map-provider-*` | +| Plugins | `@defra/interactive-map-plugin-*` | + +Publishing is driven by [`scripts/publish-package.sh`](scripts/publish-package.sh) +and runs entirely on **npm OIDC trusted publishing** — there is no long-lived +npm token in CI. + +There are two distinct flows: + +- **[One-time bootstrap](#one-time-bootstrap-new-packages-only)** — required once + per brand-new package before it can ever be released. +- **[Cutting a release](#cutting-a-release)** — the normal, repeatable flow. + +--- + +## One-time bootstrap (new packages only) + +> Skip this entirely if every package already exists on npm. You only do this +> when you add a *new* provider or plugin. + +### Steps at a glance + +For a brand-new package, all four steps are required and **in this order** — +don't stop after seeding: + +1. **Merge** the PR (new packages + workflows) to `main`. +2. **[Step 1 — Seed](#step-1--seed-the-new-package-names)** the package names + onto npm, using a temporary token. +3. **[Step 2 — Configure OIDC trusted publishing](#step-2--configure-oidc-trusted-publishing-on-npmjs)** + on npmjs.com, **once per new package**. Skipping this makes the release in the + next step fail with an auth error. +4. **[Cut a release](#cutting-a-release)** — the normal flow; publishes the real + packages via OIDC. + +Steps 2–3 are one-time per package. After that, every future release is just +step 4. + +### Why it's needed + +npm OIDC trusted publishing can only be configured on a package that **already +exists** on the registry — there is no "pending publisher" concept. So the +OIDC-only release pipeline cannot publish a package for the very first time: +there is no trusted-publisher config to authenticate against yet. + +The fix is a two-step bootstrap: **seed** the package name onto npm with a +short-lived token, then **configure trusted publishing** on it. After that the +normal OIDC pipeline owns it forever. + +> **Order matters: merge first.** A `workflow_dispatch` workflow only appears in +> the Actions UI once it's on the **default branch** (`main`), and the seed job +> checks out whatever branch it's dispatched from. So the new packages and the +> seed workflow must both be on `main` before you can seed. The full first-time +> sequence is: **merge the PR to `main` → seed (Step 1, from `main`) → configure +> OIDC (Step 2) → cut the first release.** + +### Step 1 — Seed the new package names + +This publishes a bare placeholder (just `package.json`, no build output) under a +dedicated `seed` dist-tag, so it never occupies `latest`/`beta`/`alpha`. It only +touches packages that don't yet exist on npm, so it's safe to re-run. + +1. On npmjs.com, create a **granular access token**: + - Scope: **Read and write** packages under `@defra`. + - Permission to **create new packages** in the scope. + - Shortest practical expiry (e.g. 1 day). +2. In GitHub → repo **Settings → Secrets and variables → Actions**, add a + repository secret named **`NPM_TOKEN`** with that token. +3. Run the **"Seed new packages to NPM"** workflow + (Actions tab → select workflow → **Run workflow**): + - First with **`dry_run: true`** and confirm the list of packages to be + seeded looks right. + - Then with **`dry_run: false`** to actually seed them. +4. Confirm each seeded package landed **only** under the `seed` dist-tag and has + no `latest` (a bare seed under `latest` would make `npm install` resolve an + empty, build-less package): + + ```bash + npm view @defra/interactive-map-plugin- dist-tags # expect: { seed: '...' }, no latest + ``` +5. **Immediately delete the `NPM_TOKEN` secret** and **revoke the token** on + npmjs.com. The token has done its job and must not linger. + +> Why a temporary secret rather than a workflow input: GitHub secrets are +> encrypted, auto-masked, and never shown in the UI. `workflow_dispatch` inputs +> are not — they're recorded in run metadata in plaintext, so they're the wrong +> place for a credential even for a one-off. + +### Step 2 — Configure OIDC trusted publishing on npmjs + +Do this **once per newly-seeded package** (the core package is already +configured). For each new package: + +1. Go to `https://www.npmjs.com/package/` → **Settings** tab. +2. Find the **Trusted Publisher** section → **Select your publisher** → + **GitHub Actions**. +3. Fill in: + - **Organization / owner:** `DEFRA` + - **Repository:** `interactive-map` + - **Workflow filename:** `publish.yml` + - **Environment:** leave blank (the publish job does not use one). +4. Save. (npm does not validate the config on save — a wrong value only surfaces + as an auth failure at publish time, so double-check the fields.) + +Each package can have only one trusted publisher. Once configured, that package +is published by OIDC on every future release with no token. + +> Tip: this is the tedious part — you repeat it for each new package. Verify it +> worked by doing your next release as a **pre-release** first (see below) and +> checking every package published. + +--- + +## Cutting a release + +Once all packages exist and have trusted publishing configured, releasing is just +creating a GitHub Release. **Merging to `main` does not publish anything** — CI +on `main` only runs lint/test. The release pipeline triggers **only** on a +published GitHub Release. + +### 1. Pick the version + +- All packages are versioned in lockstep from the release **tag**. +- The tag must be `vX.Y.Z` (e.g. `v1.4.0`) or a pre-release `vX.Y.Z-alpha.N` + (e.g. `v1.4.0-alpha.1`). +- The version must be **greater than the latest already-published version in the + same major line** for the core package, or the pipeline aborts + (`validate_version_bump`). + +### 2. Create the GitHub Release + +1. Make sure `main` is green and contains the commit you want to ship. +2. GitHub → **Releases → Draft a new release**. +3. **Choose a tag** → type the new tag (e.g. `v1.4.0`) → **Create new tag on + publish**, targeting `main`. +4. Add release notes. +5. **Pre-release vs standard:** + - Tick **"Set as a pre-release"** (or use an `-alpha.N` tag suffix) to publish + everything under the `alpha` dist-tag — use this to validate a release + safely. + - Leave it unticked for a standard release. +6. **Publish release.** + +That triggers the **"Publish to NPM"** workflow: + +1. Runs CI (lint/test) and builds all packages. +2. **Pre-flight gate** — before anything is published or stamped, + `scripts/publish-package.sh` asserts that **every** package (core + all + providers/plugins) can be published at the target version. If any package + fails, the whole release aborts here with **nothing published**, so you can + never get a partial release. See [Pre-flight checks](#3-pre-flight-checks) + below. +3. Stamps the release version into every `package.json` (and pins each package's + `@defra/interactive-map` peer dependency to that exact version). +4. Publishes core first, followed by every provider and plugin. + +### 3. Pre-flight checks + +The pre-flight gate runs once over all packages and reports **every** problem +before publishing starts. The failure modes and how to fix each: + +| Pre-flight failure | Meaning | Fix | +| --- | --- | --- | +| `not found on npm — needs bootstrap` | A new package was never seeded / OIDC-configured (npm returned an explicit E404) | Do the [One-time bootstrap](#one-time-bootstrap-new-packages-only), then re-release | +| `could not query npm (network/registry error)` | npm couldn't be reached — the gate can't tell whether the package exists | Re-run the release; if it persists, check [status.npmjs.org](https://status.npmjs.org) | +| `version X is already published` | This version exists (often a partial earlier release) | Cut a new patch version — see [Troubleshooting](#troubleshooting) | +| `npm publish --dry-run failed` | Missing build output or invalid `package.json` | Fix the package/build — see [Troubleshooting](#troubleshooting) | + +It also prints an **ℹ first real release** reminder for any package still on only +its `seed` placeholder version, so you double-check trusted publishing is +configured before its first real publish. + +> **Residual gap:** the gate can confirm a package *exists* on npm, but cannot +> verify its OIDC trusted-publisher config is correct without actually publishing +> (there's no way to exercise the OIDC token exchange in a dry run). The safest +> validation is to cut a **pre-release** first — it publishes every package under +> `alpha` and surfaces any auth problem without touching `latest`/`beta`. + +### 4. Dist-tags — what lands where + +| Release type | Core | `provider-maplibre`, `plugin-interact`, `plugin-search` | All other providers/plugins | +| --- | --- | --- | --- | +| **Pre-release** (pre-release flag **or** `-alpha.N` tag) | `alpha` | `alpha` | `alpha` | +| **Standard release** | `latest` | `latest` | `beta` | + +The split on a standard release comes from each package's +`publishConfig.tag`: packages considered stable have none (→ `latest`), the rest +carry `"publishConfig": { "tag": "beta" }`. + +> **Consequence to be aware of:** a package published only under `beta` has **no +> `latest` dist-tag**, so a plain `npm install @defra/interactive-map-plugin-` +> (which resolves `latest`) will fail for the beta packages — consumers must use +> `@beta`. The stable packages (core, `provider-maplibre`, `plugin-interact`, +> `plugin-search`) install normally. If you want a package to start resolving on +> `latest`, remove its `publishConfig.tag`. + +**Graduating a package to stable** is a three-place change: remove its +`publishConfig.tag`, remove its directory from `sonar.exclusions` in +`sonar-project.properties`, and remove it from `coveragePathIgnorePatterns` in +`jest.config.mjs` — beta packages are deliberately outside the Sonar quality +gate and coverage collection (carried over from the old `beta/` directory +layout), and a stable package should be inside both. + +### 5. Verify + +Check the Actions run succeeded, then spot-check npm: + +```bash +npm view @defra/interactive-map version dist-tags +npm view @defra/interactive-map-provider-maplibre version dist-tags +npm view @defra/interactive-map-plugin-datasets dist-tags # expect a beta tag +``` + +--- + +## Troubleshooting + +**A release failed partway through.** The publish loop uses `set -e` and is **not +resumable**: if it dies after publishing some packages, the rest are missing, and +re-running the release fails immediately because the already-published packages +(and core) can't be republished at the same version. Recovery options: + +- Publish the missing packages by hand at the same version (requires appropriate + npm auth), **or** +- Cut a new patch release (e.g. `v1.4.1`) so every package re-publishes cleanly + in lockstep. This is usually the simpler path. + +**A new package failed to publish with an auth error.** It almost certainly skipped +the [one-time bootstrap](#one-time-bootstrap-new-packages-only) — it was never +seeded, or its trusted publisher isn't configured. Complete both steps, then +re-release. + +**Version rejected.** The new version isn't greater than the latest published in +that major line. Bump higher. diff --git a/assets/templates/add-polygons.njk b/assets/templates/add-polygons.njk index d8a1bed0e..a3aee3051 100644 --- a/assets/templates/add-polygons.njk +++ b/assets/templates/add-polygons.njk @@ -7,7 +7,7 @@ {% block head %} - + {% endblock %} {% block bodyStart %} @@ -39,7 +39,7 @@ - + - + - + - + - + diff --git a/docs/examples/add-marker-with-panel.mdx b/docs/examples/add-marker-with-panel.mdx index f00de81bb..f2c04a36e 100644 --- a/docs/examples/add-marker-with-panel.mdx +++ b/docs/examples/add-marker-with-panel.mdx @@ -13,8 +13,8 @@ Add markers to the map and allow users to select them. Selecting a marker fires language: 'js', code: ` import InteractiveMap from '@defra/interactive-map' - import maplibreProvider from '@defra/interactive-map/providers/maplibre' - import createInteractPlugin from '@defra/interactive-map/plugins/interact' + import maplibreProvider from '@defra/interactive-map-provider-maplibre' + import createInteractPlugin from '@defra/interactive-map-plugin-interact' const interactPlugin = createInteractPlugin({ deselectOnClickOutside: true diff --git a/docs/examples/add-polygons.mdx b/docs/examples/add-polygons.mdx index e06e2399a..bcec5edb0 100644 --- a/docs/examples/add-polygons.mdx +++ b/docs/examples/add-polygons.mdx @@ -13,8 +13,8 @@ Use the datasets plugin to overlay GeoJSON polygon data on your map. This exampl language: 'js', code: ` import InteractiveMap from '@defra/interactive-map' - import maplibreProvider from '@defra/interactive-map/providers/maplibre' - import createDatasetsPlugin from '@defra/interactive-map/plugins/datasets' + import maplibreProvider from '@defra/interactive-map-provider-maplibre' + import createDatasetsPlugin from '@defra/interactive-map-plugin-datasets' // GeoJSON can also be loaded from a URL; use the tiles property for vector tile sources const geojson = { diff --git a/docs/examples/add-symbols.mdx b/docs/examples/add-symbols.mdx index a045c2796..2760849ed 100644 --- a/docs/examples/add-symbols.mdx +++ b/docs/examples/add-symbols.mdx @@ -13,8 +13,8 @@ Use the datasets plugin to overlay GeoJSON data on your map. Each dataset can co language: 'js', code: ` import InteractiveMap from '@defra/interactive-map' - import maplibreProvider from '@defra/interactive-map/providers/maplibre' - import createDatasetsPlugin from '@defra/interactive-map/plugins/datasets' + import maplibreProvider from '@defra/interactive-map-provider-maplibre' + import createDatasetsPlugin from '@defra/interactive-map-plugin-datasets' const symbolGraphic = 'M3 15H1V1h2v2h2V1h2v5h2V4h2v2h2V4h2v11H6V9H3v6z' diff --git a/docs/examples/basic-map.mdx b/docs/examples/basic-map.mdx index 7ae57f7b0..6dbc988be 100644 --- a/docs/examples/basic-map.mdx +++ b/docs/examples/basic-map.mdx @@ -13,7 +13,7 @@ Embed an interactive map directly on the page, allowing users to explore and int language: 'js', code: ` import InteractiveMap from '@defra/interactive-map' - import maplibreProvider from '@defra/interactive-map/providers/maplibre' + import maplibreProvider from '@defra/interactive-map-provider-maplibre' new InteractiveMap('my-map', { behaviour: 'inline', diff --git a/docs/examples/button-map.mdx b/docs/examples/button-map.mdx index 17006058f..3f4daf938 100644 --- a/docs/examples/button-map.mdx +++ b/docs/examples/button-map.mdx @@ -13,7 +13,7 @@ Trigger the map to show on button press, allowing users to access the map when n language: 'js', code: ` import InteractiveMap from '@defra/interactive-map' - import maplibreProvider from '@defra/interactive-map/providers/maplibre' + import maplibreProvider from '@defra/interactive-map-provider-maplibre' new InteractiveMap('my-map', { behaviour: 'buttonFirst', diff --git a/docs/examples/draw-tools.mdx b/docs/examples/draw-tools.mdx index 0463f04a1..14450b95d 100644 --- a/docs/examples/draw-tools.mdx +++ b/docs/examples/draw-tools.mdx @@ -17,9 +17,9 @@ The draw plugin (`draw-ml`) is currently in beta. language: 'js', code: ` import InteractiveMap from '@defra/interactive-map' - import maplibreProvider from '@defra/interactive-map/providers/maplibre' - import createInteractPlugin from '@defra/interactive-map/plugins/interact' - import createDrawPlugin from '@defra/interactive-map/plugins/draw-ml' + import maplibreProvider from '@defra/interactive-map-provider-maplibre' + import createInteractPlugin from '@defra/interactive-map-plugin-interact' + import createDrawPlugin from '@defra/interactive-map-plugin-draw-ml' const DRAW_LAYERS = ['fill-inactive.cold', 'stroke-inactive.cold'] diff --git a/docs/examples/place-marker.mdx b/docs/examples/place-marker.mdx index a4a44dca9..fd04ae49c 100644 --- a/docs/examples/place-marker.mdx +++ b/docs/examples/place-marker.mdx @@ -18,8 +18,8 @@ Two patterns work together in this example: language: 'js', code: ` import InteractiveMap from '@defra/interactive-map' - import maplibreProvider from '@defra/interactive-map/providers/maplibre' - import createInteractPlugin from '@defra/interactive-map/plugins/interact' + import maplibreProvider from '@defra/interactive-map-provider-maplibre' + import createInteractPlugin from '@defra/interactive-map-plugin-interact' const interactPlugin = createInteractPlugin({ interactionModes: ['placeMarker'] diff --git a/docs/examples/search-control.mdx b/docs/examples/search-control.mdx index b7d2bcc18..965813bf6 100644 --- a/docs/examples/search-control.mdx +++ b/docs/examples/search-control.mdx @@ -17,8 +17,8 @@ The live demo below uses Nominatim (no API key required) — the code example us language: 'js', code: ` import InteractiveMap from '@defra/interactive-map' - import maplibreProvider from '@defra/interactive-map/providers/maplibre' - import createSearchPlugin from '@defra/interactive-map/plugins/search' + import maplibreProvider from '@defra/interactive-map-provider-maplibre' + import createSearchPlugin from '@defra/interactive-map-plugin-search' const searchPlugin = createSearchPlugin({ osNamesURL: 'https://api.os.uk/search/names/v1/find?query={query}&key=YOUR_API_KEY', diff --git a/docs/examples/select-feature.mdx b/docs/examples/select-feature.mdx index 4dc03ef4e..afd40365a 100644 --- a/docs/examples/select-feature.mdx +++ b/docs/examples/select-feature.mdx @@ -17,8 +17,8 @@ The layer ID used here (`buildings 3D`) is specific to the OS Open Zoomstack out language: 'js', code: ` import InteractiveMap from '@defra/interactive-map' - import maplibreProvider from '@defra/interactive-map/providers/maplibre' - import createInteractPlugin from '@defra/interactive-map/plugins/interact' + import maplibreProvider from '@defra/interactive-map-provider-maplibre' + import createInteractPlugin from '@defra/interactive-map-plugin-interact' const PANEL_ID = 'building-info' diff --git a/docs/examples/style-switcher.mdx b/docs/examples/style-switcher.mdx index 24a0119cb..83cad3ee5 100644 --- a/docs/examples/style-switcher.mdx +++ b/docs/examples/style-switcher.mdx @@ -17,8 +17,8 @@ The live demo uses OS Open Zoomstack tiles from OS Labs, which do not require an language: 'js', code: ` import InteractiveMap from '@defra/interactive-map' - import maplibreProvider from '@defra/interactive-map/providers/maplibre' - import createMapStylesPlugin from '@defra/interactive-map/plugins/map-styles' + import maplibreProvider from '@defra/interactive-map-provider-maplibre' + import createMapStylesPlugin from '@defra/interactive-map-plugin-map-styles' const attribution = 'Contains OS data © Crown copyright and database rights 2025' diff --git a/docs/examples/toggle-marker-label.mdx b/docs/examples/toggle-marker-label.mdx index b8ea6bcab..bedc3c34e 100644 --- a/docs/examples/toggle-marker-label.mdx +++ b/docs/examples/toggle-marker-label.mdx @@ -13,8 +13,8 @@ Add a marker with a hidden label, then use the interact plugin to show the label language: 'js', code: ` import InteractiveMap from '@defra/interactive-map' - import maplibreProvider from '@defra/interactive-map/providers/maplibre' - import createInteractPlugin from '@defra/interactive-map/plugins/interact' + import maplibreProvider from '@defra/interactive-map-provider-maplibre' + import createInteractPlugin from '@defra/interactive-map-plugin-interact' const interactPlugin = createInteractPlugin({ deselectOnClickOutside: true diff --git a/docs/getting-started.md b/docs/getting-started.md index 97c0826f4..0f1a0e97f 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -2,8 +2,10 @@ ## Installation +Install the core package plus a map provider package (see [Manual setup](#manual-setup) below for choosing a provider): + ```shell -npm install @defra/interactive-map@x.y.z-alpha +npm install @defra/interactive-map@x.y.z-alpha @defra/interactive-map-provider-maplibre@x.y.z-alpha ``` > [!NOTE] @@ -28,20 +30,20 @@ The map component also requires a **map provider** — a separate library that h ### MapLibre provider (recommended) -**ESM:** `maplibre-gl` is a peer dependency, install it separately: +**ESM:** install the provider package. `maplibre-gl` is a required peer dependency of the provider, install it alongside: ```shell -npm install maplibre-gl +npm install @defra/interactive-map-provider-maplibre maplibre-gl ``` **UMD:** `maplibre-gl` is bundled — no separate install needed. ### ESRI provider (optional) -The ESRI provider is available for ESM projects only. Install `@arcgis/core` separately: +The ESRI provider is available for ESM projects only and is published under the `beta` dist-tag. `@arcgis/core` is a required peer dependency of the provider: ```shell -npm install @arcgis/core +npm install @defra/interactive-map-provider-esri@beta @arcgis/core ``` ## Basic usage @@ -54,7 +56,7 @@ npm install @arcgis/core ```js import InteractiveMap from '@defra/interactive-map' -import maplibreProvider from '@defra/interactive-map/providers/maplibre' +import maplibreProvider from '@defra/interactive-map-provider-maplibre' import '@defra/interactive-map/css' @@ -116,8 +118,8 @@ const interactiveMap = new InteractiveMap('map', { **ESM** — add the plugin import and its CSS alongside your existing core imports, then pass it to `plugins`: ```js -import createInteractPlugin from '@defra/interactive-map/plugins/interact' -import '@defra/interactive-map/plugins/interact/css' +import createInteractPlugin from '@defra/interactive-map-plugin-interact' +import '@defra/interactive-map-plugin-interact/css' const interactiveMap = new InteractiveMap('map', { // ...your existing options diff --git a/docs/plugins/datasets.md b/docs/plugins/datasets.md index f546cbb2b..71ab67d94 100644 --- a/docs/plugins/datasets.md +++ b/docs/plugins/datasets.md @@ -5,7 +5,7 @@ The datasets plugin renders GeoJSON and vector tile datasets on the map, with su ## ESM usage ```js -import createDatasetsPlugin from '@defra/interactive-map/plugins/datasets' +import createDatasetsPlugin from '@defra/interactive-map-plugin-datasets' const datasetsPlugin = createDatasetsPlugin({ datasets: [ @@ -33,10 +33,10 @@ const interactiveMap = new InteractiveMap({ ## UMD usage -Copy the entire `plugins/beta/datasets/dist/umd/` directory to `/your-assets-path/plugins/beta/datasets/umd/`. The plugin uses dynamic imports, so all files in the directory must be served from the same location. Then add the script tag: +Copy the entire `plugins/datasets/dist/umd/` directory to `/your-assets-path/plugins/datasets/umd/`. The plugin uses dynamic imports, so all files in the directory must be served from the same location. Then add the script tag: ```html - + ``` ```js @@ -68,7 +68,7 @@ const interactiveMap = new defra.InteractiveMap('map', { > [!NOTE] > **GOV.UK Prototype Kit** — skip the copy step. All files are served automatically. Use this path instead: > ```html -> +> > ``` ## Options diff --git a/docs/plugins/interact.md b/docs/plugins/interact.md index 352b48610..69e2297e3 100644 --- a/docs/plugins/interact.md +++ b/docs/plugins/interact.md @@ -5,7 +5,7 @@ The interact plugin provides a unified way to handle user interactions for selec ## Usage ```js -import createInteractPlugin from '@defra/interactive-map/plugins/interact' +import createInteractPlugin from '@defra/interactive-map-plugin-interact' const interactPlugin = createInteractPlugin({ interactionModes: ['selectMarker', 'selectFeature'], diff --git a/docs/plugins/map-styles.md b/docs/plugins/map-styles.md index 68ff7b0c6..b6de21711 100644 --- a/docs/plugins/map-styles.md +++ b/docs/plugins/map-styles.md @@ -5,7 +5,7 @@ Adds a UI control for switching between basemap styles and, where supported by t ## Usage ```js -import createMapStylesPlugin from '@defra/interactive-map/plugins/map-styles' +import createMapStylesPlugin from '@defra/interactive-map-plugin-map-styles' const mapStylesPlugin = createMapStylesPlugin({ mapStyles: [ diff --git a/docs/plugins/scale-bar.md b/docs/plugins/scale-bar.md index 0a7227e6f..0e97d1988 100644 --- a/docs/plugins/scale-bar.md +++ b/docs/plugins/scale-bar.md @@ -5,7 +5,7 @@ Displays the current map scale. The scale bar automatically updates as the user ## Usage ```js -import createScaleBarPlugin from '@defra/interactive-map/plugins/scale-bar' +import createScaleBarPlugin from '@defra/interactive-map-plugin-scale-bar' const scaleBarPlugin = createScaleBarPlugin({ units: 'metric' diff --git a/docs/plugins/search.md b/docs/plugins/search.md index e450b9f83..b979bead7 100644 --- a/docs/plugins/search.md +++ b/docs/plugins/search.md @@ -5,7 +5,7 @@ Location search with autocomplete. Supports the OS Names API out of the box, and ## Usage ```js -import searchPlugin from '@defra/interactive-map/plugins/search' +import searchPlugin from '@defra/interactive-map-plugin-search' const interactiveMap = new InteractiveMap({ plugins: [ diff --git a/govuk-prototype-kit.config.json b/govuk-prototype-kit.config.json index d648d9f3a..1f583f29b 100644 --- a/govuk-prototype-kit.config.json +++ b/govuk-prototype-kit.config.json @@ -61,14 +61,14 @@ "/dist/css/", "/dist/umd/", "/providers/maplibre/dist", - "/providers/beta/open-names/dist", - "/plugins/beta/datasets/dist", + "/providers/open-names/dist", + "/plugins/datasets/dist", "/plugins/interact/dist", - "/plugins/beta/map-styles/dist", - "/plugins/beta/scale-bar/dist", + "/plugins/map-styles/dist", + "/plugins/scale-bar/dist", "/plugins/search/dist", - "/plugins/beta/use-location/dist", - "/plugins/beta/draw-ml/dist", - "/plugins/beta/frame/dist" + "/plugins/use-location/dist", + "/plugins/draw-ml/dist", + "/plugins/frame/dist" ] } \ No newline at end of file diff --git a/jest.config.mjs b/jest.config.mjs index a33d594ec..6a1aee238 100755 --- a/jest.config.mjs +++ b/jest.config.mjs @@ -26,14 +26,16 @@ export default { '/coverage', '/demo', '/src/test-utils.js', - '/plugins/beta/datasets/', - '/providers/beta/', - '/plugins/beta/draw-es', - '/plugins/beta/draw-ml', - '/plugins/beta/frame', - '/plugins/beta/map-styles', - '/plugins/beta/scale-bar', - '/plugins/beta/use-location', + '/plugins/datasets/', + '/providers/esri/', + '/providers/openlayers/', + '/providers/open-names/', + '/plugins/draw-es/', + '/plugins/draw-ml/', + '/plugins/frame/', + '/plugins/map-styles/', + '/plugins/scale-bar/', + '/plugins/use-location/', '/.docusaurus', '/build/assets/js', '/dist/' diff --git a/package-lock.json b/package-lock.json index 6684c5ecf..cd4f28a88 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,10 @@ "": { "name": "@defra/interactive-map", "version": "0.0.0-development", + "workspaces": [ + "providers/*", + "plugins/*" + ], "dependencies": { "@babel/runtime": "^7.28.6", "@turf/area": "^7.2.0", @@ -21,7 +25,6 @@ "@turf/polygon-to-line": "^7.3.3", "accessible-autocomplete": "^3.0.1", "govuk-frontend": "^5.13.0", - "maplibre-gl": "^5.23.0", "polygon-splitter": "^0.0.11", "preact": "^10.27.2", "tslib": "^2.8.1" @@ -66,6 +69,7 @@ "jest-expect-message": "^1.1.3", "likec4": "^1.50.0", "mapbox-gl-snap": "^1.1.9", + "maplibre-gl": "^5.23.0", "mini-css-extract-plugin": "^2.9.2", "node-fetch": "^3.3.2", "npm-run-all": "^4.1.5", @@ -92,22 +96,6 @@ "webpack-dev-server": "^5.2.2", "webpack-merge": "^6.0.1", "webpack-remove-empty-scripts": "^1.1.1" - }, - "peerDependencies": { - "@arcgis/core": "^5.0.9", - "ol": "^10.9.0", - "proj4": "^2.20.8" - }, - "peerDependenciesMeta": { - "@arcgis/core": { - "optional": true - }, - "ol": { - "optional": true - }, - "proj4": { - "optional": true - } } }, "../../docusaurus-govuk": { @@ -3486,6 +3474,62 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@defra/interactive-map-plugin-datasets": { + "resolved": "plugins/datasets", + "link": true + }, + "node_modules/@defra/interactive-map-plugin-draw-es": { + "resolved": "plugins/draw-es", + "link": true + }, + "node_modules/@defra/interactive-map-plugin-draw-ml": { + "resolved": "plugins/draw-ml", + "link": true + }, + "node_modules/@defra/interactive-map-plugin-draw-ol": { + "resolved": "plugins/draw-ol", + "link": true + }, + "node_modules/@defra/interactive-map-plugin-frame": { + "resolved": "plugins/frame", + "link": true + }, + "node_modules/@defra/interactive-map-plugin-interact": { + "resolved": "plugins/interact", + "link": true + }, + "node_modules/@defra/interactive-map-plugin-map-styles": { + "resolved": "plugins/map-styles", + "link": true + }, + "node_modules/@defra/interactive-map-plugin-scale-bar": { + "resolved": "plugins/scale-bar", + "link": true + }, + "node_modules/@defra/interactive-map-plugin-search": { + "resolved": "plugins/search", + "link": true + }, + "node_modules/@defra/interactive-map-plugin-use-location": { + "resolved": "plugins/use-location", + "link": true + }, + "node_modules/@defra/interactive-map-provider-esri": { + "resolved": "providers/esri", + "link": true + }, + "node_modules/@defra/interactive-map-provider-maplibre": { + "resolved": "providers/maplibre", + "link": true + }, + "node_modules/@defra/interactive-map-provider-open-names": { + "resolved": "providers/open-names", + "link": true + }, + "node_modules/@defra/interactive-map-provider-openlayers": { + "resolved": "providers/openlayers", + "link": true + }, "node_modules/@discoveryjs/json-ext": { "version": "0.5.7", "dev": true, @@ -6224,6 +6268,7 @@ }, "node_modules/@mapbox/jsonlint-lines-primitives": { "version": "2.0.2", + "dev": true, "engines": { "node": ">= 0.6" } @@ -6251,18 +6296,22 @@ }, "node_modules/@mapbox/point-geometry": { "version": "1.1.0", + "dev": true, "license": "ISC" }, "node_modules/@mapbox/tiny-sdf": { "version": "2.0.7", + "dev": true, "license": "BSD-2-Clause" }, "node_modules/@mapbox/unitbezier": { "version": "0.0.1", + "dev": true, "license": "BSD-2-Clause" }, "node_modules/@mapbox/vector-tile": { "version": "2.0.4", + "dev": true, "license": "BSD-3-Clause", "dependencies": { "@mapbox/point-geometry": "~1.1.0", @@ -6272,6 +6321,7 @@ }, "node_modules/@mapbox/whoots-js": { "version": "3.1.0", + "dev": true, "license": "ISC", "engines": { "node": ">=6.0.0" @@ -6281,6 +6331,7 @@ "version": "6.1.0", "resolved": "https://registry.npmjs.org/@maplibre/geojson-vt/-/geojson-vt-6.1.0.tgz", "integrity": "sha512-2eIY4gZxeKIVOZVNkAMb+5NgXhgsMQpOveTQAvnp53LYqHGJZDidk7Ew0Tged9PThidpbS+NFTh0g4zivhPDzQ==", + "dev": true, "license": "ISC", "dependencies": { "kdbush": "^4.0.2" @@ -6290,6 +6341,7 @@ "version": "24.8.1", "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-24.8.1.tgz", "integrity": "sha512-zxa92qF96ZNojLxeAjnaRpjVCy+swoUNJvDhtpC90k7u5F0TMr4GmvNqMKvYrMoPB8d7gRSXbMG1hBbmgESIsw==", + "dev": true, "license": "ISC", "dependencies": { "@mapbox/jsonlint-lines-primitives": "~2.0.2", @@ -6310,6 +6362,7 @@ "version": "1.1.8", "resolved": "https://registry.npmjs.org/@maplibre/mlt/-/mlt-1.1.8.tgz", "integrity": "sha512-8vtfYGidr1rNkv5IwIoU2lfe3Oy+Wa8HluzQYcQi9cveU9K3pweAal/poQj4GJ0K/EW4bTQp2wVAs09g2yDRZg==", + "dev": true, "license": "(MIT OR Apache-2.0)", "dependencies": { "@mapbox/point-geometry": "^1.1.0" @@ -6319,6 +6372,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/@maplibre/vt-pbf/-/vt-pbf-4.3.0.tgz", "integrity": "sha512-jIvp8F5hQCcreqOOpEt42TJMUlsrEcpf/kI1T2v85YrQRV6PPXUcEXUg5karKtH6oh47XJZ4kHu56pUkOuqA7w==", + "dev": true, "license": "MIT", "dependencies": { "@mapbox/point-geometry": "^1.1.0", @@ -6334,6 +6388,7 @@ "version": "5.0.4", "resolved": "https://registry.npmjs.org/@maplibre/geojson-vt/-/geojson-vt-5.0.4.tgz", "integrity": "sha512-KGg9sma45S+stfH9vPCJk1J0lSDLWZgCT9Y8u8qWZJyjFlP8MNP1WGTxIMYJZjDvVT3PDn05kN1C95Sut1HpgQ==", + "dev": true, "license": "ISC" }, "node_modules/@mdx-js/mdx": { @@ -10999,6 +11054,7 @@ }, "node_modules/@types/supercluster": { "version": "7.1.3", + "dev": true, "license": "MIT", "dependencies": { "@types/geojson": "*" @@ -15109,6 +15165,7 @@ }, "node_modules/earcut": { "version": "3.0.2", + "dev": true, "license": "ISC" }, "node_modules/eastasianwidth": { @@ -17303,6 +17360,7 @@ }, "node_modules/gl-matrix": { "version": "3.4.4", + "dev": true, "license": "MIT" }, "node_modules/glob": { @@ -20346,6 +20404,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/json-stringify-pretty-compact/-/json-stringify-pretty-compact-4.0.0.tgz", "integrity": "sha512-3CNZ2DnrpByG9Nqj6Xo8vqbjT4F6N+tb4Gb28ESAZjYZ5yqvmc56J+/kuIwkaAMOyblTQhUW7PxMkUb8Q36N3Q==", + "dev": true, "license": "MIT" }, "node_modules/json5": { @@ -20386,6 +20445,7 @@ }, "node_modules/kdbush": { "version": "4.0.2", + "dev": true, "license": "ISC" }, "node_modules/keyv": { @@ -21298,6 +21358,7 @@ "version": "5.23.0", "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-5.23.0.tgz", "integrity": "sha512-aou8YBNFS8uVtDWFWt0W/6oorfl18wt+oIA8fnXk1kivjkbtXi9gGrQvflTpwrR3hG13aWdIdbYWeN0NFMV7ag==", + "dev": true, "license": "BSD-3-Clause", "dependencies": { "@mapbox/jsonlint-lines-primitives": "^2.0.2", @@ -23921,6 +23982,7 @@ }, "node_modules/minimist": { "version": "1.2.8", + "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -24010,6 +24072,7 @@ }, "node_modules/murmurhash-js": { "version": "1.0.0", + "dev": true, "license": "MIT" }, "node_modules/nano-spawn": { @@ -25114,6 +25177,7 @@ }, "node_modules/pbf": { "version": "4.0.1", + "dev": true, "license": "BSD-3-Clause", "dependencies": { "resolve-protobuf-schema": "^2.1.0" @@ -27134,6 +27198,7 @@ }, "node_modules/potpack": { "version": "2.1.0", + "dev": true, "license": "ISC" }, "node_modules/powershell-utils": { @@ -27302,6 +27367,7 @@ "version": "3.6.1", "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.1.tgz", "integrity": "sha512-VG2K63Igkiv9p76tk1lilczEK1cT+kCjKtkdhw1dQZV3k3IXJbd3o6Ho8b9zJZaHSnT2hKe4I+ObmX9w6m5SmQ==", + "dev": true, "license": "MIT" }, "node_modules/proxy-addr": { @@ -27445,6 +27511,7 @@ }, "node_modules/quickselect": { "version": "3.0.0", + "dev": true, "license": "ISC" }, "node_modules/range-parser": { @@ -28226,6 +28293,7 @@ }, "node_modules/resolve-protobuf-schema": { "version": "2.1.0", + "dev": true, "license": "MIT", "dependencies": { "protocol-buffers-schema": "^3.3.1" @@ -29330,6 +29398,7 @@ }, "node_modules/rw": { "version": "1.3.3", + "dev": true, "license": "BSD-3-Clause" }, "node_modules/safe-array-concat": { @@ -30811,6 +30880,7 @@ }, "node_modules/supercluster": { "version": "8.0.1", + "dev": true, "license": "ISC", "dependencies": { "kdbush": "^4.0.2" @@ -31258,6 +31328,7 @@ }, "node_modules/tinyqueue": { "version": "3.0.0", + "dev": true, "license": "ISC" }, "node_modules/tldts": { @@ -33423,6 +33494,163 @@ "type": "github", "url": "https://github.com/sponsors/wooorm" } + }, + "plugins/datasets": { + "name": "@defra/interactive-map-plugin-datasets", + "version": "0.0.0-development", + "dependencies": { + "@babel/runtime": "^7.28.6", + "preact": "^10.27.2" + }, + "peerDependencies": { + "@defra/interactive-map": "*" + } + }, + "plugins/draw-es": { + "name": "@defra/interactive-map-plugin-draw-es", + "version": "0.0.0-development", + "dependencies": { + "@babel/runtime": "^7.28.6", + "preact": "^10.27.2" + }, + "peerDependencies": { + "@arcgis/core": "^5.0.9", + "@defra/interactive-map": "*" + } + }, + "plugins/draw-ml": { + "name": "@defra/interactive-map-plugin-draw-ml", + "version": "0.0.0-development", + "dependencies": { + "@babel/runtime": "^7.28.6", + "preact": "^10.27.2" + }, + "peerDependencies": { + "@defra/interactive-map": "*", + "maplibre-gl": "^5.23.0" + } + }, + "plugins/draw-ol": { + "name": "@defra/interactive-map-plugin-draw-ol", + "version": "0.0.0-development", + "dependencies": { + "@babel/runtime": "^7.28.6", + "preact": "^10.27.2" + }, + "peerDependencies": { + "@defra/interactive-map": "*", + "ol": "^10.9.0" + } + }, + "plugins/frame": { + "name": "@defra/interactive-map-plugin-frame", + "version": "0.0.0-development", + "dependencies": { + "@babel/runtime": "^7.28.6", + "preact": "^10.27.2" + }, + "peerDependencies": { + "@defra/interactive-map": "*" + } + }, + "plugins/interact": { + "name": "@defra/interactive-map-plugin-interact", + "version": "0.0.0-development", + "dependencies": { + "@babel/runtime": "^7.28.6", + "preact": "^10.27.2" + }, + "peerDependencies": { + "@defra/interactive-map": "*" + } + }, + "plugins/map-styles": { + "name": "@defra/interactive-map-plugin-map-styles", + "version": "0.0.0-development", + "dependencies": { + "@babel/runtime": "^7.28.6", + "preact": "^10.27.2" + }, + "peerDependencies": { + "@defra/interactive-map": "*" + } + }, + "plugins/scale-bar": { + "name": "@defra/interactive-map-plugin-scale-bar", + "version": "0.0.0-development", + "dependencies": { + "@babel/runtime": "^7.28.6", + "preact": "^10.27.2" + }, + "peerDependencies": { + "@defra/interactive-map": "*" + } + }, + "plugins/search": { + "name": "@defra/interactive-map-plugin-search", + "version": "0.0.0-development", + "dependencies": { + "@babel/runtime": "^7.28.6", + "preact": "^10.27.2" + }, + "peerDependencies": { + "@defra/interactive-map": "*" + } + }, + "plugins/use-location": { + "name": "@defra/interactive-map-plugin-use-location", + "version": "0.0.0-development", + "dependencies": { + "@babel/runtime": "^7.28.6", + "preact": "^10.27.2" + }, + "peerDependencies": { + "@defra/interactive-map": "*" + } + }, + "providers/esri": { + "name": "@defra/interactive-map-provider-esri", + "version": "0.0.0-development", + "dependencies": { + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@arcgis/core": "^5.0.9", + "@defra/interactive-map": "*" + } + }, + "providers/maplibre": { + "name": "@defra/interactive-map-provider-maplibre", + "version": "0.0.0-development", + "dependencies": { + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*", + "maplibre-gl": "^5.23.0" + } + }, + "providers/open-names": { + "name": "@defra/interactive-map-provider-open-names", + "version": "0.0.0-development", + "dependencies": { + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*" + } + }, + "providers/openlayers": { + "name": "@defra/interactive-map-provider-openlayers", + "version": "0.0.0-development", + "dependencies": { + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*", + "ol": "^10.9.0", + "proj4": "^2.20.8" + } } } } diff --git a/package.json b/package.json index 3c5a611fd..fd82c9260 100755 --- a/package.json +++ b/package.json @@ -6,6 +6,10 @@ "type": "git", "url": "https://github.com/DEFRA/interactive-map" }, + "workspaces": [ + "providers/*", + "plugins/*" + ], "main": "dist/umd/index.js", "module": "dist/esm/index.js", "exports": { @@ -13,67 +17,8 @@ "import": "./dist/esm/index.js", "require": "./dist/umd/index.js" }, - "./providers/maplibre": { - "import": "./providers/maplibre/dist/esm/index.js", - "require": "./providers/maplibre/dist/umd/index.js" - }, - "./providers/open-names": { - "import": "./providers/beta/open-names/dist/esm/index.js", - "require": "./providers/beta/open-names/dist/umd/index.js" - }, - "./providers/esri": { - "import": "./providers/beta/esri/dist/esm/index.js" - }, - "./providers/openlayers": { - "import": "./providers/beta/openlayers/dist/esm/index.js", - "require": "./providers/beta/openlayers/dist/umd/index.js" - }, - "./plugins/scale-bar": { - "import": "./plugins/beta/scale-bar/dist/esm/index.js", - "require": "./plugins/beta/scale-bar/dist/umd/index.js" - }, - "./plugins/use-location": { - "import": "./plugins/beta/use-location/dist/esm/index.js", - "require": "./plugins/beta/use-location/dist/umd/index.js" - }, - "./plugins/search": { - "import": "./plugins/search/dist/esm/index.js", - "require": "./plugins/search/dist/umd/index.js" - }, - "./plugins/interact": { - "import": "./plugins/interact/dist/esm/index.js", - "require": "./plugins/interact/dist/umd/index.js" - }, - "./plugins/datasets": { - "import": "./plugins/beta/datasets/dist/esm/index.js" - }, - "./plugins/datasets/adapters/maplibre": { - "import": "./plugins/beta/datasets/dist/adapters/maplibre/esm/index.js" - }, - "./plugins/map-styles": { - "import": "./plugins/beta/map-styles/dist/esm/index.js", - "require": "./plugins/beta/map-styles/dist/umd/index.js" - }, - "./plugins/draw-ml": { - "import": "./plugins/beta/draw-ml/dist/esm/index.js", - "require": "./plugins/beta/draw-ml/dist/umd/index.js" - }, - "./plugins/draw-es": { - "import": "./plugins/beta/draw-es/dist/esm/index.js" - }, - "./plugins/frame": { - "import": "./plugins/beta/frame/dist/esm/index.js", - "require": "./plugins/beta/frame/dist/umd/index.js" - }, "./css": "./dist/css/index.css", - "./plugins/draw-ml/css": "./plugins/beta/draw-ml/dist/css/index.css", - "./plugins/scale-bar/css": "./plugins/beta/scale-bar/dist/css/index.css", - "./plugins/datasets/css": "./plugins/beta/datasets/dist/css/index.css", - "./plugins/frame/css": "./plugins/beta/frame/dist/css/index.css", - "./plugins/map-styles/css": "./plugins/beta/map-styles/dist/css/index.css", - "./plugins/search/css": "./plugins/search/dist/css/index.css", - "./plugins/interact/css": "./plugins/interact/dist/css/index.css", - "./providers/esri/css": "./providers/beta/esri/dist/css/index.css" + "./package.json": "./package.json" }, "type": "module", "sideEffects": [ @@ -119,22 +64,6 @@ "node_modules" ] }, - "peerDependencies": { - "@arcgis/core": "^5.0.9", - "ol": "^10.9.0", - "proj4": "^2.20.8" - }, - "peerDependenciesMeta": { - "@arcgis/core": { - "optional": true - }, - "ol": { - "optional": true - }, - "proj4": { - "optional": true - } - }, "devDependencies": { "@arcgis/core": "^5.0.9", "@babel/core": "^7.28.0", @@ -175,6 +104,7 @@ "jest-expect-message": "^1.1.3", "likec4": "^1.50.0", "mapbox-gl-snap": "^1.1.9", + "maplibre-gl": "^5.23.0", "mini-css-extract-plugin": "^2.9.2", "node-fetch": "^3.3.2", "npm-run-all": "^4.1.5", @@ -235,7 +165,6 @@ "@turf/polygon-to-line": "^7.3.3", "accessible-autocomplete": "^3.0.1", "govuk-frontend": "^5.13.0", - "maplibre-gl": "^5.23.0", "polygon-splitter": "^0.0.11", "preact": "^10.27.2", "tslib": "^2.8.1" diff --git a/plugins/beta/frame/package.json b/plugins/beta/frame/package.json deleted file mode 100644 index 3ef0c7785..000000000 --- a/plugins/beta/frame/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "@defra/frame-plugin", - "version": "1.0.0-alpha.1", - "main": "dist/umd/index.js", - "module": "dist/esm/index.js", - "exports": { - "import": "./dist/esm/index.js", - "require": "./dist/umd/index.js" - }, - "type": "module", - "peerDependencies": { - "react": "^19.2.0", - "react-dom": "^19.2.0", - "preact": "^10.27.0" - }, - "peerDependenciesMeta": { - "react": { "optional": true }, - "react-dom": { "optional": true } - }, - "scripts": { - "build:umd": "webpack --config ../../../webpack.umd.js --mode production", - "build:esm": "webpack --config ../../../webpack.esm.mjs --mode production", - "build": "npm run build:umd && npm run build:esm", - "clean": "rm -rf dist" - }, - "devDependencies": {}, - "dependencies": {} -} diff --git a/plugins/beta/scale-bar/package.json b/plugins/beta/scale-bar/package.json deleted file mode 100644 index f054c8c54..000000000 --- a/plugins/beta/scale-bar/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "@defra/scale-bar-plugin", - "version": "1.0.0-alpha.1", - "main": "dist/umd/index.js", - "module": "dist/esm/index.js", - "exports": { - "import": "./dist/esm/index.js", - "require": "./dist/umd/index.js" - }, - "type": "module", - "peerDependencies": { - "react": "^19.2.0", - "react-dom": "^19.2.0", - "preact": "^10.27.0" - }, - "peerDependenciesMeta": { - "react": { "optional": true }, - "react-dom": { "optional": true } - }, - "scripts": { - "build:umd": "webpack --config ../../../webpack.umd.js --mode production", - "build:esm": "webpack --config ../../../webpack.esm.mjs --mode production", - "build": "npm run build:umd && npm run build:esm", - "clean": "rm -rf dist" - }, - "devDependencies": {}, - "dependencies": {} -} diff --git a/plugins/datasets/package.json b/plugins/datasets/package.json new file mode 100644 index 000000000..e6b514c53 --- /dev/null +++ b/plugins/datasets/package.json @@ -0,0 +1,32 @@ +{ + "name": "@defra/interactive-map-plugin-datasets", + "version": "0.0.0-development", + "description": "Datasets plugin for @defra/interactive-map", + "repository": { + "type": "git", + "url": "https://github.com/DEFRA/interactive-map", + "directory": "plugins/datasets" + }, + "module": "dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/esm/index.js" + }, + "./adapters/maplibre": { + "import": "./dist/adapters/maplibre/esm/index.js" + }, + "./css": "./dist/css/index.css" + }, + "type": "module", + "files": ["dist"], + "sideEffects": ["**/*.css", "**/*.scss"], + "publishConfig": { "tag": "beta" }, + "dependencies": { + "preact": "^10.27.2", + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*" + }, + "license": "" +} diff --git a/plugins/beta/datasets/src/adapters/loadLayerAdapter.js b/plugins/datasets/src/adapters/loadLayerAdapter.js similarity index 100% rename from plugins/beta/datasets/src/adapters/loadLayerAdapter.js rename to plugins/datasets/src/adapters/loadLayerAdapter.js diff --git a/plugins/datasets/src/adapters/maplibre/index.js b/plugins/datasets/src/adapters/maplibre/index.js new file mode 100644 index 000000000..d7053ef58 --- /dev/null +++ b/plugins/datasets/src/adapters/maplibre/index.js @@ -0,0 +1 @@ +export { default as maplibreLayerAdapter } from './maplibreLayerAdapter.js' diff --git a/plugins/beta/datasets/src/adapters/maplibre/layerBuilders.js b/plugins/datasets/src/adapters/maplibre/layerBuilders.js similarity index 96% rename from plugins/beta/datasets/src/adapters/maplibre/layerBuilders.js rename to plugins/datasets/src/adapters/maplibre/layerBuilders.js index f4c59a6c0..fba157634 100644 --- a/plugins/beta/datasets/src/adapters/maplibre/layerBuilders.js +++ b/plugins/datasets/src/adapters/maplibre/layerBuilders.js @@ -1,5 +1,5 @@ -import { getValueForStyle } from '../../../../../../src/utils/getValueForStyle.js' -import { getSymbolAnchor } from '../../../../../../src/utils/symbolUtils.js' +import { getValueForStyle } from '../../../../../src/utils/getValueForStyle.js' +import { getSymbolAnchor } from '../../../../../src/utils/symbolUtils.js' // ─── Fill layer ─────────────────────────────────────────────────────────────── diff --git a/plugins/beta/datasets/src/adapters/maplibre/maplibreLayerAdapter.js b/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.js similarity index 100% rename from plugins/beta/datasets/src/adapters/maplibre/maplibreLayerAdapter.js rename to plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.js diff --git a/plugins/beta/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js b/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js similarity index 99% rename from plugins/beta/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js rename to plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js index 247d1b54b..feeaf4ae2 100644 --- a/plugins/beta/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +++ b/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js @@ -1,8 +1,8 @@ import MaplibreLayerAdapter from './maplibreLayerAdapter.js' import { MapLibreDataset } from './registry/mapLibreDataset.js' import { datasetRegistry } from '../../registry/datasetRegistry.js' -import { symbolRegistry } from '../../../../../../src/services/symbolRegistry.js' -import { patternRegistry } from '../../../../../../src/services/patternRegistry.js' +import { symbolRegistry } from '../../../../../src/services/symbolRegistry.js' +import { patternRegistry } from '../../../../../src/services/patternRegistry.js' jest.mock('../../registry/datasetRegistry.js') diff --git a/plugins/beta/datasets/src/adapters/maplibre/registry/mapLibreDataset.js b/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.js similarity index 95% rename from plugins/beta/datasets/src/adapters/maplibre/registry/mapLibreDataset.js rename to plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.js index 0bd1e77db..6c7fc1172 100644 --- a/plugins/beta/datasets/src/adapters/maplibre/registry/mapLibreDataset.js +++ b/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.js @@ -1,7 +1,7 @@ import { Dataset } from '../../../registry/dataset.js' -import { hashString } from '../../../../../../../src/utils/patternUtils.js' -import { anchorToMaplibre } from '../../../../../../../providers/maplibre/src/utils/symbolImages.js' -import { logger } from '../../../../../../../src/services/logger.js' +import { hashString } from '../../../../../../src/utils/patternUtils.js' +import { anchorToMaplibre } from '../../../../../../providers/maplibre/src/utils/symbolImages.js' +import { logger } from '../../../../../../src/services/logger.js' const MAX_TILE_ZOOM = 22 export class MapLibreDataset extends Dataset { diff --git a/plugins/beta/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js b/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js similarity index 99% rename from plugins/beta/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js rename to plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js index d2a9c1cb3..b1ffac8e9 100644 --- a/plugins/beta/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js +++ b/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js @@ -1,10 +1,10 @@ import { MapLibreDataset } from './mapLibreDataset.js' import { datasetRegistry } from '../../../registry/datasetRegistry.js' -import { logger } from '../../../../../../../src/services/logger.js' +import { logger } from '../../../../../../src/services/logger.js' // Use the mock datasetRegistry with the demo datasets attached before each test // so we can test Dataset methods that depend on parent/sublayer relationships and styles jest.mock('../../../registry/datasetRegistry.js') -jest.mock('../../../../../../../src/services/logger.js', () => ({ +jest.mock('../../../../../../src/services/logger.js', () => ({ logger: { warn: jest.fn() } })) diff --git a/plugins/beta/datasets/src/api/addDataset.js b/plugins/datasets/src/api/addDataset.js similarity index 100% rename from plugins/beta/datasets/src/api/addDataset.js rename to plugins/datasets/src/api/addDataset.js diff --git a/plugins/beta/datasets/src/api/addDataset.test.js b/plugins/datasets/src/api/addDataset.test.js similarity index 100% rename from plugins/beta/datasets/src/api/addDataset.test.js rename to plugins/datasets/src/api/addDataset.test.js diff --git a/plugins/beta/datasets/src/api/getOpacity.js b/plugins/datasets/src/api/getOpacity.js similarity index 89% rename from plugins/beta/datasets/src/api/getOpacity.js rename to plugins/datasets/src/api/getOpacity.js index 53b9fb61b..58c9b1c15 100644 --- a/plugins/beta/datasets/src/api/getOpacity.js +++ b/plugins/datasets/src/api/getOpacity.js @@ -1,4 +1,4 @@ -import { logger } from '../../../../../src/services/logger.js' +import { logger } from '../../../../src/services/logger.js' import { datasetRegistry } from '../registry/datasetRegistry.js' export const getOpacity = ({ pluginState: { globals } }, options = {}) => { diff --git a/plugins/beta/datasets/src/api/getOpacity.test.js b/plugins/datasets/src/api/getOpacity.test.js similarity index 95% rename from plugins/beta/datasets/src/api/getOpacity.test.js rename to plugins/datasets/src/api/getOpacity.test.js index a1e943e0b..43e1286e3 100644 --- a/plugins/beta/datasets/src/api/getOpacity.test.js +++ b/plugins/datasets/src/api/getOpacity.test.js @@ -1,12 +1,12 @@ import { getOpacity } from './getOpacity.js' import { datasetRegistry } from '../registry/datasetRegistry.js' -import { logger } from '../../../../../src/services/logger.js' +import { logger } from '../../../../src/services/logger.js' jest.mock('../registry/datasetRegistry.js', () => ({ datasetRegistry: { getDataset: jest.fn() } })) -jest.mock('../../../../../src/services/logger.js', () => ({ +jest.mock('../../../../src/services/logger.js', () => ({ logger: { warn: jest.fn() } })) diff --git a/plugins/beta/datasets/src/api/getStyle.js b/plugins/datasets/src/api/getStyle.js similarity index 87% rename from plugins/beta/datasets/src/api/getStyle.js rename to plugins/datasets/src/api/getStyle.js index 0a6cd1c94..6ecfc39af 100644 --- a/plugins/beta/datasets/src/api/getStyle.js +++ b/plugins/datasets/src/api/getStyle.js @@ -1,4 +1,4 @@ -import { logger } from '../../../../../src/services/logger.js' +import { logger } from '../../../../src/services/logger.js' import { datasetRegistry } from '../registry/datasetRegistry.js' export const getStyle = ({ pluginState }, { datasetId, sublayerId } = {}) => { diff --git a/plugins/beta/datasets/src/api/getStyle.test.js b/plugins/datasets/src/api/getStyle.test.js similarity index 92% rename from plugins/beta/datasets/src/api/getStyle.test.js rename to plugins/datasets/src/api/getStyle.test.js index fc1b62327..3771cbdcc 100644 --- a/plugins/beta/datasets/src/api/getStyle.test.js +++ b/plugins/datasets/src/api/getStyle.test.js @@ -1,12 +1,12 @@ import { getStyle } from './getStyle.js' import { datasetRegistry } from '../registry/datasetRegistry.js' -import { logger } from '../../../../../src/services/logger.js' +import { logger } from '../../../../src/services/logger.js' jest.mock('../registry/datasetRegistry.js', () => ({ datasetRegistry: { getDataset: jest.fn() } })) -jest.mock('../../../../../src/services/logger.js', () => ({ +jest.mock('../../../../src/services/logger.js', () => ({ logger: { warn: jest.fn() } })) diff --git a/plugins/beta/datasets/src/api/removeDataset.js b/plugins/datasets/src/api/removeDataset.js similarity index 100% rename from plugins/beta/datasets/src/api/removeDataset.js rename to plugins/datasets/src/api/removeDataset.js diff --git a/plugins/beta/datasets/src/api/removeDataset.test.js b/plugins/datasets/src/api/removeDataset.test.js similarity index 100% rename from plugins/beta/datasets/src/api/removeDataset.test.js rename to plugins/datasets/src/api/removeDataset.test.js diff --git a/plugins/beta/datasets/src/api/setData.js b/plugins/datasets/src/api/setData.js similarity index 89% rename from plugins/beta/datasets/src/api/setData.js rename to plugins/datasets/src/api/setData.js index cf0ee23bd..f5485fc87 100644 --- a/plugins/beta/datasets/src/api/setData.js +++ b/plugins/datasets/src/api/setData.js @@ -1,4 +1,4 @@ -import { logger } from '../../../../../src/services/logger.js' +import { logger } from '../../../../src/services/logger.js' import { datasetRegistry } from '../registry/datasetRegistry.js' import { layerAdapter } from '../adapters/loadLayerAdapter.js' diff --git a/plugins/beta/datasets/src/api/setData.test.js b/plugins/datasets/src/api/setData.test.js similarity index 94% rename from plugins/beta/datasets/src/api/setData.test.js rename to plugins/datasets/src/api/setData.test.js index 80b181428..2b2f2927f 100644 --- a/plugins/beta/datasets/src/api/setData.test.js +++ b/plugins/datasets/src/api/setData.test.js @@ -1,6 +1,6 @@ import { setData } from './setData.js' import { datasetRegistry } from '../registry/datasetRegistry.js' -import { logger } from '../../../../../src/services/logger.js' +import { logger } from '../../../../src/services/logger.js' import { layerAdapter } from '../adapters/loadLayerAdapter.js' jest.mock('../adapters/loadLayerAdapter.js', () => ({ @@ -13,7 +13,7 @@ jest.mock('../registry/datasetRegistry.js', () => ({ datasetRegistry: { getDataset: jest.fn() } })) -jest.mock('../../../../../src/services/logger.js', () => ({ +jest.mock('../../../../src/services/logger.js', () => ({ logger: { warn: jest.fn() } })) diff --git a/plugins/beta/datasets/src/api/setDatasetVisibility.js b/plugins/datasets/src/api/setDatasetVisibility.js similarity index 100% rename from plugins/beta/datasets/src/api/setDatasetVisibility.js rename to plugins/datasets/src/api/setDatasetVisibility.js diff --git a/plugins/beta/datasets/src/api/setDatasetVisibility.test.js b/plugins/datasets/src/api/setDatasetVisibility.test.js similarity index 100% rename from plugins/beta/datasets/src/api/setDatasetVisibility.test.js rename to plugins/datasets/src/api/setDatasetVisibility.test.js diff --git a/plugins/beta/datasets/src/api/setFeatureVisibility.js b/plugins/datasets/src/api/setFeatureVisibility.js similarity index 91% rename from plugins/beta/datasets/src/api/setFeatureVisibility.js rename to plugins/datasets/src/api/setFeatureVisibility.js index 1f3701ce4..7f7c09a35 100644 --- a/plugins/beta/datasets/src/api/setFeatureVisibility.js +++ b/plugins/datasets/src/api/setFeatureVisibility.js @@ -1,4 +1,4 @@ -import { logger } from '../../../../../src/services/logger.js' +import { logger } from '../../../../src/services/logger.js' import { datasetRegistry } from '../registry/datasetRegistry.js' export const setFeatureVisibility = ({ pluginState: { dispatch } }, visible, featureIds, { datasetId = null } = {}) => { diff --git a/plugins/beta/datasets/src/api/setFeatureVisibility.test.js b/plugins/datasets/src/api/setFeatureVisibility.test.js similarity index 95% rename from plugins/beta/datasets/src/api/setFeatureVisibility.test.js rename to plugins/datasets/src/api/setFeatureVisibility.test.js index 0dd5b5caf..d4deb3c20 100644 --- a/plugins/beta/datasets/src/api/setFeatureVisibility.test.js +++ b/plugins/datasets/src/api/setFeatureVisibility.test.js @@ -1,12 +1,12 @@ import { setFeatureVisibility } from './setFeatureVisibility.js' import { datasetRegistry } from '../registry/datasetRegistry.js' -import { logger } from '../../../../../src/services/logger.js' +import { logger } from '../../../../src/services/logger.js' jest.mock('../registry/datasetRegistry.js', () => ({ datasetRegistry: { getDataset: jest.fn() } })) -jest.mock('../../../../../src/services/logger.js', () => ({ +jest.mock('../../../../src/services/logger.js', () => ({ logger: { warn: jest.fn() } })) diff --git a/plugins/beta/datasets/src/api/setGlobals.js b/plugins/datasets/src/api/setGlobals.js similarity index 90% rename from plugins/beta/datasets/src/api/setGlobals.js rename to plugins/datasets/src/api/setGlobals.js index 10195266d..99c16d90b 100644 --- a/plugins/beta/datasets/src/api/setGlobals.js +++ b/plugins/datasets/src/api/setGlobals.js @@ -1,4 +1,4 @@ -import { logger } from '../../../../../src/services/logger.js' +import { logger } from '../../../../src/services/logger.js' export const setGlobals = ({ pluginState: { dispatch } }, values) => { const { opacityMode } = values const payload = {} diff --git a/plugins/beta/datasets/src/api/setGlobals.test.js b/plugins/datasets/src/api/setGlobals.test.js similarity index 94% rename from plugins/beta/datasets/src/api/setGlobals.test.js rename to plugins/datasets/src/api/setGlobals.test.js index bb0e16512..e71bde00d 100644 --- a/plugins/beta/datasets/src/api/setGlobals.test.js +++ b/plugins/datasets/src/api/setGlobals.test.js @@ -1,7 +1,7 @@ import { setGlobals } from './setGlobals.js' -import { logger } from '../../../../../src/services/logger.js' +import { logger } from '../../../../src/services/logger.js' -jest.mock('../../../../../src/services/logger.js', () => ({ +jest.mock('../../../../src/services/logger.js', () => ({ logger: { warn: jest.fn() } })) diff --git a/plugins/beta/datasets/src/api/setOpacity.js b/plugins/datasets/src/api/setOpacity.js similarity index 100% rename from plugins/beta/datasets/src/api/setOpacity.js rename to plugins/datasets/src/api/setOpacity.js diff --git a/plugins/beta/datasets/src/api/setOpacity.test.js b/plugins/datasets/src/api/setOpacity.test.js similarity index 100% rename from plugins/beta/datasets/src/api/setOpacity.test.js rename to plugins/datasets/src/api/setOpacity.test.js diff --git a/plugins/beta/datasets/src/api/setStyle.js b/plugins/datasets/src/api/setStyle.js similarity index 100% rename from plugins/beta/datasets/src/api/setStyle.js rename to plugins/datasets/src/api/setStyle.js diff --git a/plugins/beta/datasets/src/api/setStyle.test.js b/plugins/datasets/src/api/setStyle.test.js similarity index 100% rename from plugins/beta/datasets/src/api/setStyle.test.js rename to plugins/datasets/src/api/setStyle.test.js diff --git a/plugins/beta/datasets/src/components/Key/EmptyKey.jsx b/plugins/datasets/src/components/Key/EmptyKey.jsx similarity index 100% rename from plugins/beta/datasets/src/components/Key/EmptyKey.jsx rename to plugins/datasets/src/components/Key/EmptyKey.jsx diff --git a/plugins/beta/datasets/src/components/Key/EmptyKey.test.jsx b/plugins/datasets/src/components/Key/EmptyKey.test.jsx similarity index 100% rename from plugins/beta/datasets/src/components/Key/EmptyKey.test.jsx rename to plugins/datasets/src/components/Key/EmptyKey.test.jsx diff --git a/plugins/beta/datasets/src/components/Key/Key.jsx b/plugins/datasets/src/components/Key/Key.jsx similarity index 100% rename from plugins/beta/datasets/src/components/Key/Key.jsx rename to plugins/datasets/src/components/Key/Key.jsx diff --git a/plugins/beta/datasets/src/components/Key/Key.module.scss b/plugins/datasets/src/components/Key/Key.module.scss similarity index 100% rename from plugins/beta/datasets/src/components/Key/Key.module.scss rename to plugins/datasets/src/components/Key/Key.module.scss diff --git a/plugins/beta/datasets/src/components/Key/KeyGroupItem.jsx b/plugins/datasets/src/components/Key/KeyGroupItem.jsx similarity index 100% rename from plugins/beta/datasets/src/components/Key/KeyGroupItem.jsx rename to plugins/datasets/src/components/Key/KeyGroupItem.jsx diff --git a/plugins/beta/datasets/src/components/Key/KeyItem.jsx b/plugins/datasets/src/components/Key/KeyItem.jsx similarity index 89% rename from plugins/beta/datasets/src/components/Key/KeyItem.jsx rename to plugins/datasets/src/components/Key/KeyItem.jsx index f931a7dc0..57035f11a 100644 --- a/plugins/beta/datasets/src/components/Key/KeyItem.jsx +++ b/plugins/datasets/src/components/Key/KeyItem.jsx @@ -1,4 +1,4 @@ -import { getValueForStyle } from '../../../../../../src/utils/getValueForStyle.js' +import { getValueForStyle } from '../../../../../src/utils/getValueForStyle.js' import { KeySvg } from './KeySvg.jsx' export const KeyItem = ({ registryDataset, symbolRegistry, patternRegistry, mapStyle }) => { diff --git a/plugins/beta/datasets/src/components/Key/KeySvg.jsx b/plugins/datasets/src/components/Key/KeySvg.jsx similarity index 100% rename from plugins/beta/datasets/src/components/Key/KeySvg.jsx rename to plugins/datasets/src/components/Key/KeySvg.jsx diff --git a/plugins/beta/datasets/src/components/Key/KeySvg.test.jsx b/plugins/datasets/src/components/Key/KeySvg.test.jsx similarity index 95% rename from plugins/beta/datasets/src/components/Key/KeySvg.test.jsx rename to plugins/datasets/src/components/Key/KeySvg.test.jsx index 494e9c4f2..4020fd161 100644 --- a/plugins/beta/datasets/src/components/Key/KeySvg.test.jsx +++ b/plugins/datasets/src/components/Key/KeySvg.test.jsx @@ -1,8 +1,8 @@ import { render } from '@testing-library/react' import { KeySvg } from './KeySvg' -import { symbolRegistry } from '../../../../../../src/services/symbolRegistry.js' -import { patternRegistry } from '../../../../../../src/services/patternRegistry.js' +import { symbolRegistry } from '../../../../../src/services/symbolRegistry.js' +import { patternRegistry } from '../../../../../src/services/patternRegistry.js' const getSymbolDef = jest.spyOn(symbolRegistry, 'getSymbolDef') diff --git a/plugins/beta/datasets/src/components/Key/KeySvgLine.jsx b/plugins/datasets/src/components/Key/KeySvgLine.jsx similarity index 85% rename from plugins/beta/datasets/src/components/Key/KeySvgLine.jsx rename to plugins/datasets/src/components/Key/KeySvgLine.jsx index 13fb3d87c..7d5b165ad 100644 --- a/plugins/beta/datasets/src/components/Key/KeySvgLine.jsx +++ b/plugins/datasets/src/components/Key/KeySvgLine.jsx @@ -1,5 +1,5 @@ import { svgProps, SVG_SIZE, SVG_CENTER } from './svgProperties.js' -import { getValueForStyle } from '../../../../../../src/utils/getValueForStyle.js' +import { getValueForStyle } from '../../../../../src/utils/getValueForStyle.js' export const KeySvgLine = ({ mapStyle, registryDataset }) => { const { style } = registryDataset diff --git a/plugins/beta/datasets/src/components/Key/KeySvgLine.test.jsx b/plugins/datasets/src/components/Key/KeySvgLine.test.jsx similarity index 93% rename from plugins/beta/datasets/src/components/Key/KeySvgLine.test.jsx rename to plugins/datasets/src/components/Key/KeySvgLine.test.jsx index 866aa3300..4a596b80a 100644 --- a/plugins/beta/datasets/src/components/Key/KeySvgLine.test.jsx +++ b/plugins/datasets/src/components/Key/KeySvgLine.test.jsx @@ -1,9 +1,9 @@ import { render } from '@testing-library/react' import { KeySvgLine } from './KeySvgLine' -import { getValueForStyle } from '../../../../../../src/utils/getValueForStyle' +import { getValueForStyle } from '../../../../../src/utils/getValueForStyle' -jest.mock('../../../../../../src/utils/getValueForStyle', () => ({ +jest.mock('../../../../../src/utils/getValueForStyle', () => ({ getValueForStyle: jest.fn((value) => value) })) diff --git a/plugins/beta/datasets/src/components/Key/KeySvgPattern.jsx b/plugins/datasets/src/components/Key/KeySvgPattern.jsx similarity index 100% rename from plugins/beta/datasets/src/components/Key/KeySvgPattern.jsx rename to plugins/datasets/src/components/Key/KeySvgPattern.jsx diff --git a/plugins/beta/datasets/src/components/Key/KeySvgPattern.test.jsx b/plugins/datasets/src/components/Key/KeySvgPattern.test.jsx similarity index 95% rename from plugins/beta/datasets/src/components/Key/KeySvgPattern.test.jsx rename to plugins/datasets/src/components/Key/KeySvgPattern.test.jsx index c806168a5..209d9953f 100644 --- a/plugins/beta/datasets/src/components/Key/KeySvgPattern.test.jsx +++ b/plugins/datasets/src/components/Key/KeySvgPattern.test.jsx @@ -1,6 +1,6 @@ import { render } from '@testing-library/react' import { KeySvgPattern } from './KeySvgPattern' -import { patternRegistry } from '../../../../../../src/services/patternRegistry.js' +import { patternRegistry } from '../../../../../src/services/patternRegistry.js' const getKeyPatternPaths = jest.spyOn(patternRegistry, 'getKeyPatternPaths') const defaultProps = { diff --git a/plugins/beta/datasets/src/components/Key/KeySvgRect.jsx b/plugins/datasets/src/components/Key/KeySvgRect.jsx similarity index 88% rename from plugins/beta/datasets/src/components/Key/KeySvgRect.jsx rename to plugins/datasets/src/components/Key/KeySvgRect.jsx index 86f233309..ac0bab836 100644 --- a/plugins/beta/datasets/src/components/Key/KeySvgRect.jsx +++ b/plugins/datasets/src/components/Key/KeySvgRect.jsx @@ -1,4 +1,4 @@ -import { getValueForStyle } from '../../../../../../src/utils/getValueForStyle.js' +import { getValueForStyle } from '../../../../../src/utils/getValueForStyle.js' import { svgProps, SVG_SIZE } from './svgProperties.js' export const KeySvgRect = ({ mapStyle, registryDataset }) => { diff --git a/plugins/beta/datasets/src/components/Key/KeySvgRect.test.jsx b/plugins/datasets/src/components/Key/KeySvgRect.test.jsx similarity index 94% rename from plugins/beta/datasets/src/components/Key/KeySvgRect.test.jsx rename to plugins/datasets/src/components/Key/KeySvgRect.test.jsx index 0365d8069..30da5bc72 100644 --- a/plugins/beta/datasets/src/components/Key/KeySvgRect.test.jsx +++ b/plugins/datasets/src/components/Key/KeySvgRect.test.jsx @@ -1,9 +1,9 @@ import { render } from '@testing-library/react' import { KeySvgRect } from './KeySvgRect' -import { getValueForStyle } from '../../../../../../src/utils/getValueForStyle' +import { getValueForStyle } from '../../../../../src/utils/getValueForStyle' -jest.mock('../../../../../../src/utils/getValueForStyle', () => ({ +jest.mock('../../../../../src/utils/getValueForStyle', () => ({ getValueForStyle: jest.fn((value) => value) })) diff --git a/plugins/beta/datasets/src/components/Key/KeySvgSymbol.jsx b/plugins/datasets/src/components/Key/KeySvgSymbol.jsx similarity index 94% rename from plugins/beta/datasets/src/components/Key/KeySvgSymbol.jsx rename to plugins/datasets/src/components/Key/KeySvgSymbol.jsx index e2b92f246..7e21a026e 100644 --- a/plugins/beta/datasets/src/components/Key/KeySvgSymbol.jsx +++ b/plugins/datasets/src/components/Key/KeySvgSymbol.jsx @@ -1,4 +1,4 @@ -import { getSymbolStyleColors, getSymbolViewBox } from '../../../../../../src/utils/symbolUtils.js' +import { getSymbolStyleColors, getSymbolViewBox } from '../../../../../src/utils/symbolUtils.js' import { svgSymbolProps } from './svgProperties.js' export const KeySvgSymbol = ({ symbolRegistry, registryDataset, mapStyle, symbolDef }) => { diff --git a/plugins/beta/datasets/src/components/Key/KeySvgSymbol.test.jsx b/plugins/datasets/src/components/Key/KeySvgSymbol.test.jsx similarity index 96% rename from plugins/beta/datasets/src/components/Key/KeySvgSymbol.test.jsx rename to plugins/datasets/src/components/Key/KeySvgSymbol.test.jsx index 4436c78f5..920fd3e28 100644 --- a/plugins/beta/datasets/src/components/Key/KeySvgSymbol.test.jsx +++ b/plugins/datasets/src/components/Key/KeySvgSymbol.test.jsx @@ -1,9 +1,9 @@ import { render } from '@testing-library/react' import { KeySvgSymbol } from './KeySvgSymbol' -import { getSymbolStyleColors, getSymbolViewBox } from '../../../../../../src/utils/symbolUtils.js' +import { getSymbolStyleColors, getSymbolViewBox } from '../../../../../src/utils/symbolUtils.js' -jest.mock('../../../../../../src/utils/symbolUtils.js', () => ({ +jest.mock('../../../../../src/utils/symbolUtils.js', () => ({ getSymbolStyleColors: jest.fn(() => ({ foreground: '#000', background: '#fff' })), getSymbolViewBox: jest.fn(() => '0 0 38 38') })) diff --git a/plugins/beta/datasets/src/components/Key/svgProperties.js b/plugins/datasets/src/components/Key/svgProperties.js similarity index 100% rename from plugins/beta/datasets/src/components/Key/svgProperties.js rename to plugins/datasets/src/components/Key/svgProperties.js diff --git a/plugins/beta/datasets/src/components/Key/svgProperties.test.js b/plugins/datasets/src/components/Key/svgProperties.test.js similarity index 100% rename from plugins/beta/datasets/src/components/Key/svgProperties.test.js rename to plugins/datasets/src/components/Key/svgProperties.test.js diff --git a/plugins/beta/datasets/src/components/LayersMenu/Layers.module.scss b/plugins/datasets/src/components/LayersMenu/Layers.module.scss similarity index 100% rename from plugins/beta/datasets/src/components/LayersMenu/Layers.module.scss rename to plugins/datasets/src/components/LayersMenu/Layers.module.scss diff --git a/plugins/beta/datasets/src/components/LayersMenu/LayersMenu.jsx b/plugins/datasets/src/components/LayersMenu/LayersMenu.jsx similarity index 100% rename from plugins/beta/datasets/src/components/LayersMenu/LayersMenu.jsx rename to plugins/datasets/src/components/LayersMenu/LayersMenu.jsx diff --git a/plugins/beta/datasets/src/components/LayersMenu/LayersMenuCheckbox.jsx b/plugins/datasets/src/components/LayersMenu/LayersMenuCheckbox.jsx similarity index 100% rename from plugins/beta/datasets/src/components/LayersMenu/LayersMenuCheckbox.jsx rename to plugins/datasets/src/components/LayersMenu/LayersMenuCheckbox.jsx diff --git a/plugins/beta/datasets/src/components/LayersMenu/LayersMenuGroupWrapper.jsx b/plugins/datasets/src/components/LayersMenu/LayersMenuGroupWrapper.jsx similarity index 100% rename from plugins/beta/datasets/src/components/LayersMenu/LayersMenuGroupWrapper.jsx rename to plugins/datasets/src/components/LayersMenu/LayersMenuGroupWrapper.jsx diff --git a/plugins/beta/datasets/src/datasets.scss b/plugins/datasets/src/datasets.scss similarity index 100% rename from plugins/beta/datasets/src/datasets.scss rename to plugins/datasets/src/datasets.scss diff --git a/plugins/beta/datasets/src/fetch/createDynamicSource.js b/plugins/datasets/src/fetch/createDynamicSource.js similarity index 100% rename from plugins/beta/datasets/src/fetch/createDynamicSource.js rename to plugins/datasets/src/fetch/createDynamicSource.js diff --git a/plugins/beta/datasets/src/fetch/fetchGeoJSON.js b/plugins/datasets/src/fetch/fetchGeoJSON.js similarity index 100% rename from plugins/beta/datasets/src/fetch/fetchGeoJSON.js rename to plugins/datasets/src/fetch/fetchGeoJSON.js diff --git a/plugins/beta/datasets/src/index.js b/plugins/datasets/src/index.js similarity index 100% rename from plugins/beta/datasets/src/index.js rename to plugins/datasets/src/index.js diff --git a/plugins/beta/datasets/src/initialise/DatasetsInit.jsx b/plugins/datasets/src/initialise/DatasetsInit.jsx similarity index 97% rename from plugins/beta/datasets/src/initialise/DatasetsInit.jsx rename to plugins/datasets/src/initialise/DatasetsInit.jsx index e1968af5c..b1875eaeb 100755 --- a/plugins/beta/datasets/src/initialise/DatasetsInit.jsx +++ b/plugins/datasets/src/initialise/DatasetsInit.jsx @@ -1,6 +1,6 @@ // src/plugins/datasets/datasetsInit.jsx import { useEffect, useRef } from 'react' -import { EVENTS } from '../../../../../src/config/events.js' +import { EVENTS } from '../../../../src/config/events.js' import { initialiseDatasets } from './initialiseDatasets.js' import { datasetRegistry } from '../registry/datasetRegistry.js' import { attachGlobalState } from '../registry/globalDataset.js' diff --git a/plugins/beta/datasets/src/initialise/defaults.js b/plugins/datasets/src/initialise/defaults.js similarity index 100% rename from plugins/beta/datasets/src/initialise/defaults.js rename to plugins/datasets/src/initialise/defaults.js diff --git a/plugins/beta/datasets/src/initialise/defaults.test.js b/plugins/datasets/src/initialise/defaults.test.js similarity index 100% rename from plugins/beta/datasets/src/initialise/defaults.test.js rename to plugins/datasets/src/initialise/defaults.test.js diff --git a/plugins/beta/datasets/src/initialise/initialiseDatasets.js b/plugins/datasets/src/initialise/initialiseDatasets.js similarity index 100% rename from plugins/beta/datasets/src/initialise/initialiseDatasets.js rename to plugins/datasets/src/initialise/initialiseDatasets.js diff --git a/plugins/beta/datasets/src/initialise/initialiseDatasets.test.js b/plugins/datasets/src/initialise/initialiseDatasets.test.js similarity index 100% rename from plugins/beta/datasets/src/initialise/initialiseDatasets.test.js rename to plugins/datasets/src/initialise/initialiseDatasets.test.js diff --git a/plugins/beta/datasets/src/manifest.js b/plugins/datasets/src/manifest.js similarity index 100% rename from plugins/beta/datasets/src/manifest.js rename to plugins/datasets/src/manifest.js diff --git a/plugins/beta/datasets/src/reducers/__data__/demoDatasets.js b/plugins/datasets/src/reducers/__data__/demoDatasets.js similarity index 100% rename from plugins/beta/datasets/src/reducers/__data__/demoDatasets.js rename to plugins/datasets/src/reducers/__data__/demoDatasets.js diff --git a/plugins/beta/datasets/src/reducers/datasetsToMenu.js b/plugins/datasets/src/reducers/datasetsToMenu.js similarity index 100% rename from plugins/beta/datasets/src/reducers/datasetsToMenu.js rename to plugins/datasets/src/reducers/datasetsToMenu.js diff --git a/plugins/beta/datasets/src/reducers/datasetsToMenu.test.js b/plugins/datasets/src/reducers/datasetsToMenu.test.js similarity index 100% rename from plugins/beta/datasets/src/reducers/datasetsToMenu.test.js rename to plugins/datasets/src/reducers/datasetsToMenu.test.js diff --git a/plugins/beta/datasets/src/reducers/mappedDatasetsReducer.js b/plugins/datasets/src/reducers/mappedDatasetsReducer.js similarity index 100% rename from plugins/beta/datasets/src/reducers/mappedDatasetsReducer.js rename to plugins/datasets/src/reducers/mappedDatasetsReducer.js diff --git a/plugins/beta/datasets/src/reducers/mappedDatasetsReducer.test.js b/plugins/datasets/src/reducers/mappedDatasetsReducer.test.js similarity index 100% rename from plugins/beta/datasets/src/reducers/mappedDatasetsReducer.test.js rename to plugins/datasets/src/reducers/mappedDatasetsReducer.test.js diff --git a/plugins/beta/datasets/src/reducers/pluginState.js b/plugins/datasets/src/reducers/pluginState.js similarity index 99% rename from plugins/beta/datasets/src/reducers/pluginState.js rename to plugins/datasets/src/reducers/pluginState.js index cee81ca7f..998b107a0 100755 --- a/plugins/beta/datasets/src/reducers/pluginState.js +++ b/plugins/datasets/src/reducers/pluginState.js @@ -1,6 +1,6 @@ import { datasetsToMenu, addDatasetToMenu, removeDatasetsFromMenu } from './datasetsToMenu.js' import { mappedDatasetsReducer } from './mappedDatasetsReducer.js' -import { logger } from '../../../../../src/services/logger.js' +import { logger } from '../../../../src/services/logger.js' const initialState = { globals: { diff --git a/plugins/beta/datasets/src/reducers/pluginState.test.js b/plugins/datasets/src/reducers/pluginState.test.js similarity index 99% rename from plugins/beta/datasets/src/reducers/pluginState.test.js rename to plugins/datasets/src/reducers/pluginState.test.js index 68b4089bf..1020e52d0 100644 --- a/plugins/beta/datasets/src/reducers/pluginState.test.js +++ b/plugins/datasets/src/reducers/pluginState.test.js @@ -1,7 +1,7 @@ import { initialState, actions } from './pluginState.js' -import { logger } from '../../../../../src/services/logger.js' +import { logger } from '../../../../src/services/logger.js' -jest.mock('../../../../../src/services/logger.js', () => ({ +jest.mock('../../../../src/services/logger.js', () => ({ logger: { error: jest.fn() } })) diff --git a/plugins/beta/datasets/src/registry/__mocks__/datasetRegistry.js b/plugins/datasets/src/registry/__mocks__/datasetRegistry.js similarity index 100% rename from plugins/beta/datasets/src/registry/__mocks__/datasetRegistry.js rename to plugins/datasets/src/registry/__mocks__/datasetRegistry.js diff --git a/plugins/beta/datasets/src/registry/createDataset.js b/plugins/datasets/src/registry/createDataset.js similarity index 100% rename from plugins/beta/datasets/src/registry/createDataset.js rename to plugins/datasets/src/registry/createDataset.js diff --git a/plugins/beta/datasets/src/registry/dataset.js b/plugins/datasets/src/registry/dataset.js similarity index 98% rename from plugins/beta/datasets/src/registry/dataset.js rename to plugins/datasets/src/registry/dataset.js index 2793ca96b..46a906275 100644 --- a/plugins/beta/datasets/src/registry/dataset.js +++ b/plugins/datasets/src/registry/dataset.js @@ -1,6 +1,6 @@ import { datasetRegistry } from './datasetRegistry.js' import { hasCustomVisualStyle } from '../initialise/defaults.js' -import { hasPattern } from '../../../../../src/utils/patternUtils.js' +import { hasPattern } from '../../../../src/utils/patternUtils.js' import { DynamicGeoJson } from './dynamicGeoJson.js' import { calculateOpacity, getGlobalVisibility } from './globalDataset.js' diff --git a/plugins/beta/datasets/src/registry/dataset.test.js b/plugins/datasets/src/registry/dataset.test.js similarity index 100% rename from plugins/beta/datasets/src/registry/dataset.test.js rename to plugins/datasets/src/registry/dataset.test.js diff --git a/plugins/beta/datasets/src/registry/datasetDefinitionCache.js b/plugins/datasets/src/registry/datasetDefinitionCache.js similarity index 100% rename from plugins/beta/datasets/src/registry/datasetDefinitionCache.js rename to plugins/datasets/src/registry/datasetDefinitionCache.js diff --git a/plugins/beta/datasets/src/registry/datasetRegistry.js b/plugins/datasets/src/registry/datasetRegistry.js similarity index 100% rename from plugins/beta/datasets/src/registry/datasetRegistry.js rename to plugins/datasets/src/registry/datasetRegistry.js diff --git a/plugins/beta/datasets/src/registry/datasetRegistry.test.js b/plugins/datasets/src/registry/datasetRegistry.test.js similarity index 100% rename from plugins/beta/datasets/src/registry/datasetRegistry.test.js rename to plugins/datasets/src/registry/datasetRegistry.test.js diff --git a/plugins/beta/datasets/src/registry/dynamicGeoJson.js b/plugins/datasets/src/registry/dynamicGeoJson.js similarity index 100% rename from plugins/beta/datasets/src/registry/dynamicGeoJson.js rename to plugins/datasets/src/registry/dynamicGeoJson.js diff --git a/plugins/beta/datasets/src/registry/globalDataset.js b/plugins/datasets/src/registry/globalDataset.js similarity index 100% rename from plugins/beta/datasets/src/registry/globalDataset.js rename to plugins/datasets/src/registry/globalDataset.js diff --git a/plugins/beta/datasets/src/utils/bbox.js b/plugins/datasets/src/utils/bbox.js similarity index 100% rename from plugins/beta/datasets/src/utils/bbox.js rename to plugins/datasets/src/utils/bbox.js diff --git a/plugins/beta/datasets/src/utils/debounce.js b/plugins/datasets/src/utils/debounce.js similarity index 100% rename from plugins/beta/datasets/src/utils/debounce.js rename to plugins/datasets/src/utils/debounce.js diff --git a/plugins/draw-es/package.json b/plugins/draw-es/package.json new file mode 100644 index 000000000..2c02d02e7 --- /dev/null +++ b/plugins/draw-es/package.json @@ -0,0 +1,29 @@ +{ + "name": "@defra/interactive-map-plugin-draw-es", + "version": "0.0.0-development", + "description": "ArcGIS/ESRI draw plugin for @defra/interactive-map", + "repository": { + "type": "git", + "url": "https://github.com/DEFRA/interactive-map", + "directory": "plugins/draw-es" + }, + "module": "dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/esm/index.js" + } + }, + "type": "module", + "files": ["dist"], + "sideEffects": false, + "publishConfig": { "tag": "beta" }, + "dependencies": { + "preact": "^10.27.2", + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*", + "@arcgis/core": "^5.0.9" + }, + "license": "" +} diff --git a/plugins/beta/draw-es/src/DrawInit.jsx b/plugins/draw-es/src/DrawInit.jsx similarity index 96% rename from plugins/beta/draw-es/src/DrawInit.jsx rename to plugins/draw-es/src/DrawInit.jsx index ced29d093..480955b62 100755 --- a/plugins/beta/draw-es/src/DrawInit.jsx +++ b/plugins/draw-es/src/DrawInit.jsx @@ -1,5 +1,5 @@ import { useEffect } from 'react' -import { EVENTS } from '../../../../src/config/events.js' +import { EVENTS } from '../../../src/config/events.js' import { createSketchViewModel } from './sketchViewModel.js' import { attachEvents } from './events.js' diff --git a/plugins/beta/draw-es/src/api/addFeature.js b/plugins/draw-es/src/api/addFeature.js similarity index 100% rename from plugins/beta/draw-es/src/api/addFeature.js rename to plugins/draw-es/src/api/addFeature.js diff --git a/plugins/beta/draw-es/src/api/deleteFeature.js b/plugins/draw-es/src/api/deleteFeature.js similarity index 100% rename from plugins/beta/draw-es/src/api/deleteFeature.js rename to plugins/draw-es/src/api/deleteFeature.js diff --git a/plugins/beta/draw-es/src/api/editFeature.js b/plugins/draw-es/src/api/editFeature.js similarity index 100% rename from plugins/beta/draw-es/src/api/editFeature.js rename to plugins/draw-es/src/api/editFeature.js diff --git a/plugins/beta/draw-es/src/api/newPolygon.js b/plugins/draw-es/src/api/newPolygon.js similarity index 100% rename from plugins/beta/draw-es/src/api/newPolygon.js rename to plugins/draw-es/src/api/newPolygon.js diff --git a/plugins/beta/draw-es/src/events.js b/plugins/draw-es/src/events.js similarity index 100% rename from plugins/beta/draw-es/src/events.js rename to plugins/draw-es/src/events.js diff --git a/plugins/beta/draw-es/src/events.test.js b/plugins/draw-es/src/events.test.js similarity index 99% rename from plugins/beta/draw-es/src/events.test.js rename to plugins/draw-es/src/events.test.js index 13ea0ba1a..dd7108744 100644 --- a/plugins/beta/draw-es/src/events.test.js +++ b/plugins/draw-es/src/events.test.js @@ -1,5 +1,5 @@ import { attachEvents } from './events.js' -import { EVENTS as events } from '../../../../src/config/events.js' +import { EVENTS as events } from '../../../src/config/events.js' import * as graphicJs from './graphic.js' jest.mock('./graphic.js') diff --git a/plugins/beta/draw-es/src/graphic.js b/plugins/draw-es/src/graphic.js similarity index 97% rename from plugins/beta/draw-es/src/graphic.js rename to plugins/draw-es/src/graphic.js index 2f30ca08d..6ad3ffbf5 100644 --- a/plugins/beta/draw-es/src/graphic.js +++ b/plugins/draw-es/src/graphic.js @@ -1,6 +1,6 @@ import Graphic from '@arcgis/core/Graphic.js' import * as simplifyOperator from '@arcgis/core/geometry/operators/simplifyOperator.js' -import { logger } from '../../../../src/services/logger.js' +import { logger } from '../../../src/services/logger.js' function createSymbol (mapColorScheme) { return { diff --git a/plugins/beta/draw-es/src/index.js b/plugins/draw-es/src/index.js similarity index 100% rename from plugins/beta/draw-es/src/index.js rename to plugins/draw-es/src/index.js diff --git a/plugins/beta/draw-es/src/manifest.js b/plugins/draw-es/src/manifest.js similarity index 100% rename from plugins/beta/draw-es/src/manifest.js rename to plugins/draw-es/src/manifest.js diff --git a/plugins/beta/draw-es/src/reducer.js b/plugins/draw-es/src/reducer.js similarity index 100% rename from plugins/beta/draw-es/src/reducer.js rename to plugins/draw-es/src/reducer.js diff --git a/plugins/beta/draw-es/src/sketchViewModel.js b/plugins/draw-es/src/sketchViewModel.js similarity index 100% rename from plugins/beta/draw-es/src/sketchViewModel.js rename to plugins/draw-es/src/sketchViewModel.js diff --git a/plugins/draw-ml/package.json b/plugins/draw-ml/package.json new file mode 100644 index 000000000..c24f1dd56 --- /dev/null +++ b/plugins/draw-ml/package.json @@ -0,0 +1,31 @@ +{ + "name": "@defra/interactive-map-plugin-draw-ml", + "version": "0.0.0-development", + "description": "MapLibre draw plugin for @defra/interactive-map", + "repository": { + "type": "git", + "url": "https://github.com/DEFRA/interactive-map", + "directory": "plugins/draw-ml" + }, + "main": "dist/umd/index.js", + "module": "dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/umd/index.js" + } + }, + "type": "module", + "files": ["dist"], + "sideEffects": ["**/*.css", "**/*.scss"], + "publishConfig": { "tag": "beta" }, + "dependencies": { + "preact": "^10.27.2", + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*", + "maplibre-gl": "^5.23.0" + }, + "license": "" +} diff --git a/plugins/beta/draw-ml/src/DrawInit.jsx b/plugins/draw-ml/src/DrawInit.jsx similarity index 98% rename from plugins/beta/draw-ml/src/DrawInit.jsx rename to plugins/draw-ml/src/DrawInit.jsx index dab21a2c1..dd4b1ac50 100755 --- a/plugins/beta/draw-ml/src/DrawInit.jsx +++ b/plugins/draw-ml/src/DrawInit.jsx @@ -1,5 +1,5 @@ import { useEffect } from 'react' -import { EVENTS } from '../../../../src/config/events.js' +import { EVENTS } from '../../../src/config/events.js' import { attachEvents } from './events.js' import { createMapboxDraw } from './mapboxDraw.js' diff --git a/plugins/beta/draw-ml/src/api/addFeature.js b/plugins/draw-ml/src/api/addFeature.js similarity index 100% rename from plugins/beta/draw-ml/src/api/addFeature.js rename to plugins/draw-ml/src/api/addFeature.js diff --git a/plugins/beta/draw-ml/src/api/deleteFeature.js b/plugins/draw-ml/src/api/deleteFeature.js similarity index 100% rename from plugins/beta/draw-ml/src/api/deleteFeature.js rename to plugins/draw-ml/src/api/deleteFeature.js diff --git a/plugins/beta/draw-ml/src/api/editFeature.js b/plugins/draw-ml/src/api/editFeature.js similarity index 100% rename from plugins/beta/draw-ml/src/api/editFeature.js rename to plugins/draw-ml/src/api/editFeature.js diff --git a/plugins/beta/draw-ml/src/api/merge.js b/plugins/draw-ml/src/api/merge.js similarity index 100% rename from plugins/beta/draw-ml/src/api/merge.js rename to plugins/draw-ml/src/api/merge.js diff --git a/plugins/beta/draw-ml/src/api/newLine.js b/plugins/draw-ml/src/api/newLine.js similarity index 100% rename from plugins/beta/draw-ml/src/api/newLine.js rename to plugins/draw-ml/src/api/newLine.js diff --git a/plugins/beta/draw-ml/src/api/newPolygon.js b/plugins/draw-ml/src/api/newPolygon.js similarity index 100% rename from plugins/beta/draw-ml/src/api/newPolygon.js rename to plugins/draw-ml/src/api/newPolygon.js diff --git a/plugins/beta/draw-ml/src/api/split.js b/plugins/draw-ml/src/api/split.js similarity index 100% rename from plugins/beta/draw-ml/src/api/split.js rename to plugins/draw-ml/src/api/split.js diff --git a/plugins/beta/draw-ml/src/defaults.js b/plugins/draw-ml/src/defaults.js similarity index 100% rename from plugins/beta/draw-ml/src/defaults.js rename to plugins/draw-ml/src/defaults.js diff --git a/plugins/beta/draw-ml/src/draw.scss b/plugins/draw-ml/src/draw.scss similarity index 100% rename from plugins/beta/draw-ml/src/draw.scss rename to plugins/draw-ml/src/draw.scss diff --git a/plugins/beta/draw-ml/src/events.js b/plugins/draw-ml/src/events.js similarity index 100% rename from plugins/beta/draw-ml/src/events.js rename to plugins/draw-ml/src/events.js diff --git a/plugins/beta/draw-ml/src/index.js b/plugins/draw-ml/src/index.js similarity index 100% rename from plugins/beta/draw-ml/src/index.js rename to plugins/draw-ml/src/index.js diff --git a/plugins/beta/draw-ml/src/manifest.js b/plugins/draw-ml/src/manifest.js similarity index 100% rename from plugins/beta/draw-ml/src/manifest.js rename to plugins/draw-ml/src/manifest.js diff --git a/plugins/beta/draw-ml/src/mapboxDraw.js b/plugins/draw-ml/src/mapboxDraw.js similarity index 100% rename from plugins/beta/draw-ml/src/mapboxDraw.js rename to plugins/draw-ml/src/mapboxDraw.js diff --git a/plugins/beta/draw-ml/src/mapboxSnap.js b/plugins/draw-ml/src/mapboxSnap.js similarity index 100% rename from plugins/beta/draw-ml/src/mapboxSnap.js rename to plugins/draw-ml/src/mapboxSnap.js diff --git a/plugins/beta/draw-ml/src/modes/createDrawMode.js b/plugins/draw-ml/src/modes/createDrawMode.js similarity index 99% rename from plugins/beta/draw-ml/src/modes/createDrawMode.js rename to plugins/draw-ml/src/modes/createDrawMode.js index 0fe4f63f1..6de9c0606 100644 --- a/plugins/beta/draw-ml/src/modes/createDrawMode.js +++ b/plugins/draw-ml/src/modes/createDrawMode.js @@ -1,5 +1,4 @@ -import createVertex from '../../../../../node_modules/@mapbox/mapbox-gl-draw/src/lib/create_vertex.js' // NOSONAR - +import MapboxDraw from '@mapbox/mapbox-gl-draw' import { getSnapInstance, isSnapActive, @@ -11,6 +10,8 @@ import { createSnappedClickEvent } from '../utils/snapHelpers.js' +const { createVertex } = MapboxDraw.lib + /** * Factory function to create a draw mode for either polygons or lines. * Reduces duplication by sharing common event handling, snap detection, etc. diff --git a/plugins/beta/draw-ml/src/modes/disabledMode.js b/plugins/draw-ml/src/modes/disabledMode.js similarity index 100% rename from plugins/beta/draw-ml/src/modes/disabledMode.js rename to plugins/draw-ml/src/modes/disabledMode.js diff --git a/plugins/beta/draw-ml/src/modes/drawLineMode.js b/plugins/draw-ml/src/modes/drawLineMode.js similarity index 87% rename from plugins/beta/draw-ml/src/modes/drawLineMode.js rename to plugins/draw-ml/src/modes/drawLineMode.js index 1b3aade57..2933f60c3 100644 --- a/plugins/beta/draw-ml/src/modes/drawLineMode.js +++ b/plugins/draw-ml/src/modes/drawLineMode.js @@ -1,7 +1,9 @@ -import DrawLineString from '../../../../../node_modules/@mapbox/mapbox-gl-draw/src/modes/draw_line_string.js' +import MapboxDraw from '@mapbox/mapbox-gl-draw' import { isValidLineClick } from '../utils/spatial.js' import { createDrawMode } from './createDrawMode.js' +const DrawLineString = MapboxDraw.modes.draw_line_string + export const DrawLineMode = createDrawMode(DrawLineString, { featureProp: 'line', geometryType: 'LineString', diff --git a/plugins/beta/draw-ml/src/modes/drawPolygonMode.js b/plugins/draw-ml/src/modes/drawPolygonMode.js similarity index 84% rename from plugins/beta/draw-ml/src/modes/drawPolygonMode.js rename to plugins/draw-ml/src/modes/drawPolygonMode.js index f68fb568a..f2fa0bc4f 100755 --- a/plugins/beta/draw-ml/src/modes/drawPolygonMode.js +++ b/plugins/draw-ml/src/modes/drawPolygonMode.js @@ -1,7 +1,9 @@ -import DrawPolygon from '../../../../../node_modules/@mapbox/mapbox-gl-draw/src/modes/draw_polygon.js' +import MapboxDraw from '@mapbox/mapbox-gl-draw' import { isValidClick } from '../utils/spatial.js' import { createDrawMode } from './createDrawMode.js' +const DrawPolygon = MapboxDraw.modes.draw_polygon + export const DrawPolygonMode = createDrawMode(DrawPolygon, { featureProp: 'polygon', geometryType: 'Polygon', diff --git a/plugins/beta/draw-ml/src/modes/editVertex/geometryHelpers.js b/plugins/draw-ml/src/modes/editVertex/geometryHelpers.js similarity index 100% rename from plugins/beta/draw-ml/src/modes/editVertex/geometryHelpers.js rename to plugins/draw-ml/src/modes/editVertex/geometryHelpers.js diff --git a/plugins/beta/draw-ml/src/modes/editVertex/helpers.js b/plugins/draw-ml/src/modes/editVertex/helpers.js similarity index 100% rename from plugins/beta/draw-ml/src/modes/editVertex/helpers.js rename to plugins/draw-ml/src/modes/editVertex/helpers.js diff --git a/plugins/beta/draw-ml/src/modes/editVertex/touchHandlers.js b/plugins/draw-ml/src/modes/editVertex/touchHandlers.js similarity index 100% rename from plugins/beta/draw-ml/src/modes/editVertex/touchHandlers.js rename to plugins/draw-ml/src/modes/editVertex/touchHandlers.js diff --git a/plugins/beta/draw-ml/src/modes/editVertex/undoHandlers.js b/plugins/draw-ml/src/modes/editVertex/undoHandlers.js similarity index 100% rename from plugins/beta/draw-ml/src/modes/editVertex/undoHandlers.js rename to plugins/draw-ml/src/modes/editVertex/undoHandlers.js diff --git a/plugins/beta/draw-ml/src/modes/editVertex/vertexOperations.js b/plugins/draw-ml/src/modes/editVertex/vertexOperations.js similarity index 100% rename from plugins/beta/draw-ml/src/modes/editVertex/vertexOperations.js rename to plugins/draw-ml/src/modes/editVertex/vertexOperations.js diff --git a/plugins/beta/draw-ml/src/modes/editVertex/vertexQueries.js b/plugins/draw-ml/src/modes/editVertex/vertexQueries.js similarity index 100% rename from plugins/beta/draw-ml/src/modes/editVertex/vertexQueries.js rename to plugins/draw-ml/src/modes/editVertex/vertexQueries.js diff --git a/plugins/beta/draw-ml/src/modes/editVertexMode.js b/plugins/draw-ml/src/modes/editVertexMode.js similarity index 99% rename from plugins/beta/draw-ml/src/modes/editVertexMode.js rename to plugins/draw-ml/src/modes/editVertexMode.js index 86527a913..030e3623c 100755 --- a/plugins/beta/draw-ml/src/modes/editVertexMode.js +++ b/plugins/draw-ml/src/modes/editVertexMode.js @@ -1,4 +1,4 @@ -import DirectSelect from '../../../../../node_modules/@mapbox/mapbox-gl-draw/src/modes/direct_select.js' // NOSONAR +import MapboxDraw from '@mapbox/mapbox-gl-draw' import { getSnapInstance, isSnapActive, isSnapEnabled, getSnapLngLat, getSnapRadius, triggerSnapAtPoint, clearSnapIndicator, clearSnapState @@ -10,6 +10,8 @@ import { touchHandlers } from './editVertex/touchHandlers.js' import { vertexOperations } from './editVertex/vertexOperations.js' import { vertexQueries } from './editVertex/vertexQueries.js' +const DirectSelect = MapboxDraw.modes.direct_select + const ARROW_KEYS = new Set(['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown']) const ARROW_OFFSETS = { ArrowUp: [0, -1], ArrowDown: [0, 1], ArrowLeft: [-1, 0], ArrowRight: [1, 0] } diff --git a/plugins/beta/draw-ml/src/reducer.js b/plugins/draw-ml/src/reducer.js similarity index 100% rename from plugins/beta/draw-ml/src/reducer.js rename to plugins/draw-ml/src/reducer.js diff --git a/plugins/beta/draw-ml/src/styles.js b/plugins/draw-ml/src/styles.js similarity index 100% rename from plugins/beta/draw-ml/src/styles.js rename to plugins/draw-ml/src/styles.js diff --git a/plugins/beta/draw-ml/src/undoStack.js b/plugins/draw-ml/src/undoStack.js similarity index 100% rename from plugins/beta/draw-ml/src/undoStack.js rename to plugins/draw-ml/src/undoStack.js diff --git a/plugins/beta/draw-ml/src/utils/debounce.js b/plugins/draw-ml/src/utils/debounce.js similarity index 100% rename from plugins/beta/draw-ml/src/utils/debounce.js rename to plugins/draw-ml/src/utils/debounce.js diff --git a/plugins/beta/draw-ml/src/utils/flattenStyleProperties.js b/plugins/draw-ml/src/utils/flattenStyleProperties.js similarity index 100% rename from plugins/beta/draw-ml/src/utils/flattenStyleProperties.js rename to plugins/draw-ml/src/utils/flattenStyleProperties.js diff --git a/plugins/beta/draw-ml/src/utils/snapHelpers.js b/plugins/draw-ml/src/utils/snapHelpers.js similarity index 100% rename from plugins/beta/draw-ml/src/utils/snapHelpers.js rename to plugins/draw-ml/src/utils/snapHelpers.js diff --git a/plugins/beta/draw-ml/src/utils/spatial.js b/plugins/draw-ml/src/utils/spatial.js similarity index 100% rename from plugins/beta/draw-ml/src/utils/spatial.js rename to plugins/draw-ml/src/utils/spatial.js diff --git a/plugins/draw-ol/package.json b/plugins/draw-ol/package.json new file mode 100644 index 000000000..7292c7a96 --- /dev/null +++ b/plugins/draw-ol/package.json @@ -0,0 +1,32 @@ +{ + "name": "@defra/interactive-map-plugin-draw-ol", + "version": "0.0.0-development", + "description": "OpenLayers draw plugin for @defra/interactive-map", + "repository": { + "type": "git", + "url": "https://github.com/DEFRA/interactive-map", + "directory": "plugins/draw-ol" + }, + "main": "dist/umd/index.js", + "module": "dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/umd/index.js" + }, + "./css": "./dist/css/index.css" + }, + "type": "module", + "files": ["dist"], + "sideEffects": ["**/*.scss"], + "publishConfig": { "tag": "beta" }, + "dependencies": { + "preact": "^10.27.2", + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*", + "ol": "^10.9.0" + }, + "license": "" +} diff --git a/plugins/beta/draw-ol/src/DrawInit.jsx b/plugins/draw-ol/src/DrawInit.jsx similarity index 97% rename from plugins/beta/draw-ol/src/DrawInit.jsx rename to plugins/draw-ol/src/DrawInit.jsx index 5a4e2ec17..45ce8a78b 100644 --- a/plugins/beta/draw-ol/src/DrawInit.jsx +++ b/plugins/draw-ol/src/DrawInit.jsx @@ -1,5 +1,5 @@ import { useEffect } from 'react' -import { EVENTS } from '../../../../src/config/events.js' +import { EVENTS } from '../../../src/config/events.js' import { createOLDraw } from './olDraw.js' import { attachEvents } from './events.js' diff --git a/plugins/beta/draw-ol/src/api/addFeature.js b/plugins/draw-ol/src/api/addFeature.js similarity index 100% rename from plugins/beta/draw-ol/src/api/addFeature.js rename to plugins/draw-ol/src/api/addFeature.js diff --git a/plugins/beta/draw-ol/src/api/deleteFeature.js b/plugins/draw-ol/src/api/deleteFeature.js similarity index 100% rename from plugins/beta/draw-ol/src/api/deleteFeature.js rename to plugins/draw-ol/src/api/deleteFeature.js diff --git a/plugins/beta/draw-ol/src/api/editFeature.js b/plugins/draw-ol/src/api/editFeature.js similarity index 100% rename from plugins/beta/draw-ol/src/api/editFeature.js rename to plugins/draw-ol/src/api/editFeature.js diff --git a/plugins/beta/draw-ol/src/api/newLine.js b/plugins/draw-ol/src/api/newLine.js similarity index 100% rename from plugins/beta/draw-ol/src/api/newLine.js rename to plugins/draw-ol/src/api/newLine.js diff --git a/plugins/beta/draw-ol/src/api/newPolygon.js b/plugins/draw-ol/src/api/newPolygon.js similarity index 100% rename from plugins/beta/draw-ol/src/api/newPolygon.js rename to plugins/draw-ol/src/api/newPolygon.js diff --git a/plugins/beta/draw-ol/src/core/OLDrawManager.js b/plugins/draw-ol/src/core/OLDrawManager.js similarity index 100% rename from plugins/beta/draw-ol/src/core/OLDrawManager.js rename to plugins/draw-ol/src/core/OLDrawManager.js diff --git a/plugins/beta/draw-ol/src/core/featureStore.js b/plugins/draw-ol/src/core/featureStore.js similarity index 100% rename from plugins/beta/draw-ol/src/core/featureStore.js rename to plugins/draw-ol/src/core/featureStore.js diff --git a/plugins/beta/draw-ol/src/core/styles.js b/plugins/draw-ol/src/core/styles.js similarity index 100% rename from plugins/beta/draw-ol/src/core/styles.js rename to plugins/draw-ol/src/core/styles.js diff --git a/plugins/beta/draw-ol/src/core/undoStack.js b/plugins/draw-ol/src/core/undoStack.js similarity index 100% rename from plugins/beta/draw-ol/src/core/undoStack.js rename to plugins/draw-ol/src/core/undoStack.js diff --git a/plugins/beta/draw-ol/src/defaults.js b/plugins/draw-ol/src/defaults.js similarity index 100% rename from plugins/beta/draw-ol/src/defaults.js rename to plugins/draw-ol/src/defaults.js diff --git a/plugins/beta/draw-ol/src/draw.scss b/plugins/draw-ol/src/draw.scss similarity index 100% rename from plugins/beta/draw-ol/src/draw.scss rename to plugins/draw-ol/src/draw.scss diff --git a/plugins/beta/draw-ol/src/draw/DrawMode.js b/plugins/draw-ol/src/draw/DrawMode.js similarity index 100% rename from plugins/beta/draw-ol/src/draw/DrawMode.js rename to plugins/draw-ol/src/draw/DrawMode.js diff --git a/plugins/beta/draw-ol/src/draw/drawInput.js b/plugins/draw-ol/src/draw/drawInput.js similarity index 100% rename from plugins/beta/draw-ol/src/draw/drawInput.js rename to plugins/draw-ol/src/draw/drawInput.js diff --git a/plugins/beta/draw-ol/src/edit/EditMode.js b/plugins/draw-ol/src/edit/EditMode.js similarity index 100% rename from plugins/beta/draw-ol/src/edit/EditMode.js rename to plugins/draw-ol/src/edit/EditMode.js diff --git a/plugins/beta/draw-ol/src/edit/keyboardHandler.js b/plugins/draw-ol/src/edit/keyboardHandler.js similarity index 100% rename from plugins/beta/draw-ol/src/edit/keyboardHandler.js rename to plugins/draw-ol/src/edit/keyboardHandler.js diff --git a/plugins/beta/draw-ol/src/edit/midpointLayer.js b/plugins/draw-ol/src/edit/midpointLayer.js similarity index 100% rename from plugins/beta/draw-ol/src/edit/midpointLayer.js rename to plugins/draw-ol/src/edit/midpointLayer.js diff --git a/plugins/beta/draw-ol/src/edit/touchHandler.js b/plugins/draw-ol/src/edit/touchHandler.js similarity index 100% rename from plugins/beta/draw-ol/src/edit/touchHandler.js rename to plugins/draw-ol/src/edit/touchHandler.js diff --git a/plugins/beta/draw-ol/src/edit/undoOps.js b/plugins/draw-ol/src/edit/undoOps.js similarity index 100% rename from plugins/beta/draw-ol/src/edit/undoOps.js rename to plugins/draw-ol/src/edit/undoOps.js diff --git a/plugins/beta/draw-ol/src/edit/vertexHitTest.js b/plugins/draw-ol/src/edit/vertexHitTest.js similarity index 100% rename from plugins/beta/draw-ol/src/edit/vertexHitTest.js rename to plugins/draw-ol/src/edit/vertexHitTest.js diff --git a/plugins/beta/draw-ol/src/edit/vertexLayer.js b/plugins/draw-ol/src/edit/vertexLayer.js similarity index 100% rename from plugins/beta/draw-ol/src/edit/vertexLayer.js rename to plugins/draw-ol/src/edit/vertexLayer.js diff --git a/plugins/beta/draw-ol/src/edit/vertexOps.js b/plugins/draw-ol/src/edit/vertexOps.js similarity index 100% rename from plugins/beta/draw-ol/src/edit/vertexOps.js rename to plugins/draw-ol/src/edit/vertexOps.js diff --git a/plugins/beta/draw-ol/src/events.js b/plugins/draw-ol/src/events.js similarity index 100% rename from plugins/beta/draw-ol/src/events.js rename to plugins/draw-ol/src/events.js diff --git a/plugins/beta/draw-ol/src/index.js b/plugins/draw-ol/src/index.js similarity index 100% rename from plugins/beta/draw-ol/src/index.js rename to plugins/draw-ol/src/index.js diff --git a/plugins/beta/draw-ol/src/manifest.js b/plugins/draw-ol/src/manifest.js similarity index 100% rename from plugins/beta/draw-ol/src/manifest.js rename to plugins/draw-ol/src/manifest.js diff --git a/plugins/beta/draw-ol/src/olDraw.js b/plugins/draw-ol/src/olDraw.js similarity index 100% rename from plugins/beta/draw-ol/src/olDraw.js rename to plugins/draw-ol/src/olDraw.js diff --git a/plugins/beta/draw-ol/src/reducer.js b/plugins/draw-ol/src/reducer.js similarity index 100% rename from plugins/beta/draw-ol/src/reducer.js rename to plugins/draw-ol/src/reducer.js diff --git a/plugins/beta/draw-ol/src/snap/snapEngine.js b/plugins/draw-ol/src/snap/snapEngine.js similarity index 100% rename from plugins/beta/draw-ol/src/snap/snapEngine.js rename to plugins/draw-ol/src/snap/snapEngine.js diff --git a/plugins/beta/draw-ol/src/snap/snapGeometry.js b/plugins/draw-ol/src/snap/snapGeometry.js similarity index 100% rename from plugins/beta/draw-ol/src/snap/snapGeometry.js rename to plugins/draw-ol/src/snap/snapGeometry.js diff --git a/plugins/beta/draw-ol/src/snap/snapIndicator.js b/plugins/draw-ol/src/snap/snapIndicator.js similarity index 100% rename from plugins/beta/draw-ol/src/snap/snapIndicator.js rename to plugins/draw-ol/src/snap/snapIndicator.js diff --git a/plugins/beta/draw-ol/src/snap/snapInteraction.js b/plugins/draw-ol/src/snap/snapInteraction.js similarity index 100% rename from plugins/beta/draw-ol/src/snap/snapInteraction.js rename to plugins/draw-ol/src/snap/snapInteraction.js diff --git a/plugins/beta/draw-ol/src/snap/snapManager.js b/plugins/draw-ol/src/snap/snapManager.js similarity index 100% rename from plugins/beta/draw-ol/src/snap/snapManager.js rename to plugins/draw-ol/src/snap/snapManager.js diff --git a/plugins/beta/draw-ol/src/utils/flattenStyleProperties.js b/plugins/draw-ol/src/utils/flattenStyleProperties.js similarity index 100% rename from plugins/beta/draw-ol/src/utils/flattenStyleProperties.js rename to plugins/draw-ol/src/utils/flattenStyleProperties.js diff --git a/plugins/beta/draw-ol/src/utils/geometryHelpers.js b/plugins/draw-ol/src/utils/geometryHelpers.js similarity index 100% rename from plugins/beta/draw-ol/src/utils/geometryHelpers.js rename to plugins/draw-ol/src/utils/geometryHelpers.js diff --git a/plugins/beta/draw-ol/src/utils/olCoords.js b/plugins/draw-ol/src/utils/olCoords.js similarity index 100% rename from plugins/beta/draw-ol/src/utils/olCoords.js rename to plugins/draw-ol/src/utils/olCoords.js diff --git a/plugins/beta/draw-ol/src/utils/resolveColors.js b/plugins/draw-ol/src/utils/resolveColors.js similarity index 100% rename from plugins/beta/draw-ol/src/utils/resolveColors.js rename to plugins/draw-ol/src/utils/resolveColors.js diff --git a/plugins/beta/draw-ol/src/utils/spatial.js b/plugins/draw-ol/src/utils/spatial.js similarity index 100% rename from plugins/beta/draw-ol/src/utils/spatial.js rename to plugins/draw-ol/src/utils/spatial.js diff --git a/plugins/beta/draw-ol/src/utils/touchTarget.js b/plugins/draw-ol/src/utils/touchTarget.js similarity index 100% rename from plugins/beta/draw-ol/src/utils/touchTarget.js rename to plugins/draw-ol/src/utils/touchTarget.js diff --git a/plugins/frame/package.json b/plugins/frame/package.json new file mode 100644 index 000000000..f3f90a289 --- /dev/null +++ b/plugins/frame/package.json @@ -0,0 +1,31 @@ +{ + "name": "@defra/interactive-map-plugin-frame", + "version": "0.0.0-development", + "description": "Frame plugin for @defra/interactive-map", + "repository": { + "type": "git", + "url": "https://github.com/DEFRA/interactive-map", + "directory": "plugins/frame" + }, + "main": "dist/umd/index.js", + "module": "dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/umd/index.js" + }, + "./css": "./dist/css/index.css" + }, + "type": "module", + "files": ["dist"], + "sideEffects": ["**/*.css", "**/*.scss"], + "publishConfig": { "tag": "beta" }, + "dependencies": { + "preact": "^10.27.2", + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*" + }, + "license": "" +} diff --git a/plugins/beta/frame/src/Frame.jsx b/plugins/frame/src/Frame.jsx similarity index 100% rename from plugins/beta/frame/src/Frame.jsx rename to plugins/frame/src/Frame.jsx diff --git a/plugins/beta/frame/src/FrameInit.jsx b/plugins/frame/src/FrameInit.jsx similarity index 100% rename from plugins/beta/frame/src/FrameInit.jsx rename to plugins/frame/src/FrameInit.jsx diff --git a/plugins/beta/frame/src/api/addFrame.js b/plugins/frame/src/api/addFrame.js similarity index 100% rename from plugins/beta/frame/src/api/addFrame.js rename to plugins/frame/src/api/addFrame.js diff --git a/plugins/beta/frame/src/api/editFeature.js b/plugins/frame/src/api/editFeature.js similarity index 100% rename from plugins/beta/frame/src/api/editFeature.js rename to plugins/frame/src/api/editFeature.js diff --git a/plugins/beta/frame/src/config.js b/plugins/frame/src/config.js similarity index 100% rename from plugins/beta/frame/src/config.js rename to plugins/frame/src/config.js diff --git a/plugins/beta/frame/src/frame.scss b/plugins/frame/src/frame.scss similarity index 100% rename from plugins/beta/frame/src/frame.scss rename to plugins/frame/src/frame.scss diff --git a/plugins/beta/frame/src/index.js b/plugins/frame/src/index.js similarity index 100% rename from plugins/beta/frame/src/index.js rename to plugins/frame/src/index.js diff --git a/plugins/beta/frame/src/manifest.js b/plugins/frame/src/manifest.js similarity index 100% rename from plugins/beta/frame/src/manifest.js rename to plugins/frame/src/manifest.js diff --git a/plugins/beta/frame/src/reducer.js b/plugins/frame/src/reducer.js similarity index 100% rename from plugins/beta/frame/src/reducer.js rename to plugins/frame/src/reducer.js diff --git a/plugins/beta/frame/src/utils.js b/plugins/frame/src/utils.js similarity index 100% rename from plugins/beta/frame/src/utils.js rename to plugins/frame/src/utils.js diff --git a/plugins/interact/package.json b/plugins/interact/package.json new file mode 100644 index 000000000..726e89389 --- /dev/null +++ b/plugins/interact/package.json @@ -0,0 +1,29 @@ +{ + "name": "@defra/interactive-map-plugin-interact", + "version": "0.0.0-development", + "description": "Interact plugin for @defra/interactive-map", + "repository": { + "type": "git", + "url": "https://github.com/DEFRA/interactive-map", + "directory": "plugins/interact" + }, + "main": "dist/umd/index.js", + "module": "dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/umd/index.js" + } + }, + "type": "module", + "files": ["dist"], + "sideEffects": false, + "dependencies": { + "preact": "^10.27.2", + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*" + }, + "license": "" +} diff --git a/plugins/map-styles/package.json b/plugins/map-styles/package.json new file mode 100644 index 000000000..eb582cef4 --- /dev/null +++ b/plugins/map-styles/package.json @@ -0,0 +1,31 @@ +{ + "name": "@defra/interactive-map-plugin-map-styles", + "version": "0.0.0-development", + "description": "Map styles plugin for @defra/interactive-map", + "repository": { + "type": "git", + "url": "https://github.com/DEFRA/interactive-map", + "directory": "plugins/map-styles" + }, + "main": "dist/umd/index.js", + "module": "dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/umd/index.js" + }, + "./css": "./dist/css/index.css" + }, + "type": "module", + "files": ["dist"], + "sideEffects": ["**/*.css", "**/*.scss"], + "publishConfig": { "tag": "beta" }, + "dependencies": { + "preact": "^10.27.2", + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*" + }, + "license": "" +} diff --git a/plugins/beta/map-styles/src/MapStyles.jsx b/plugins/map-styles/src/MapStyles.jsx similarity index 95% rename from plugins/beta/map-styles/src/MapStyles.jsx rename to plugins/map-styles/src/MapStyles.jsx index d78e2b73d..98acede2f 100755 --- a/plugins/beta/map-styles/src/MapStyles.jsx +++ b/plugins/map-styles/src/MapStyles.jsx @@ -1,7 +1,7 @@ import React from 'react' -import { EVENTS } from '../../../../src/config/events.js' +import { EVENTS } from '../../../src/config/events.js' import { textSizeSvgPath } from './config.js' -import { scaleFactor } from '../../../../src/config/appConfig.js' +import { scaleFactor } from '../../../src/config/appConfig.js' export const MapStyles = ({ mapState, pluginConfig, services, mapProvider }) => { const { mapStyle: currentMapStyle, mapSize: currentMapSize } = mapState diff --git a/plugins/beta/map-styles/src/MapStylesInit.jsx b/plugins/map-styles/src/MapStylesInit.jsx similarity index 88% rename from plugins/beta/map-styles/src/MapStylesInit.jsx rename to plugins/map-styles/src/MapStylesInit.jsx index eff44cc55..035a19ead 100755 --- a/plugins/beta/map-styles/src/MapStylesInit.jsx +++ b/plugins/map-styles/src/MapStylesInit.jsx @@ -1,6 +1,6 @@ // src/plugins/mapStyles/MapStylesInit.jsx import { useEffect } from 'react' -import { EVENTS } from '../../../../src/config/events.js' +import { EVENTS } from '../../../src/config/events.js' export function MapStylesInit ({ pluginConfig, services }) { const { eventBus } = services diff --git a/plugins/beta/map-styles/src/config.js b/plugins/map-styles/src/config.js similarity index 100% rename from plugins/beta/map-styles/src/config.js rename to plugins/map-styles/src/config.js diff --git a/plugins/beta/map-styles/src/index.js b/plugins/map-styles/src/index.js similarity index 100% rename from plugins/beta/map-styles/src/index.js rename to plugins/map-styles/src/index.js diff --git a/plugins/beta/map-styles/src/manifest.js b/plugins/map-styles/src/manifest.js similarity index 100% rename from plugins/beta/map-styles/src/manifest.js rename to plugins/map-styles/src/manifest.js diff --git a/plugins/beta/map-styles/src/mapStyles.scss b/plugins/map-styles/src/mapStyles.scss similarity index 100% rename from plugins/beta/map-styles/src/mapStyles.scss rename to plugins/map-styles/src/mapStyles.scss diff --git a/plugins/scale-bar/package.json b/plugins/scale-bar/package.json new file mode 100644 index 000000000..8a43d8a9a --- /dev/null +++ b/plugins/scale-bar/package.json @@ -0,0 +1,31 @@ +{ + "name": "@defra/interactive-map-plugin-scale-bar", + "version": "0.0.0-development", + "description": "Scale bar plugin for @defra/interactive-map", + "repository": { + "type": "git", + "url": "https://github.com/DEFRA/interactive-map", + "directory": "plugins/scale-bar" + }, + "main": "dist/umd/index.js", + "module": "dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/umd/index.js" + }, + "./css": "./dist/css/index.css" + }, + "type": "module", + "files": ["dist"], + "sideEffects": ["**/*.css", "**/*.scss"], + "publishConfig": { "tag": "beta" }, + "dependencies": { + "preact": "^10.27.2", + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*" + }, + "license": "" +} diff --git a/plugins/beta/scale-bar/src/ScaleBar.jsx b/plugins/scale-bar/src/ScaleBar.jsx similarity index 100% rename from plugins/beta/scale-bar/src/ScaleBar.jsx rename to plugins/scale-bar/src/ScaleBar.jsx diff --git a/plugins/beta/scale-bar/src/ScaleBar.test.jsx b/plugins/scale-bar/src/ScaleBar.test.jsx similarity index 100% rename from plugins/beta/scale-bar/src/ScaleBar.test.jsx rename to plugins/scale-bar/src/ScaleBar.test.jsx diff --git a/plugins/beta/scale-bar/src/index.js b/plugins/scale-bar/src/index.js similarity index 100% rename from plugins/beta/scale-bar/src/index.js rename to plugins/scale-bar/src/index.js diff --git a/plugins/beta/scale-bar/src/index.test.js b/plugins/scale-bar/src/index.test.js similarity index 100% rename from plugins/beta/scale-bar/src/index.test.js rename to plugins/scale-bar/src/index.test.js diff --git a/plugins/beta/scale-bar/src/manifest.js b/plugins/scale-bar/src/manifest.js similarity index 100% rename from plugins/beta/scale-bar/src/manifest.js rename to plugins/scale-bar/src/manifest.js diff --git a/plugins/beta/scale-bar/src/scaleBar.scss b/plugins/scale-bar/src/scaleBar.scss similarity index 100% rename from plugins/beta/scale-bar/src/scaleBar.scss rename to plugins/scale-bar/src/scaleBar.scss diff --git a/plugins/beta/scale-bar/src/utils.js b/plugins/scale-bar/src/utils.js similarity index 100% rename from plugins/beta/scale-bar/src/utils.js rename to plugins/scale-bar/src/utils.js diff --git a/plugins/beta/scale-bar/src/utils.test.js b/plugins/scale-bar/src/utils.test.js similarity index 100% rename from plugins/beta/scale-bar/src/utils.test.js rename to plugins/scale-bar/src/utils.test.js diff --git a/plugins/search/package.json b/plugins/search/package.json new file mode 100644 index 000000000..ee5e6f590 --- /dev/null +++ b/plugins/search/package.json @@ -0,0 +1,30 @@ +{ + "name": "@defra/interactive-map-plugin-search", + "version": "0.0.0-development", + "description": "Search plugin for @defra/interactive-map", + "repository": { + "type": "git", + "url": "https://github.com/DEFRA/interactive-map", + "directory": "plugins/search" + }, + "main": "dist/umd/index.js", + "module": "dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/umd/index.js" + }, + "./css": "./dist/css/index.css" + }, + "type": "module", + "files": ["dist"], + "sideEffects": ["**/*.css", "**/*.scss"], + "dependencies": { + "preact": "^10.27.2", + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*" + }, + "license": "" +} diff --git a/plugins/use-location/package.json b/plugins/use-location/package.json new file mode 100644 index 000000000..44b32b617 --- /dev/null +++ b/plugins/use-location/package.json @@ -0,0 +1,30 @@ +{ + "name": "@defra/interactive-map-plugin-use-location", + "version": "0.0.0-development", + "description": "Use-location plugin for @defra/interactive-map", + "repository": { + "type": "git", + "url": "https://github.com/DEFRA/interactive-map", + "directory": "plugins/use-location" + }, + "main": "dist/umd/index.js", + "module": "dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/umd/index.js" + } + }, + "type": "module", + "files": ["dist"], + "sideEffects": false, + "publishConfig": { "tag": "beta" }, + "dependencies": { + "preact": "^10.27.2", + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*" + }, + "license": "" +} diff --git a/plugins/beta/use-location/src/UseLocation.jsx b/plugins/use-location/src/UseLocation.jsx similarity index 100% rename from plugins/beta/use-location/src/UseLocation.jsx rename to plugins/use-location/src/UseLocation.jsx diff --git a/plugins/beta/use-location/src/UseLocationInit.jsx b/plugins/use-location/src/UseLocationInit.jsx similarity index 100% rename from plugins/beta/use-location/src/UseLocationInit.jsx rename to plugins/use-location/src/UseLocationInit.jsx diff --git a/plugins/beta/use-location/src/defaults.js b/plugins/use-location/src/defaults.js similarity index 100% rename from plugins/beta/use-location/src/defaults.js rename to plugins/use-location/src/defaults.js diff --git a/plugins/beta/use-location/src/events.js b/plugins/use-location/src/events.js similarity index 100% rename from plugins/beta/use-location/src/events.js rename to plugins/use-location/src/events.js diff --git a/plugins/beta/use-location/src/index.js b/plugins/use-location/src/index.js similarity index 100% rename from plugins/beta/use-location/src/index.js rename to plugins/use-location/src/index.js diff --git a/plugins/beta/use-location/src/manifest.js b/plugins/use-location/src/manifest.js similarity index 100% rename from plugins/beta/use-location/src/manifest.js rename to plugins/use-location/src/manifest.js diff --git a/plugins/beta/use-location/src/reducer.js b/plugins/use-location/src/reducer.js similarity index 100% rename from plugins/beta/use-location/src/reducer.js rename to plugins/use-location/src/reducer.js diff --git a/providers/esri/package.json b/providers/esri/package.json new file mode 100644 index 000000000..01b12ca10 --- /dev/null +++ b/providers/esri/package.json @@ -0,0 +1,29 @@ +{ + "name": "@defra/interactive-map-provider-esri", + "version": "0.0.0-development", + "description": "ArcGIS/ESRI provider for @defra/interactive-map", + "repository": { + "type": "git", + "url": "https://github.com/DEFRA/interactive-map", + "directory": "providers/esri" + }, + "module": "dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/esm/index.js" + }, + "./css": "./dist/css/index.css" + }, + "type": "module", + "files": ["dist"], + "sideEffects": ["**/*.css", "**/*.scss"], + "publishConfig": { "tag": "beta" }, + "dependencies": { + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*", + "@arcgis/core": "^5.0.9" + }, + "license": "" +} diff --git a/providers/beta/esri/src/appEvents.js b/providers/esri/src/appEvents.js similarity index 100% rename from providers/beta/esri/src/appEvents.js rename to providers/esri/src/appEvents.js diff --git a/providers/beta/esri/src/defaults.js b/providers/esri/src/defaults.js similarity index 100% rename from providers/beta/esri/src/defaults.js rename to providers/esri/src/defaults.js diff --git a/providers/beta/esri/src/esriProvider.js b/providers/esri/src/esriProvider.js similarity index 100% rename from providers/beta/esri/src/esriProvider.js rename to providers/esri/src/esriProvider.js diff --git a/providers/beta/esri/src/esriProvider.scss b/providers/esri/src/esriProvider.scss similarity index 100% rename from providers/beta/esri/src/esriProvider.scss rename to providers/esri/src/esriProvider.scss diff --git a/providers/beta/esri/src/index.js b/providers/esri/src/index.js similarity index 71% rename from providers/beta/esri/src/index.js rename to providers/esri/src/index.js index 1720dbe39..0ef17b507 100644 --- a/providers/beta/esri/src/index.js +++ b/providers/esri/src/index.js @@ -27,16 +27,11 @@ export default function createEsriProvider (config = {}) { crs: 'EPSG:27700' } - try { - const MapProvider = (await import(/* webpackChunkName: "im-esri-provider" */ './esriProvider.js')).default + const MapProvider = (await import(/* webpackChunkName: "im-esri-provider" */ './esriProvider.js')).default - return { - MapProvider, - mapProviderConfig - } - } catch (error) { - console.error('Failed to load map provider', error) - throw error + return { + MapProvider, + mapProviderConfig } } } diff --git a/providers/beta/esri/src/mapEvents.js b/providers/esri/src/mapEvents.js similarity index 96% rename from providers/beta/esri/src/mapEvents.js rename to providers/esri/src/mapEvents.js index a790113d4..19986421f 100644 --- a/providers/beta/esri/src/mapEvents.js +++ b/providers/esri/src/mapEvents.js @@ -1,6 +1,6 @@ import { watch, when, once } from '@arcgis/core/core/reactiveUtils.js' -import { debounce } from '../../../../src/utils/debounce.js' -import { throttle } from '../../../../src/utils/throttle.js' +import { debounce } from '../../../src/utils/debounce.js' +import { throttle } from '../../../src/utils/throttle.js' const DEBOUNCE_IDLE_TIME = 500 const MOVE_THROTTLE_TIME = 10 diff --git a/providers/beta/esri/src/utils/coords.js b/providers/esri/src/utils/coords.js similarity index 100% rename from providers/beta/esri/src/utils/coords.js rename to providers/esri/src/utils/coords.js diff --git a/providers/beta/esri/src/utils/coords.test.js b/providers/esri/src/utils/coords.test.js similarity index 100% rename from providers/beta/esri/src/utils/coords.test.js rename to providers/esri/src/utils/coords.test.js diff --git a/providers/beta/esri/src/utils/detectWebGL.js b/providers/esri/src/utils/detectWebGL.js similarity index 100% rename from providers/beta/esri/src/utils/detectWebGL.js rename to providers/esri/src/utils/detectWebGL.js diff --git a/providers/beta/esri/src/utils/esriFixes.js b/providers/esri/src/utils/esriFixes.js similarity index 100% rename from providers/beta/esri/src/utils/esriFixes.js rename to providers/esri/src/utils/esriFixes.js diff --git a/providers/beta/esri/src/utils/query.js b/providers/esri/src/utils/query.js similarity index 100% rename from providers/beta/esri/src/utils/query.js rename to providers/esri/src/utils/query.js diff --git a/providers/beta/esri/src/utils/spatial.js b/providers/esri/src/utils/spatial.js similarity index 100% rename from providers/beta/esri/src/utils/spatial.js rename to providers/esri/src/utils/spatial.js diff --git a/providers/beta/esri/src/utils/spatial.test.js b/providers/esri/src/utils/spatial.test.js similarity index 100% rename from providers/beta/esri/src/utils/spatial.test.js rename to providers/esri/src/utils/spatial.test.js diff --git a/providers/maplibre/package.json b/providers/maplibre/package.json new file mode 100644 index 000000000..c05315791 --- /dev/null +++ b/providers/maplibre/package.json @@ -0,0 +1,29 @@ +{ + "name": "@defra/interactive-map-provider-maplibre", + "version": "0.0.0-development", + "description": "MapLibre GL JS provider for @defra/interactive-map", + "repository": { + "type": "git", + "url": "https://github.com/DEFRA/interactive-map", + "directory": "providers/maplibre" + }, + "main": "dist/umd/index.js", + "module": "dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/umd/index.js" + } + }, + "type": "module", + "files": ["dist"], + "sideEffects": false, + "dependencies": { + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*", + "maplibre-gl": "^5.23.0" + }, + "license": "" +} diff --git a/providers/open-names/package.json b/providers/open-names/package.json new file mode 100644 index 000000000..644e57f06 --- /dev/null +++ b/providers/open-names/package.json @@ -0,0 +1,29 @@ +{ + "name": "@defra/interactive-map-provider-open-names", + "version": "0.0.0-development", + "description": "OS Open Names search provider for @defra/interactive-map", + "repository": { + "type": "git", + "url": "https://github.com/DEFRA/interactive-map", + "directory": "providers/open-names" + }, + "main": "dist/umd/index.js", + "module": "dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/umd/index.js" + } + }, + "type": "module", + "files": ["dist"], + "sideEffects": false, + "publishConfig": { "tag": "beta" }, + "dependencies": { + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*" + }, + "license": "" +} diff --git a/providers/beta/open-names/src/index.js b/providers/open-names/src/index.js similarity index 100% rename from providers/beta/open-names/src/index.js rename to providers/open-names/src/index.js diff --git a/providers/beta/open-names/src/reverseGeocode.js b/providers/open-names/src/reverseGeocode.js similarity index 100% rename from providers/beta/open-names/src/reverseGeocode.js rename to providers/open-names/src/reverseGeocode.js diff --git a/providers/beta/open-names/src/utils/mapToLocationModel.js b/providers/open-names/src/utils/mapToLocationModel.js similarity index 100% rename from providers/beta/open-names/src/utils/mapToLocationModel.js rename to providers/open-names/src/utils/mapToLocationModel.js diff --git a/providers/beta/open-names/src/utils/mapToLocationModel.test.js b/providers/open-names/src/utils/mapToLocationModel.test.js similarity index 100% rename from providers/beta/open-names/src/utils/mapToLocationModel.test.js rename to providers/open-names/src/utils/mapToLocationModel.test.js diff --git a/providers/openlayers/package.json b/providers/openlayers/package.json new file mode 100644 index 000000000..0b5ba81aa --- /dev/null +++ b/providers/openlayers/package.json @@ -0,0 +1,31 @@ +{ + "name": "@defra/interactive-map-provider-openlayers", + "version": "0.0.0-development", + "description": "OpenLayers provider for @defra/interactive-map", + "repository": { + "type": "git", + "url": "https://github.com/DEFRA/interactive-map", + "directory": "providers/openlayers" + }, + "main": "dist/umd/index.js", + "module": "dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/umd/index.js" + } + }, + "type": "module", + "files": ["dist"], + "sideEffects": false, + "publishConfig": { "tag": "beta" }, + "dependencies": { + "@babel/runtime": "^7.28.6" + }, + "peerDependencies": { + "@defra/interactive-map": "*", + "ol": "^10.9.0", + "proj4": "^2.20.8" + }, + "license": "" +} diff --git a/providers/beta/openlayers/src/appEvents.js b/providers/openlayers/src/appEvents.js similarity index 100% rename from providers/beta/openlayers/src/appEvents.js rename to providers/openlayers/src/appEvents.js diff --git a/providers/beta/openlayers/src/appEvents.test.js b/providers/openlayers/src/appEvents.test.js similarity index 100% rename from providers/beta/openlayers/src/appEvents.test.js rename to providers/openlayers/src/appEvents.test.js diff --git a/providers/beta/openlayers/src/defaults.js b/providers/openlayers/src/defaults.js similarity index 100% rename from providers/beta/openlayers/src/defaults.js rename to providers/openlayers/src/defaults.js diff --git a/providers/beta/openlayers/src/index.js b/providers/openlayers/src/index.js similarity index 100% rename from providers/beta/openlayers/src/index.js rename to providers/openlayers/src/index.js diff --git a/providers/beta/openlayers/src/mapEvents.js b/providers/openlayers/src/mapEvents.js similarity index 96% rename from providers/beta/openlayers/src/mapEvents.js rename to providers/openlayers/src/mapEvents.js index 59795d814..0d73a9e3d 100644 --- a/providers/beta/openlayers/src/mapEvents.js +++ b/providers/openlayers/src/mapEvents.js @@ -1,5 +1,5 @@ -import { debounce } from '../../../../src/utils/debounce.js' -import { throttle } from '../../../../src/utils/throttle.js' +import { debounce } from '../../../src/utils/debounce.js' +import { throttle } from '../../../src/utils/throttle.js' import { ZOOM_TOLERANCE } from './defaults.js' const DEBOUNCE_IDLE_TIME = 500 diff --git a/providers/beta/openlayers/src/mapEvents.test.js b/providers/openlayers/src/mapEvents.test.js similarity index 98% rename from providers/beta/openlayers/src/mapEvents.test.js rename to providers/openlayers/src/mapEvents.test.js index e4d5fda6c..83e4f7320 100644 --- a/providers/beta/openlayers/src/mapEvents.test.js +++ b/providers/openlayers/src/mapEvents.test.js @@ -3,7 +3,7 @@ import { attachMapEvents } from './mapEvents.js' const mockDebounceFns = [] -jest.mock('../../../../src/utils/debounce.js', () => ({ +jest.mock('../../../src/utils/debounce.js', () => ({ __esModule: true, debounce: (fn) => { const wrapper = jest.fn() @@ -14,7 +14,7 @@ jest.mock('../../../../src/utils/debounce.js', () => ({ })) // Passthrough throttle: calls fn immediately (no cancel needed, not added to debouncers) -jest.mock('../../../../src/utils/throttle.js', () => ({ +jest.mock('../../../src/utils/throttle.js', () => ({ __esModule: true, throttle: (fn) => jest.fn(fn) })) diff --git a/providers/beta/openlayers/src/openlayersProvider.js b/providers/openlayers/src/openlayersProvider.js similarity index 100% rename from providers/beta/openlayers/src/openlayersProvider.js rename to providers/openlayers/src/openlayersProvider.js diff --git a/providers/beta/openlayers/src/openlayersProvider.test.js b/providers/openlayers/src/openlayersProvider.test.js similarity index 100% rename from providers/beta/openlayers/src/openlayersProvider.test.js rename to providers/openlayers/src/openlayersProvider.test.js diff --git a/providers/beta/openlayers/src/utils/highlightFeatures.js b/providers/openlayers/src/utils/highlightFeatures.js similarity index 100% rename from providers/beta/openlayers/src/utils/highlightFeatures.js rename to providers/openlayers/src/utils/highlightFeatures.js diff --git a/providers/beta/openlayers/src/utils/hoverCursor.js b/providers/openlayers/src/utils/hoverCursor.js similarity index 100% rename from providers/beta/openlayers/src/utils/hoverCursor.js rename to providers/openlayers/src/utils/hoverCursor.js diff --git a/providers/beta/openlayers/src/utils/hoverCursor.test.js b/providers/openlayers/src/utils/hoverCursor.test.js similarity index 100% rename from providers/beta/openlayers/src/utils/hoverCursor.test.js rename to providers/openlayers/src/utils/hoverCursor.test.js diff --git a/providers/beta/openlayers/src/utils/openLayersFixes.js b/providers/openlayers/src/utils/openLayersFixes.js similarity index 100% rename from providers/beta/openlayers/src/utils/openLayersFixes.js rename to providers/openlayers/src/utils/openLayersFixes.js diff --git a/providers/beta/openlayers/src/utils/openLayersFixes.test.js b/providers/openlayers/src/utils/openLayersFixes.test.js similarity index 100% rename from providers/beta/openlayers/src/utils/openLayersFixes.test.js rename to providers/openlayers/src/utils/openLayersFixes.test.js diff --git a/providers/beta/openlayers/src/utils/queryFeatures.js b/providers/openlayers/src/utils/queryFeatures.js similarity index 100% rename from providers/beta/openlayers/src/utils/queryFeatures.js rename to providers/openlayers/src/utils/queryFeatures.js diff --git a/providers/beta/openlayers/src/utils/queryFeatures.test.js b/providers/openlayers/src/utils/queryFeatures.test.js similarity index 100% rename from providers/beta/openlayers/src/utils/queryFeatures.test.js rename to providers/openlayers/src/utils/queryFeatures.test.js diff --git a/providers/beta/openlayers/src/utils/spatial.js b/providers/openlayers/src/utils/spatial.js similarity index 100% rename from providers/beta/openlayers/src/utils/spatial.js rename to providers/openlayers/src/utils/spatial.js diff --git a/providers/beta/openlayers/src/utils/spatial.test.js b/providers/openlayers/src/utils/spatial.test.js similarity index 100% rename from providers/beta/openlayers/src/utils/spatial.test.js rename to providers/openlayers/src/utils/spatial.test.js diff --git a/providers/beta/openlayers/src/utils/tileLayers.js b/providers/openlayers/src/utils/tileLayers.js similarity index 100% rename from providers/beta/openlayers/src/utils/tileLayers.js rename to providers/openlayers/src/utils/tileLayers.js diff --git a/providers/beta/openlayers/src/utils/tileLayers.test.js b/providers/openlayers/src/utils/tileLayers.test.js similarity index 100% rename from providers/beta/openlayers/src/utils/tileLayers.test.js rename to providers/openlayers/src/utils/tileLayers.test.js diff --git a/providers/beta/openlayers/src/utils/vtTileFragments.js b/providers/openlayers/src/utils/vtTileFragments.js similarity index 100% rename from providers/beta/openlayers/src/utils/vtTileFragments.js rename to providers/openlayers/src/utils/vtTileFragments.js diff --git a/providers/beta/openlayers/src/utils/zoom.js b/providers/openlayers/src/utils/zoom.js similarity index 100% rename from providers/beta/openlayers/src/utils/zoom.js rename to providers/openlayers/src/utils/zoom.js diff --git a/providers/beta/openlayers/src/utils/zoom.test.js b/providers/openlayers/src/utils/zoom.test.js similarity index 100% rename from providers/beta/openlayers/src/utils/zoom.test.js rename to providers/openlayers/src/utils/zoom.test.js diff --git a/rollup.esm.mjs b/rollup.esm.mjs index f9cfef484..4a923cdce 100644 --- a/rollup.esm.mjs +++ b/rollup.esm.mjs @@ -220,18 +220,18 @@ const ALL_BUILDS = [ manualChunks: (id) => { if (id.includes('/maplibreProvider')) return 'im-maplibre-provider' } }, { - entryPath: './providers/beta/open-names/src/index.js', - outDir: 'providers/beta/open-names/dist/esm', + entryPath: './providers/open-names/src/index.js', + outDir: 'providers/open-names/dist/esm', manualChunks: (id) => { if (id.includes('/reverseGeocode')) return 'im-reverse-geocode' } }, { - entryPath: './providers/beta/esri/src/index.js', - outDir: 'providers/beta/esri/dist/esm', + entryPath: './providers/esri/src/index.js', + outDir: 'providers/esri/dist/esm', manualChunks: (id) => { if (id.includes('/esriProvider')) return 'im-esri-provider' } }, { - entryPath: './providers/beta/openlayers/src/index.js', - outDir: 'providers/beta/openlayers/dist/esm', + entryPath: './providers/openlayers/src/index.js', + outDir: 'providers/openlayers/dist/esm', extraExternals: [/^ol\//, 'proj4'], manualChunks: (id) => { if (id.includes('/openlayersProvider')) { @@ -242,13 +242,13 @@ const ALL_BUILDS = [ // Plugins — each lazy-loads ./manifest.js; manualChunks names that split chunk { - entryPath: './plugins/beta/scale-bar/src/index.js', - outDir: 'plugins/beta/scale-bar/dist/esm', + entryPath: './plugins/scale-bar/src/index.js', + outDir: 'plugins/scale-bar/dist/esm', manualChunks: (id) => { if (id.includes('/manifest')) return 'im-scale-bar-plugin' } }, { - entryPath: './plugins/beta/use-location/src/index.js', - outDir: 'plugins/beta/use-location/dist/esm', + entryPath: './plugins/use-location/src/index.js', + outDir: 'plugins/use-location/dist/esm', manualChunks: (id) => { if (id.includes('/manifest')) return 'im-use-location-plugin' } }, { @@ -262,37 +262,41 @@ const ALL_BUILDS = [ manualChunks: (id) => { if (id.includes('/manifest')) return 'im-interact-plugin' } }, { - entryPath: './plugins/beta/datasets/src/index.js', - outDir: 'plugins/beta/datasets/dist/esm', + entryPath: './plugins/datasets/src/index.js', + outDir: 'plugins/datasets/dist/esm', manualChunks: (id) => { if (id.includes('/manifest')) return 'im-datasets-plugin' if (id.includes('maplibreLayerAdapter')) return 'im-datasets-ml-adapter' } }, { - entryPath: './plugins/beta/map-styles/src/index.js', - outDir: 'plugins/beta/map-styles/dist/esm', + entryPath: './plugins/datasets/src/adapters/maplibre/index.js', + outDir: 'plugins/datasets/dist/adapters/maplibre/esm' + }, + { + entryPath: './plugins/map-styles/src/index.js', + outDir: 'plugins/map-styles/dist/esm', manualChunks: (id) => { if (id.includes('/manifest')) return 'im-map-styles-plugin' } }, { - entryPath: './plugins/beta/draw-ml/src/index.js', - outDir: 'plugins/beta/draw-ml/dist/esm', + entryPath: './plugins/draw-ml/src/index.js', + outDir: 'plugins/draw-ml/dist/esm', manualChunks: (id) => { if (id.includes('/manifest')) return 'im-draw-ml-plugin' } }, { - entryPath: './plugins/beta/draw-es/src/index.js', - outDir: 'plugins/beta/draw-es/dist/esm', + entryPath: './plugins/draw-es/src/index.js', + outDir: 'plugins/draw-es/dist/esm', manualChunks: (id) => { if (id.includes('/manifest')) return 'im-draw-es-plugin' } }, { - entryPath: './plugins/beta/draw-ol/src/index.js', - outDir: 'plugins/beta/draw-ol/dist/esm', + entryPath: './plugins/draw-ol/src/index.js', + outDir: 'plugins/draw-ol/dist/esm', extraExternals: [/^ol\//], manualChunks: (id) => { if (id.includes('/manifest')) return 'im-draw-ol-plugin' } }, { - entryPath: './plugins/beta/frame/src/index.js', - outDir: 'plugins/beta/frame/dist/esm', + entryPath: './plugins/frame/src/index.js', + outDir: 'plugins/frame/dist/esm', manualChunks: (id) => { if (id.includes('/manifest')) return 'im-frame-plugin' } } ] diff --git a/scripts/publish-package.sh b/scripts/publish-package.sh index 9d43dd3a2..855392aa9 100755 --- a/scripts/publish-package.sh +++ b/scripts/publish-package.sh @@ -2,7 +2,7 @@ set -e -VERSION_PATTERN="^v([0-9]{1,}.[0-9]{1,}.[0-9]{1,})(-[0-9A-Za-z-].*)?$" +VERSION_PATTERN="^v([0-9]{1,}\.[0-9]{1,}\.[0-9]{1,})(-[0-9A-Za-z-].*)?$" PRE_RELEASE_PATTERN="(-[0-9A-Za-z-].*)$" validate_arguments() { @@ -23,72 +23,249 @@ validate_version_format() { get_published_version() { local major_version=$1 - local published=$(npm view "${PACKAGE_NAME}@^${major_version}.0.0" version --json 2>/dev/null | jq -r '.[-1]' 2>/dev/null || echo "") - - if [ -z "$published" ] || [ "$published" = "null" ]; then + # Range is ${major}.x, NOT ^${major}.0.0 — for major 0 a caret range collapses + # to ">=0.0.0 <0.0.1" and matches nothing, disabling this check for all 0.x. + # npm returns a bare JSON string (not an array) when exactly one version + # matches, so normalise both shapes to one version per line. + local matched + # `| strings` drops non-string output — on failure npm prints an {"error":…} + # object to stdout with --json, which must not be mistaken for a version. + matched=$(npm view "${PACKAGE_NAME}@${major_version}.x" version --json 2>/dev/null \ + | jq -r 'if type=="array" then .[] else . end | strings' 2>/dev/null || true) + + # npm lists versions in publish order, not semver order (a hand-published + # backport would be last) — semver-sort and take the highest. + local highest="" + if [ -n "$matched" ]; then + # shellcheck disable=SC2086 — versions are single tokens; splitting is intended + highest=$(npx --yes semver $matched 2>/dev/null | tail -n 1 || true) + fi + + if [ -z "$highest" ] || [ "$highest" = "null" ]; then echo "0.0.0" else - echo "$published" + echo "$highest" fi } validate_version_bump() { local new_version="${TAG_NAME#v}" local major_version=$(echo "$new_version" | cut -d. -f1) - + echo "Package: ${PACKAGE_NAME}" echo "Checking version constraints for v${major_version}.x line..." - + local published_version=$(get_published_version "$major_version") - + echo "Latest v${major_version}.x published: $published_version" echo "New version to publish: $new_version" - - if npx --yes semver "$new_version" -r "<=$published_version" >/dev/null 2>&1; then - echo "ERROR: Version $new_version is not greater than published version $published_version in the v${major_version}.x line" + + # Require positive proof the new version is GREATER. The previous inverted + # check ("fail if <= matches") treated any failure of the semver tool itself + # (npx fetch error, malformed version string) as a pass. + # --include-prerelease so a prerelease like 1.2.3-alpha.1 can satisfy ">1.2.2". + if ! npx --yes semver --include-prerelease "$new_version" -r ">$published_version" >/dev/null 2>&1; then + echo "ERROR: Version $new_version is not greater than published version $published_version in the v${major_version}.x line (or the semver check itself failed)" exit 1 fi - + echo "✓ Version check passed" } +stamp_versions() { + local version="${TAG_NAME#v}" + npm pkg set version="$version" + for pkg_dir in providers/* plugins/*; do + [ -f "$pkg_dir/package.json" ] || continue + npm pkg set version="$version" --prefix "$pkg_dir" + npm pkg set "peerDependencies.@defra/interactive-map"="$version" --prefix "$pkg_dir" + done +} + +assert_version() { + local pkg_dir=$1 + local expected=$2 + local actual + actual=$(jq -r '.version' "${pkg_dir}/package.json") + if [ "$actual" != "$expected" ]; then + echo "ERROR: version mismatch in $pkg_dir — expected $expected, got $actual" + exit 1 + fi +} + determine_release_tag() { if [[ "$IS_PRE_RELEASE" == "true" ]] || [[ "$TAG_NAME" =~ $PRE_RELEASE_PATTERN ]]; then - echo "pre-release" + echo "alpha" else echo "latest" fi } -publish_package() { +determine_pkg_tag() { + local pkg_dir=$1 + if [[ "$IS_PRE_RELEASE" == "true" ]] || [[ "$TAG_NAME" =~ $PRE_RELEASE_PATTERN ]]; then + echo "alpha" + return + fi + jq -r '.publishConfig.tag // "latest"' "$pkg_dir/package.json" +} + +# Pre-flight gate — runs after version validation (and after the build, which +# happens in the workflow before this script), but BEFORE any package.json is +# stamped and BEFORE anything is published. It asserts every package (core + all +# workspaces) can be published at the target version, so a problem aborts the +# whole release while nothing has been mutated or published yet — instead of +# dying mid-loop and leaving a partial, inconsistent release. +# +# It checks all packages and reports every failure (does not stop at the first), +# so the operator can fix everything in one pass. +# +# What it catches: +# 1. Package not registered on npm → a new package that was never bootstrapped +# (seed + trusted publishing). See RELEASING.md. +# 2. Target version already published → collision / re-run of a partial release. +# 3. Package not publishable → missing build output or invalid package.json +# (via `npm publish --dry-run`, no registry/auth). +# +# What it CANNOT catch: whether OIDC trusted publishing is correctly configured +# for a package that *does* exist — there is no way to exercise the OIDC token +# exchange without actually publishing. Check 1 catches the common case (a brand +# new package that was never seeded). For a package's first real release we still +# print a reminder to confirm trusted publishing is set up. +preflight_checks() { + local version="${TAG_NAME#v}" + local release_tag + release_tag=$(determine_release_tag) + local failures=0 + local count=0 + + echo "── Pre-flight: verifying every package can publish ${version} (nothing is published yet) ──" + + local pkg_dirs=(".") + for d in providers/* plugins/*; do + [ -f "$d/package.json" ] && pkg_dirs+=("$d") + done + + for pkg_dir in "${pkg_dirs[@]}"; do + count=$((count + 1)) + local name versions_json + name=$(jq -r '.name' "$pkg_dir/package.json") + + # 1. Registered on npm? (tag-independent — a seeded package has no `latest` yet) + # Only npm's explicit E404 means "does not exist"; any other failure + # (network, registry outage) means we cannot tell — report that instead + # of sending the operator off to bootstrap an existing package. + if ! versions_json=$(npm view "$name" versions --json 2>/dev/null); then + local view_err + view_err=$(npm view "$name" versions --json 2>&1 >/dev/null || true) + if echo "$view_err" | grep -q "E404"; then + echo " ✗ ${name}: not found on npm — needs one-time bootstrap (seed + trusted publishing)." + echo " Fix: follow RELEASING.md → 'One-time bootstrap', then re-run the release." + else + echo " ✗ ${name}: could not query npm (network/registry error) — unable to verify." + echo " Fix: re-run the release; if it persists, check https://status.npmjs.org." + fi + failures=$((failures + 1)) + continue + fi + + # 2. Target version not already published? + if echo "$versions_json" | jq -e --arg v "$version" \ + 'if type=="array" then index($v) else . == $v end' >/dev/null; then + echo " ✗ ${name}: version ${version} is already published — bump the release version." + echo " Fix: see RELEASING.md → 'Troubleshooting' (a partial release usually needs a new patch version)." + failures=$((failures + 1)) + continue + fi + + # 3. Packable? (no registry/auth — validates build output + package.json). + # --tag is required or npm refuses to (dry-)publish a prerelease version. + # The ./ prefix is load-bearing: a bare "providers/maplibre" is parsed by + # npm as a GitHub owner/repo shorthand, not a local directory. + if ! npm publish "./${pkg_dir}" --dry-run --tag "$release_tag" >/dev/null 2>&1; then + echo " ✗ ${name}: 'npm publish --dry-run' failed — missing build output or invalid package.json." + echo " Fix: see RELEASING.md → 'Troubleshooting'." + failures=$((failures + 1)) + continue + fi + + # Reminder: a package whose only published versions are 0.0.0 seed placeholders + # is having its first real release — the moment a missing OIDC config would bite. + if echo "$versions_json" | jq -e \ + 'if type=="array" then all(.[]; startswith("0.0.0")) else startswith("0.0.0") end' >/dev/null; then + echo " ✓ ${name} (ℹ first real release — confirm trusted publishing is configured, RELEASING.md Step 2)" + else + echo " ✓ ${name}" + fi + done + + if [ "$failures" -gt 0 ]; then + echo "" + echo "Pre-flight FAILED: ${failures} of ${count} package(s) cannot be published. Nothing was published." + echo "Resolve the issues above, then create a new GitHub Release to re-run." + echo "See RELEASING.md for the full release and bootstrap procedure: https://github.com/DEFRA/interactive-map/blob/main/RELEASING.md" + exit 1 + fi + + echo "✓ Pre-flight passed — all ${count} packages can publish ${version}." +} + +publish_all() { local release_tag=$1 - local new_version="${TAG_NAME#v}" - - echo "Publishing ${PACKAGE_NAME}@${new_version} to npm with tag: ${release_tag}" - + local version="${TAG_NAME#v}" + + echo "Publishing ${PACKAGE_NAME}@${version} to npm with tag: ${release_tag}" + if [ "$DRY_RUN" = "true" ]; then - echo "[DRY RUN] Would run: npm version --no-git-tag-version ${TAG_NAME}" echo "[DRY RUN] Would run: npm publish --access public --tag=${release_tag}" else - npm version --no-git-tag-version "${TAG_NAME}" + assert_version "." "$version" npm publish --access public --tag="${release_tag}" fi - - echo "✓ Successfully published ${PACKAGE_NAME}@${new_version}" + + echo "✓ Published ${PACKAGE_NAME}@${version}" + + for pkg_dir in providers/* plugins/*; do + [ -f "$pkg_dir/package.json" ] || continue + local pkg_name + pkg_name=$(jq -r '.name' "$pkg_dir/package.json") + local pkg_tag + pkg_tag=$(determine_pkg_tag "$pkg_dir") + + echo "Publishing ${pkg_name}@${version} to npm with tag: ${pkg_tag}" + + if [ "$DRY_RUN" = "true" ]; then + echo "[DRY RUN] Would run: npm publish ./${pkg_dir} --access public --tag=${pkg_tag}" + else + assert_version "$pkg_dir" "$version" + npm publish "./${pkg_dir}" --access public --tag="${pkg_tag}" + fi + + echo "✓ Published ${pkg_name}@${version}" + done } main() { - PACKAGE_NAME=$(npm pkg get name | tr -d '"') + PACKAGE_NAME=$(jq -r '.name' package.json) TAG_NAME="${1:-}" IS_PRE_RELEASE="${2:-false}" DRY_RUN="${3:-false}" - + validate_arguments validate_version_format validate_version_bump - + preflight_checks + + # A dry run must not mutate the working tree — stamping rewrites the version + # and peer pins in every package.json. + if [ "$DRY_RUN" = "true" ]; then + echo "[DRY RUN] Skipping version stamping — no files are modified in a dry run." + else + stamp_versions + fi + RELEASE_TAG=$(determine_release_tag) - publish_package "$RELEASE_TAG" + publish_all "$RELEASE_TAG" } main "$@" diff --git a/scripts/seed-packages.sh b/scripts/seed-packages.sh new file mode 100755 index 000000000..500ceab2e --- /dev/null +++ b/scripts/seed-packages.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# One-time bootstrap for NEW workspace packages (providers/* and plugins/*). +# +# npm OIDC trusted publishing can only be configured on a package that already +# exists on the registry — there is no "pending publisher" concept. So a brand +# new package cannot be published by the OIDC-only publish.yml on its first run. +# +# This script publishes a BARE placeholder (just package.json, no dist) for any +# package that does not yet exist on npm, under a dedicated `seed` dist-tag so it +# never occupies `latest`/`beta`/`alpha`. Once the name exists you can configure +# a trusted publisher for it (see RELEASING.md), after which the normal +# release pipeline (publish.yml) takes over via OIDC — no token required again. +# +# Auth: relies on npm being authenticated already (NODE_AUTH_TOKEN / .npmrc). +# Usage: ./scripts/seed-packages.sh [dry_run] + +set -e + +SEED_TAG="seed" +DRY_RUN="${1:-false}" + +seed_all() { + local seeded=0 + local skipped=0 + + for pkg_dir in providers/* plugins/*; do + [ -f "$pkg_dir/package.json" ] || continue + + local name version + name=$(jq -r '.name' "$pkg_dir/package.json") + version=$(jq -r '.version' "$pkg_dir/package.json") + + # Skip anything already on the registry — seeding only registers new names. + # Use `versions` (the tag-independent packument) rather than `version`, which + # resolves the `latest` dist-tag: a package that's been seeded but not yet + # released has no `latest`, and we must still treat it as existing. + if npm view "$name" versions >/dev/null 2>&1; then + echo "✓ ${name} already exists on npm — skipping" + skipped=$((skipped + 1)) + continue + fi + + # npm view failed: only an explicit E404 means "does not exist". Anything + # else (network error, registry outage, rate limit) means we cannot tell — + # abort rather than risk bare-publishing over a package that does exist. + local view_err + view_err=$(npm view "$name" versions 2>&1 >/dev/null || true) + if ! echo "$view_err" | grep -q "E404"; then + echo "ERROR: could not query npm for ${name} (network/registry error?) — aborting, nothing further seeded." + echo "$view_err" | head -3 + exit 1 + fi + + echo "Seeding ${name}@${version} to npm with tag: ${SEED_TAG}" + if [ "$DRY_RUN" = "true" ]; then + echo "[DRY RUN] Would run: npm publish ./${pkg_dir} --access public --tag=${SEED_TAG}" + else + npm publish "./${pkg_dir}" --access public --tag="${SEED_TAG}" + fi + echo "✓ Seeded ${name}" + seeded=$((seeded + 1)) + done + + echo "" + echo "Done. Seeded: ${seeded}, already existed: ${skipped}." + if [ "$seeded" -gt 0 ]; then + echo "Next: configure OIDC trusted publishing for each newly seeded package (see RELEASING.md)." + fi +} + +seed_all diff --git a/sonar-project.properties b/sonar-project.properties index fe09fd311..259665e2b 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -11,7 +11,11 @@ sonar.javascript.lcov.reportPaths=coverage/lcov.info sonar.sourceEncoding=UTF-8 sonar.sources=src,plugins,providers -sonar.exclusions=**/*.test.*,**/__mocks__/**,**/__stubs__/**,**/dist/**,**/node_modules/**,plugins/beta/**,providers/beta/** +# Beta-status packages (publishConfig.tag=beta) are excluded from analysis, as +# they were under the old plugins/beta/ + providers/beta/ layout. Mirrors +# coveragePathIgnorePatterns in jest.config.mjs. When a package graduates to +# stable, remove it from both lists. +sonar.exclusions=**/*.test.*,**/__mocks__/**,**/__stubs__/**,**/dist/**,**/node_modules/**,plugins/datasets/**,plugins/draw-es/**,plugins/draw-ml/**,plugins/draw-ol/**,plugins/frame/**,plugins/map-styles/**,plugins/scale-bar/**,plugins/use-location/**,providers/esri/**,providers/open-names/**,providers/openlayers/** sonar.tests=src,plugins,providers sonar.test.inclusions=**/*.test.*,**/__mocks__/**,**/__stubs__/** sonar.cpd.exclusions=**/*.test.*,**/__mocks__/**,**/__stubs__/** diff --git a/webpack.umd.mjs b/webpack.umd.mjs index 3704729f2..9c7aa888b 100755 --- a/webpack.umd.mjs +++ b/webpack.umd.mjs @@ -136,18 +136,19 @@ const ALL_BUILDS = [ // Providers { entryPath: './providers/maplibre/src/index.js', libraryPath: 'maplibreProvider', outDir: 'providers/maplibre/dist/umd' }, - { entryPath: './providers/beta/open-names/src/index.js', libraryPath: 'openNamesProvider', outDir: 'providers/beta/open-names/dist/umd' }, - { entryPath: './providers/beta/openlayers/src/index.js', libraryPath: 'openLayersProvider', outDir: 'providers/beta/openlayers/dist/umd' }, + { entryPath: './providers/open-names/src/index.js', libraryPath: 'openNamesProvider', outDir: 'providers/open-names/dist/umd' }, + { entryPath: './providers/openlayers/src/index.js', libraryPath: 'openLayersProvider', outDir: 'providers/openlayers/dist/umd' }, // Plugins - { entryPath: './plugins/beta/scale-bar/src/index.js', libraryPath: 'scaleBarPlugin', outDir: 'plugins/beta/scale-bar/dist/umd' }, - { entryPath: './plugins/beta/use-location/src/index.js', libraryPath: 'useLocationPlugin', outDir: 'plugins/beta/use-location/dist/umd' }, + { entryPath: './plugins/scale-bar/src/index.js', libraryPath: 'scaleBarPlugin', outDir: 'plugins/scale-bar/dist/umd' }, + { entryPath: './plugins/use-location/src/index.js', libraryPath: 'useLocationPlugin', outDir: 'plugins/use-location/dist/umd' }, { entryPath: './plugins/search/src/index.js', libraryPath: 'searchPlugin', outDir: 'plugins/search/dist/umd' }, { entryPath: './plugins/interact/src/index.js', libraryPath: 'interactPlugin', outDir: 'plugins/interact/dist/umd' }, - { entryPath: './plugins/beta/datasets/src/index.js', libraryPath: 'datasetsPlugin', outDir: 'plugins/beta/datasets/dist/umd', cssOutDir: 'plugins/beta/datasets/dist' }, - { entryPath: './plugins/beta/map-styles/src/index.js', libraryPath: 'mapStylesPlugin', outDir: 'plugins/beta/map-styles/dist/umd' }, - { entryPath: './plugins/beta/draw-ml/src/index.js', libraryPath: 'drawMLPlugin', outDir: 'plugins/beta/draw-ml/dist/umd' }, - { entryPath: './plugins/beta/frame/src/index.js', libraryPath: 'framePlugin', outDir: 'plugins/beta/frame/dist/umd' } + { entryPath: './plugins/datasets/src/index.js', libraryPath: 'datasetsPlugin', outDir: 'plugins/datasets/dist/umd', cssOutDir: 'plugins/datasets/dist' }, + { entryPath: './plugins/map-styles/src/index.js', libraryPath: 'mapStylesPlugin', outDir: 'plugins/map-styles/dist/umd' }, + { entryPath: './plugins/draw-ml/src/index.js', libraryPath: 'drawMLPlugin', outDir: 'plugins/draw-ml/dist/umd' }, + { entryPath: './plugins/draw-ol/src/index.js', libraryPath: 'drawOLPlugin', outDir: 'plugins/draw-ol/dist/umd' }, + { entryPath: './plugins/frame/src/index.js', libraryPath: 'framePlugin', outDir: 'plugins/frame/dist/umd' } ] // === Filter via environment variable ===