Skip to content

Commit f9cca95

Browse files
authored
Merge branch 'master' into fix/multipoint-polygon-boundary
2 parents 2e42938 + 552f23a commit f9cca95

178 files changed

Lines changed: 3397 additions & 3735 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
strategy:
21+
fail-fast: false
2122
matrix:
22-
node-version: [18.x, 20.x, 22.x, 24.x]
23+
node-version: [18.x, 20.x, 22.x, 24.x, 26.x]
2324

2425
steps:
2526
- name: Checkout

.github/workflows/prerelease.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
fail-fast: true
1717
matrix:
1818
node:
19-
- 20
19+
- 26
2020
platform:
2121
- ubuntu-latest
2222
name: "${{matrix.platform}} / Node.js ${{ matrix.node }}"
@@ -36,21 +36,14 @@ jobs:
3636
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # 4.3.0
3737
with:
3838
node-version: ${{ matrix.node-version }}
39-
registry-url: "https://registry.npmjs.org"
4039
cache: "pnpm"
4140

42-
- run: npm whoami
43-
env:
44-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
45-
4641
- run: pnpm install --frozen-lockfile
4742

4843
- run: pnpm test
4944

5045
- name: run publish
51-
run: lerna publish from-package --ignore-scripts true --yes
52-
env:
53-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
46+
run: pnpm -r publish --no-git-checks --provenance --access public
5447

5548
- name: Create Github Release
5649
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # 2.2.1

.gitignore

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,16 @@
1-
.rpt2_cache
1+
# our build directories
22
packages/*/dist
3-
main.js
4-
main.es.js
5-
main.mjs
6-
main.min.js
7-
index.mjs
8-
*.min.js
9-
*.es5.js
10-
.esm-cache
11-
package-lock.json
12-
env
13-
.nyc_output
14-
lib-cov
15-
*.seed
16-
*.log
17-
*.csv
18-
*.dat
19-
*.out
20-
*.pid
21-
.idea/*
22-
types.js
23-
.DS_Store
24-
types.d.ts
25-
26-
pids
27-
logs
28-
results
29-
30-
npm-debug.log*
313

4+
# pnpm-specific
325
node_modules
6+
pnpm-debug.log*
337

8+
# build caches
9+
.nx
10+
11+
# editor-specific
3412
.vscode
13+
.idea
3514

36-
.nx/
37-
.cursor/rules/nx-rules.mdc
38-
.github/instructions/nx.instructions.md
15+
# os-specific
16+
.DS_Store

.monorepolint.config.mjs

Lines changed: 57 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,49 @@
11
// @ts-check
22
import * as path from "node:path";
3-
import { glob } from "glob";
4-
import * as fs from "node:fs";
3+
import { existsSync } from "node:fs";
4+
import * as fs from "node:fs/promises";
55
import {
66
alphabeticalDependencies,
77
alphabeticalScripts,
88
packageOrder,
99
packageEntry,
1010
packageScript,
1111
requireDependency,
12+
REMOVE,
1213
} from "@monorepolint/rules";
1314

14-
const TS_PACKAGES = []; // projects that use typescript to build
15-
const JS_PACKAGES = []; // projects that use javascript/rollup to build
15+
const PACKAGES = []; // packages that aren't @turf/turf
1616
const MAIN_PACKAGE = "@turf/turf";
1717

18-
const TAPE_PACKAGES = []; // projects that have tape tests
19-
const TYPES_PACKAGES = []; // projects that have types tests
20-
const BENCH_PACKAGES = []; // projects that have benchmarks
18+
const TAPE_PACKAGES = []; // packages that have tape tests
19+
const TYPES_PACKAGES = []; // packages that have types tests
20+
const TSTYCHE_PACKAGES = []; // packages that use tstyche for type tests.
2121

2222
// iterate all the packages and figure out what buckets everything falls into
23-
const __dirname = new URL(".", import.meta.url).pathname;
24-
glob.sync(path.join(__dirname, "packages", "turf-*")).forEach((pk) => {
23+
const packagesPath = path.join(process.cwd(), "packages");
24+
for (const pk of await fs.readdir(packagesPath)) {
25+
if (pk === "turf") {
26+
continue;
27+
}
28+
2529
const name = JSON.parse(
26-
fs.readFileSync(path.join(pk, "package.json"), "utf8")
30+
await fs.readFile(path.join(packagesPath, pk, "package.json"), "utf8")
2731
).name;
2832

29-
if (fs.existsSync(path.join(pk, "index.ts"))) {
30-
TS_PACKAGES.push(name);
31-
} else {
32-
JS_PACKAGES.push(name);
33-
}
33+
PACKAGES.push(name);
3434

35-
if (fs.existsSync(path.join(pk, "test.js"))) {
35+
if (existsSync(path.join(pk, "test.js"))) {
3636
TAPE_PACKAGES.push(name);
3737
}
3838

39-
if (fs.existsSync(path.join(pk, "types.ts"))) {
39+
if (existsSync(path.join(packagesPath, pk, "types.ts"))) {
4040
TYPES_PACKAGES.push(name);
4141
}
42-
});
4342

44-
const TS_TAPE_PACKAGES = TAPE_PACKAGES.filter(
45-
(pkg) => -1 !== TS_PACKAGES.indexOf(pkg)
46-
);
47-
const JS_TAPE_PACKAGES = TAPE_PACKAGES.filter(
48-
(pkg) => -1 !== JS_PACKAGES.indexOf(pkg)
49-
);
43+
if (existsSync(path.join(packagesPath, pk, "test/types.tst.ts"))) {
44+
TSTYCHE_PACKAGES.push(name);
45+
}
46+
}
5047

5148
export default {
5249
rules: [
@@ -147,7 +144,7 @@ export default {
147144
},
148145
},
149146
},
150-
includePackages: [...TS_PACKAGES, ...JS_PACKAGES],
147+
includePackages: PACKAGES,
151148
}),
152149

153150
packageEntry({
@@ -156,7 +153,7 @@ export default {
156153
files: ["dist"],
157154
},
158155
},
159-
includePackages: [...TS_PACKAGES, ...JS_PACKAGES],
156+
includePackages: PACKAGES,
160157
}),
161158

162159
packageEntry({
@@ -170,7 +167,7 @@ export default {
170167
packageScript({
171168
options: {
172169
scripts: {
173-
docs: "tsx ../../scripts/generate-readmes.ts",
170+
docs: REMOVE,
174171
test: "pnpm run /test:.*/",
175172
},
176173
},
@@ -183,7 +180,7 @@ export default {
183180
build: "tsup --config ../../tsup.config.ts",
184181
},
185182
},
186-
includePackages: [...TS_PACKAGES, ...JS_PACKAGES],
183+
includePackages: PACKAGES,
187184
}),
188185

