Skip to content

Commit

Permalink
RC #251 - Testing moving @peripleo/maplibre to peer dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
dleadbetter committed Feb 21, 2024
1 parent 828e5c7 commit d369638
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 16 deletions.
3 changes: 2 additions & 1 deletion packages/core-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions packages/core-data/src/components/PlaceMarker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @flow

import { useMap } from '@peripleo/maplibre';
import { LocationMarker } from '@performant-software/geospatial';
import React, { useCallback, useEffect, useState } from 'react';

Expand Down Expand Up @@ -53,7 +52,6 @@ const PlaceMarker = (props: Props) => {
return (
<LocationMarker
data={place}
useMap={useMap}
/>
);
};
Expand Down
3 changes: 2 additions & 1 deletion packages/geospatial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down
13 changes: 4 additions & 9 deletions packages/geospatial/src/components/LocationMarker.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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;
Expand All @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions packages/geospatial/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 1 addition & 2 deletions packages/storybook/src/geospatial/LocationMarker.stories.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -35,7 +35,6 @@ export const Default = () => (
31.4252249
]
}}
useMap={useMap}
/>
</div>
</Map>
Expand Down
1 change: 0 additions & 1 deletion packages/webpack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ module.exports = {
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader',
{
loader: 'less-loader',
options: {
Expand Down

0 comments on commit d369638

Please sign in to comment.