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

Merge turf:master into experimental dx branch #2682

Closed
wants to merge 7 commits into from
11 changes: 9 additions & 2 deletions .monorepolint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as fs from "node:fs";
import {
alphabeticalDependencies,
alphabeticalScripts,
fileContents,
packageOrder,
packageEntry,
packageScript,
Expand Down Expand Up @@ -50,6 +51,13 @@ const JS_TAPE_PACKAGES = TAPE_PACKAGES.filter(

export default {
rules: [
fileContents({
options: {
file: "tsconfig.testTypes.json",
templateFile: "./templates/tsconfig.testTypes.json",
},
includePackages: TYPES_PACKAGES,
}),
packageOrder({
options: {
order: [
Expand Down Expand Up @@ -209,8 +217,7 @@ export default {
packageScript({
options: {
scripts: {
"test:types":
"tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts",
"test:types": "tsc -p ./tsconfig.testTypes.json",
},
},
includePackages: TYPES_PACKAGES,
Expand Down
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"{projectRoot}/test/**",
"{projectRoot}/types.ts"
],
"dependsOn": ["build"],
"dependsOn": [],
Copy link
Collaborator

Choose a reason for hiding this comment

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

I will make a follow-up PR to sort out some caching issues. Unless you're executing tasks with pnpm lerna run test --scope=@turf/pkg this file doesn't come into play though, and CI doesn't cache anything so we're safe there as well.

Copy link
Collaborator

Choose a reason for hiding this comment

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

#2685 is the change to the inputs to fix test caching. I intentionally didn't remove the build dependsOn entry because you're doing that here and I didn't want to conflict.

"cache": true
},
"last-checks": {
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
"lint:eslint": "eslint packages",
"lint:mrl": "mrl check",
"lint:prettier": "prettier --check .",
"postinstall": "husky install",
"preinstall": "npx only-allow pnpm",
"prepare": "lerna run build && husky install",
"test": "pnpm run lint && lerna run test && lerna run --scope @turf/turf last-checks"
"prepublish": "lerna run build && lerna run --scope @turf/turf last-checks",
"test": "lerna run test"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a couple thoughts here:

  1. it dropped pnpm run lint
  2. I don't remember exactly why but I think last-checks depends on lerna run test?

What do you think about making a new script entry:
`"ci": "lerna run build && lerna run lint && lerna run test && lerna run --scope @turf/turf last-checks"

And then just calling this new script explicitly in the .github/*.yml files?
We could also break build / lint / (test & last checks) into 3 different scripts for more granular timings on CI. In general I think we can get away from some of the magic script names that make pnpm do things at certain lifecycle moments.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I looked into this some more and last-checks only depends on last-checks:testjs to run before last-checks:example and it doesn't actually depend on the other packages, so that seems safe to move. I'm not actually sure why it lives in its own step, I'll make a PR cleaning that up.

Copy link
Collaborator

Choose a reason for hiding this comment

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

#2690 cleans up some last-checks

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I'm leaning towards the following:

package.json scripts:

"build": "lerna run build",
"lint": "lerna run lint",
"test": "lerna run test"

github workflows:
run: pnpm build added after run: pnpm install --frozen-lockfile everywhere
run: pnpm lint added before run: pnpm test everywhere

This also will cause us to need to make changes in the CONTRIBUTING.md file

  • Local Setup no longer requires pnpm test
  • Development tips and Pull Request Checklist can probably also recommend running pnpm lint

},
"lint-staged": {
"package.json": [
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-boolean-touches/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@types/benchmark": "^2.1.5",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-boolean-touches/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
2 changes: 1 addition & 1 deletion packages/turf-boolean-within/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@types/benchmark": "^2.1.5",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-boolean-within/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
2 changes: 1 addition & 1 deletion packages/turf-buffer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@turf/truncate": "workspace:^",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-buffer/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
2 changes: 1 addition & 1 deletion packages/turf-center-mean/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@turf/center": "workspace:^",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-center-mean/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
2 changes: 1 addition & 1 deletion packages/turf-center-of-mass/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@types/benchmark": "^2.1.5",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-center-of-mass/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
2 changes: 1 addition & 1 deletion packages/turf-center/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@turf/bbox-polygon": "workspace:^",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-center/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
2 changes: 1 addition & 1 deletion packages/turf-centroid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@types/benchmark": "^2.1.5",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-centroid/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
2 changes: 1 addition & 1 deletion packages/turf-circle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@placemarkio/check-geojson": "^0.1.12",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-circle/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
2 changes: 1 addition & 1 deletion packages/turf-clean-coords/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@turf/truncate": "workspace:^",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-clean-coords/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
2 changes: 1 addition & 1 deletion packages/turf-clone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@turf/meta": "workspace:^",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-clone/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
4 changes: 2 additions & 2 deletions packages/turf-clusters-dbscan/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { GeoJsonProperties, FeatureCollection, Point } from "geojson";
import { clone } from "@turf/clone";
import { distance } from "@turf/distance";
import { degreesToRadians, lengthToDegrees, Units } from "@turf/helpers";
import { rbush as RBush } from "./lib/rbush-export.js";
import rbush from "rbush";

type Dbscan = "core" | "edge" | "noise";
type DbscanProps = GeoJsonProperties & {
Expand Down Expand Up @@ -67,7 +67,7 @@ function clustersDbscan(
const latDistanceInDegrees = lengthToDegrees(maxDistance, options.units);

// Create a spatial index
var tree = new RBush(points.features.length);
var tree = new rbush(points.features.length);

// Keeps track of whether a point has been visited or not.
var visited = points.features.map((_) => false);
Expand Down
7 changes: 0 additions & 7 deletions packages/turf-clusters-dbscan/lib/rbush-export.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/turf-clusters-dbscan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@turf/centroid": "workspace:^",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-clusters-dbscan/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
2 changes: 1 addition & 1 deletion packages/turf-clusters-kmeans/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@turf/centroid": "workspace:^",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-clusters-kmeans/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
2 changes: 1 addition & 1 deletion packages/turf-clusters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@types/benchmark": "^2.1.5",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-clusters/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
2 changes: 1 addition & 1 deletion packages/turf-collect/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FeatureCollection, Polygon, Point } from "geojson";
import { bbox as turfbbox } from "@turf/bbox";
import { booleanPointInPolygon } from "@turf/boolean-point-in-polygon";
import { rbush } from "./lib/rbush-export.js";
import rbush from "rbush";

interface Entry {
minX: number;
Expand Down
7 changes: 0 additions & 7 deletions packages/turf-collect/lib/rbush-export.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/turf-flatten/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@types/benchmark": "^2.1.5",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-flatten/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
2 changes: 1 addition & 1 deletion packages/turf-flip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@types/benchmark": "^2.1.5",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-flip/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
2 changes: 1 addition & 1 deletion packages/turf-geojson-rbush/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@turf/bbox-polygon": "workspace:^",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-geojson-rbush/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
2 changes: 1 addition & 1 deletion packages/turf-great-circle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@turf/truncate": "workspace:^",
Expand Down
7 changes: 7 additions & 0 deletions packages/turf-great-circle/tsconfig.testTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"noEmit": true
},
"include": ["types.ts"]
}
2 changes: 1 addition & 1 deletion packages/turf-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tsc -p ./tsconfig.testTypes.json"
},
"devDependencies": {
"@types/benchmark": "^2.1.5",
Expand Down
Loading