Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce number of dependencies #2628

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
with:
fetch-depth: 0

- uses: pnpm/action-setup@v2.4.0
- uses: pnpm/action-setup@v4
with:
version: 8
version: 9

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
with:
fetch-depth: 0

- uses: pnpm/action-setup@v2.4.0
- uses: pnpm/action-setup@v4
with:
version: 8
version: 9

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/turf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x, 22.x]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v4
with:
version: 8
version: 9
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would strongly prefer that the build tooling changes go into another PR. Technically removing supported node versions is a break, but also 16 is EOL'd. We might consider just adding 22 and not removing 16 unless we want to 'sneak' that break into 7.x.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, makes sense. I just only have pnpm 9 installed on my machine and unfortunately they've dropped support for older node versions

if a maintainer would like to grab any changes you'd like to keep from this PR and send it, please feel free to do so

#2623 is already accomplishing most of what I was aiming for, so I'd also be happy to close this one if that's easier

run_install: false

- run: pnpm install --frozen-lockfile
Expand Down
4 changes: 2 additions & 2 deletions packages/turf-helpers/lib/geojson-equality.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
MultiPoint,
MultiPolygon,
} from "geojson";
import equal from "deep-equal";
import { dequal } from "dequal";

/**

Expand Down Expand Up @@ -159,7 +159,7 @@ export class GeojsonEquality {
private compareFeature(g1: Feature, g2: Feature) {
return (
g1.id === g2.id &&
(this.compareProperties ? equal(g1.properties, g2.properties) : true) &&
(this.compareProperties ? dequal(g1.properties, g2.properties) : true) &&
this.compareBBox(g1, g2) &&
this.compare(g1.geometry, g2.geometry)
);
Expand Down
3 changes: 1 addition & 2 deletions packages/turf-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
},
"devDependencies": {
"@types/benchmark": "^2.1.5",
"@types/deep-equal": "^1.0.4",
"@types/tape": "^4.2.32",
"benchmark": "^2.1.4",
"npm-run-all": "^4.1.5",
Expand All @@ -69,7 +68,7 @@
"typescript": "^5.2.2"
},
"dependencies": {
"deep-equal": "^2.2.3",
"dequal": "^2.0.3",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you consider fast-deep-equal at all? I hadn't heard of dequal but it seems plenty popular. I didn't compare final bundle sizes with both, but they're both much smaller than deep-equals

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they both seem pretty good. I don't really have much of a preference for one vs the other

"tslib": "^2.6.2"
}
}
12 changes: 6 additions & 6 deletions packages/turf-line-overlap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
GeoJsonProperties,
} from "geojson";
import { featureCollection, isObject } from "@turf/helpers";
import equal from "deep-equal";
import { dequal } from "dequal";

/**
* Takes any LineString or Polygon and returns the overlapping lines between both features.
Expand Down Expand Up @@ -76,7 +76,7 @@ function lineOverlap<
var coordsMatch: any = getCoords(match).sort();

// Segment overlaps feature
if (equal(coordsSegment, coordsMatch)) {
if (dequal(coordsSegment, coordsMatch)) {
doesOverlaps = true;
// Overlaps already exists - only append last coordinate of segment
if (overlapSegment) {
Expand Down Expand Up @@ -155,10 +155,10 @@ function concatSegment(
var end = lineCoords[lineCoords.length - 1];
var geom = line.geometry.coordinates;

if (equal(coords[0], start)) geom.unshift(coords[1]);
else if (equal(coords[0], end)) geom.push(coords[1]);
else if (equal(coords[1], start)) geom.unshift(coords[0]);
else if (equal(coords[1], end)) geom.push(coords[0]);
if (dequal(coords[0], start)) geom.unshift(coords[1]);
else if (dequal(coords[0], end)) geom.push(coords[1]);
else if (dequal(coords[1], start)) geom.unshift(coords[0]);
else if (dequal(coords[1], end)) geom.push(coords[0]);
else return; // If the overlap leaves the segment unchanged, return undefined so that this can be identified.

// Otherwise return the mutated line.
Expand Down
3 changes: 1 addition & 2 deletions packages/turf-line-overlap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
},
"devDependencies": {
"@types/benchmark": "^2.1.5",
"@types/deep-equal": "^1.0.4",
"@types/tape": "^4.2.32",
"benchmark": "^2.1.4",
"load-json-file": "^7.0.1",
Expand All @@ -76,7 +75,7 @@
"@turf/line-segment": "workspace:^",
"@turf/meta": "workspace:^",
"@turf/nearest-point-on-line": "workspace:^",
"deep-equal": "^2.2.3",
"dequal": "^2.0.3",
"tslib": "^2.6.2"
}
}
Loading