From d3696380b5d77774a59a3b24822f89cebb74633f Mon Sep 17 00:00:00 2001 From: dleadbetter <> Date: Wed, 21 Feb 2024 07:42:46 -0500 Subject: [PATCH] RC #251 - Testing moving @peripleo/maplibre to peer dependency --- packages/core-data/package.json | 3 ++- packages/core-data/src/components/PlaceMarker.js | 2 -- packages/geospatial/package.json | 3 ++- .../geospatial/src/components/LocationMarker.js | 13 ++++--------- packages/geospatial/webpack.config.js | 3 +++ .../src/geospatial/LocationMarker.stories.js | 3 +-- packages/webpack/index.js | 1 - 7 files changed, 12 insertions(+), 16 deletions(-) diff --git a/packages/core-data/package.json b/packages/core-data/package.json index 16070978..36103783 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -9,7 +9,6 @@ "build": "webpack --mode production && flow-copy-source -v src types" }, "dependencies": { - "@peripleo/maplibre": "^0.3.3", "@performant-software/geospatial": "^1.2.0-beta.10", "@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-dialog": "^1.0.5", @@ -22,11 +21,13 @@ "underscore": "^1.13.2" }, "peerDependencies": { + "@peripleo/maplibre": "^0.3.3", "react": ">= 16.13.1 < 19.0.0", "react-dom": ">= 16.13.1 < 19.0.0" }, "devDependencies": { "@babel/plugin-proposal-private-property-in-object": "^7.21.11", + "@peripleo/maplibre": "^0.3.3", "@performant-software/webpack-config": "^1.0.0", "autoprefixer": "^10.4.17", "mini-css-extract-plugin": "^2.8.0", diff --git a/packages/core-data/src/components/PlaceMarker.js b/packages/core-data/src/components/PlaceMarker.js index e793f987..9a0ba749 100644 --- a/packages/core-data/src/components/PlaceMarker.js +++ b/packages/core-data/src/components/PlaceMarker.js @@ -1,6 +1,5 @@ // @flow -import { useMap } from '@peripleo/maplibre'; import { LocationMarker } from '@performant-software/geospatial'; import React, { useCallback, useEffect, useState } from 'react'; @@ -53,7 +52,6 @@ const PlaceMarker = (props: Props) => { return ( ); }; diff --git a/packages/geospatial/package.json b/packages/geospatial/package.json index b20f109a..d042fed0 100644 --- a/packages/geospatial/package.json +++ b/packages/geospatial/package.json @@ -10,7 +10,6 @@ }, "dependencies": { "@mapbox/mapbox-gl-draw": "^1.4.3", - "@peripleo/maplibre": "^0.3.3", "@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-dialog": "^1.0.5", "@samvera/clover-iiif": "^2.3.2", @@ -23,10 +22,12 @@ "underscore": "^1.13.6" }, "peerDependencies": { + "@peripleo/maplibre": "^0.3.3", "react": ">= 16.13.1 < 19.0.0", "react-dom": ">= 16.13.1 < 19.0.0" }, "devDependencies": { + "@peripleo/maplibre": "^0.3.3", "@performant-software/webpack-config": "^1.0.0", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/packages/geospatial/src/components/LocationMarker.js b/packages/geospatial/src/components/LocationMarker.js index ac07fe89..38646306 100644 --- a/packages/geospatial/src/components/LocationMarker.js +++ b/packages/geospatial/src/components/LocationMarker.js @@ -1,7 +1,7 @@ // @flow -import React, { useEffect, useMemo } from 'react'; -import { MixedGeoJSONLayer, PulsingMarkerLayer, type Map } from '@peripleo/maplibre'; +import React, { useEffect } from 'react'; +import { MixedGeoJSONLayer, PulsingMarkerLayer, useMap } from '@peripleo/maplibre'; import { DEFAULT_FILL_STYLE, DEFAULT_POINT_STYLE, DEFAULT_STROKE_STYLE } from '../utils/MapStyles'; import MapUtils from '../utils/Map'; @@ -29,12 +29,7 @@ type Props = { /** * GeoJSON layer stroke style */ - strokeStyle?: { [key: string]: any }, - - /** - * Hook used to retrieve the map instance. - */ - useMap?: () => Map + strokeStyle?: { [key: string]: any } }; const DEFAULT_BUFFER = 2; @@ -43,7 +38,7 @@ const DEFAULT_BUFFER = 2; * This component renders a location marker to be used in a Peripleo context. */ const LocationMarker = (props: Props) => { - const map = useMemo(() => props.useMap(), [props.useMap]); + const map = useMap(); /** * Sets the bounding box on the map. diff --git a/packages/geospatial/webpack.config.js b/packages/geospatial/webpack.config.js index 60a17bd6..3e080291 100644 --- a/packages/geospatial/webpack.config.js +++ b/packages/geospatial/webpack.config.js @@ -2,6 +2,9 @@ const { configure } = require('@performant-software/webpack-config'); const path = require('path'); module.exports = configure(__dirname, { + externals: [ + '@peripleo/maplibre' + ], resolve: { alias: { './@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css$': path.resolve( diff --git a/packages/storybook/src/geospatial/LocationMarker.stories.js b/packages/storybook/src/geospatial/LocationMarker.stories.js index 069d65d9..0e6c37a6 100644 --- a/packages/storybook/src/geospatial/LocationMarker.stories.js +++ b/packages/storybook/src/geospatial/LocationMarker.stories.js @@ -1,7 +1,7 @@ // @flow import { Peripleo, Controls } from '@peripleo/peripleo'; -import { Map, Zoom, useMap } from '@peripleo/maplibre'; +import { Map, Zoom } from '@peripleo/maplibre'; import React from 'react'; import LocationMarker from '../../../geospatial/src/components/LocationMarker'; import mapStyle from '../data/MapStyles.json'; @@ -35,7 +35,6 @@ export const Default = () => ( 31.4252249 ] }} - useMap={useMap} /> diff --git a/packages/webpack/index.js b/packages/webpack/index.js index c4a31de5..292eec80 100644 --- a/packages/webpack/index.js +++ b/packages/webpack/index.js @@ -78,7 +78,6 @@ module.exports = { use: [ MiniCssExtractPlugin.loader, 'css-loader', - 'postcss-loader', { loader: 'less-loader', options: {