189186
packageScript({
@@ -203,7 +200,7 @@ export default {
203200
"test:tape": "tsx test.ts",
204201
},
205202
},
206-
includePackages: [...TS_TAPE_PACKAGES, ...JS_TAPE_PACKAGES],
203+
includePackages: TAPE_PACKAGES,
207204
}),
208205

209206
packageScript({
@@ -216,39 +213,58 @@ export default {
216213
includePackages: TYPES_PACKAGES,
217214
}),
218215

216+
packageScript({
217+
options: {
218+
scripts: {
219+
"test:types": "tstyche",
220+
},
221+
},
222+
includePackages: TSTYCHE_PACKAGES,
223+
}),
224+
219225
requireDependency({
220226
options: {
221227
devDependencies: {
222-
benchmark: "^2.1.4",
223-
tape: "^5.9.0",
224-
tsup: "^8.4.0",
225-
tsx: "^4.19.4",
228+
benchmark: "catalog:",
229+
glob: REMOVE,
230+
tape: "catalog:",
231+
tsup: "catalog:",
232+
tsx: "catalog:",
226233
},
227234
},
228-
includePackages: [...TS_PACKAGES, ...JS_PACKAGES],
235+
includePackages: PACKAGES,
229236
}),
230237

231238
requireDependency({
232239
options: {
233240
dependencies: {
234-
tslib: "^2.8.1",
241+
tslib: "catalog:",
235242
},
236243
devDependencies: {
237-
"@types/benchmark": "^2.1.5",
238-
"@types/tape": "^5.8.1",
239-
typescript: "^5.8.3",
244+
"@types/benchmark": "catalog:",
245+
"@types/tape": "catalog:",
246+
typescript: "catalog:",
247+
},
248+
},
249+
includePackages: PACKAGES,
250+
}),
251+
252+
requireDependency({
253+
options: {
254+
devDependencies: {
255+
tstyche: "catalog:",
240256
},
241257
},
242-
includePackages: TS_PACKAGES,
258+
includePackages: TSTYCHE_PACKAGES,
243259
}),
244260

245261
requireDependency({
246262
options: {
247263
dependencies: {
248-
"@types/geojson": "^7946.0.10",
264+
"@types/geojson": "catalog:",
249265
},
250266
},
251-
includePackages: [MAIN_PACKAGE, ...TS_PACKAGES, ...JS_PACKAGES],
267+
includePackages: [MAIN_PACKAGE, ...PACKAGES],
252268
}),
253269
],
254270
};

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![turf](https://raw.githubusercontent.com/Turfjs/turf/9a1d5e8d99564d4080f1e2bf1517ed41d18012fa/logo.png)
22
======
3-
[![GitHub Actions Status](https://github.com/Turfjs/turf/actions/workflows/turf.yml/badge.svg)](https://github.com/Turfjs/turf/actions/workflows/turf.yml/badge.svg)
3+
[![GitHub Actions Status](https://github.com/Turfjs/turf/actions/workflows/ci.yml/badge.svg)](https://github.com/Turfjs/turf/actions/workflows/ci.yml/badge.svg)
44
[![Version Badge][npm-img]][npm-url]
55
[![Gitter chat][gitter-img]][gitter-url]
66
[![Backers on Open Collective][oc-backer-badge]](#backers)

docs/CONTRIBUTING.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ JSDoc comments are found in the top-level index file for each package (for examp
124124

125125
We have lots of tooling dedicated to ensuring consistent code. We use [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/), and [ESLint](https://eslint.org/) to help us deliver quality code. These are checked by the build system and should be enforced at commit time by [Husky](https://typicode.github.io/husky/#/).
126126

127-
Most packages are written in TypeScript, while a few plain Javascript still linger. You can generally use modern Javascript when modifying Turf itself as all exported code is transpiled to (currently es2017).
127+
Packages are written in TypeScript. You can generally use modern TypeScript when modifying Turf itself as all exported code is transpiled to a more compatible subset (currently es2017).
128128

129129
Code for consumption by browsers is transpiled by Babel as described in the README.
130130

@@ -140,25 +140,13 @@ Should you want to generate new README files manually, use `pnpm run docs`:
140140

141141
### Documentation - Examples
142142

143-
**Build docs for only `@turf/center`**
144-
145-
```bash
146-
$ cd ./turf/packages/turf-center
147-
$ pnpm run docs
148-
149-
> @turf/center@5.0.4 docs /Users/mac/Github/turf/packages/turf-center
150-
> node ../../scripts/generate-readmes
151-
152-
Building Docs: @turf/center
153-
```
154-
155143
**Builds docs for all packages**
156144

157145
```bash
158146
$ cd ./turf
159147
$ pnpm run docs
160148
> @ docs /Users/mac/Github/turf
161-
> tsx ./scripts/generate-readmes
149+
> node ./scripts/generate-readmes.mts
162150

163151
Building Docs: @turf/along
164152
Building Docs: @turf/area
@@ -171,6 +159,8 @@ Building Docs: @turf/boolean-clockwise
171159
....
172160
```
173161

162+
Note: This should be automatically executed with a pre-commit hook when necessary
163+
174164
### Public website
175165

176166
The [turfjs.org](https://turfjs.org/) website is managed in a [separate repo](https://github.com/Turfjs/turf-www) with its own [contributing guide](https://github.com/Turfjs/turf-www/blob/master/CONTRIBUTING.md).

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
33
"npmClient": "pnpm",
4-
"version": "7.3.2",
4+
"version": "7.3.5",
55
"command": {
66
"publish": {
77
"registry": "https://registry.npmjs.org"

0 commit comments

Comments
 (0)