Skip to content
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
4bc86a0
Minimal changes required to have existing ESM+CJS build process compl…
smallsaucepan Dec 20, 2025
6da37b9
Added rules to monorepolint to generate per package tsconfig.json and…
smallsaucepan Dec 22, 2025
cfc3c7d
Split @turf/turf build into build and rollup, and moved rollup to the…
smallsaucepan Dec 22, 2025
8b9b2a4
Auto generated (by mrl) changes to existing tsconfig.json and package…
smallsaucepan Dec 22, 2025
26162d8
Auto generated (by mrl) NEW tsconfig.build.json, tsconfig.types.json,…
smallsaucepan Dec 22, 2025
9892d32
Removed now defunct (I think) seperate build tsconfig and tsup config…
smallsaucepan Dec 30, 2025
636eaf0
Merge branch 'Turfjs:master' into dev-without-build
smallsaucepan Dec 31, 2025
5caa61d
WIP.
smallsaucepan Jan 2, 2026
b3f2903
Merge remote-tracking branch 'refs/remotes/origin/dev-without-build' …
smallsaucepan Jan 2, 2026
02a8b4d
Merge branch 'master' into dev-without-build
smallsaucepan Jan 2, 2026
2f579b3
Migrate @turf/buffer to TypeScript, ignoring errors
mfedderly Jan 5, 2026
7c4b76f
Merge remote-tracking branch 'upstream/mf/buffer-ts-basic' into dev-w…
smallsaucepan Jan 11, 2026
7847682
Merge branch 'master' into dev-without-build
smallsaucepan Jan 11, 2026
1ae24d0
Retired tsup for JS generation. Instead using tsc with two configs in…
smallsaucepan Jan 12, 2026
c1e9d9f
Being explicit about when we are exporting types. Related to enabling…
smallsaucepan Jan 12, 2026
7ed0c48
Merge branch 'master' into dev-without-build
smallsaucepan Apr 29, 2026
c289319
Refactor build targets in normal packages to build (esm only) and pre…
smallsaucepan Apr 30, 2026
5acee45
Work in progress. Utilise eslint and prettier built in caching. Test …
smallsaucepan May 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
49 changes: 43 additions & 6 deletions .monorepolint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
packageEntry,
packageScript,
requireDependency,
standardTsconfig,
fileContents,
} from "@monorepolint/rules";

const TS_PACKAGES = []; // projects that use typescript to build
Expand Down Expand Up @@ -86,6 +88,35 @@ export default {
}),
alphabeticalDependencies({ includeWorkspaceRoot: true }),
alphabeticalScripts({ includeWorkspaceRoot: true }),
standardTsconfig({
options: { templateFile: "./templates/package/tsconfig.json" },
includePackages: [...TS_PACKAGES, MAIN_PACKAGE],
}),
standardTsconfig({
options: { templateFile: "./templates/package-js/tsconfig.json" },
includePackages: JS_PACKAGES,
}),
fileContents({
options: {
file: "tsconfig.build.json",
templateFile: "./templates/package/tsconfig.build.json",
},
includePackages: [...TS_PACKAGES, ...JS_PACKAGES],
}),
fileContents({
options: {
file: "tsup.config.ts",
templateFile: "./templates/package/tsup.config.ts",
},
includePackages: [...TS_PACKAGES, MAIN_PACKAGE],
}),
fileContents({
options: {
file: "tsup.config.ts",
templateFile: "./templates/package-js/tsup.config.ts",
},
includePackages: JS_PACKAGES,
}),
packageEntry({
options: {
entries: {
Expand Down Expand Up @@ -180,17 +211,16 @@ export default {
packageScript({
options: {
scripts: {
build: "tsup --config ../../tsup.config.ts",
build: "tsup",
},
},
includePackages: [...TS_PACKAGES, ...JS_PACKAGES],
includePackages: [...TS_PACKAGES, ...JS_PACKAGES, MAIN_PACKAGE],
}),

packageScript({
options: {
scripts: {
build:
"tsup --config ../../tsup.config.ts && rollup -c rollup.config.js",
rollup: "rollup -c rollup.config.js",
},
},
includePackages: [MAIN_PACKAGE],
Expand All @@ -209,13 +239,20 @@ export default {
packageScript({
options: {
scripts: {
"test:types":
"tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts",
"test:types": "tsc --project tsconfig.types.json",
},
},
includePackages: TYPES_PACKAGES,
}),

fileContents({
options: {
file: "tsconfig.types.json",
templateFile: "./templates/package/tsconfig.types.json",
},
includePackages: TYPES_PACKAGES,
}),

requireDependency({
options: {
devDependencies: {
Expand Down
8 changes: 7 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ pnpm-lock.yaml

/.nx/cache

/.nx/workspace-data
/.nx/workspace-data

# Auto generated by mrl, which produces a slightly clashing format.
tsconfig.json
tsconfig.build.json
tsconfig.shared.json
tsconfig.types.json
Comment thread
mfedderly marked this conversation as resolved.
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"{projectRoot}/test/**",
"{projectRoot}/types.ts"
],
"dependsOn": ["build"],
"dependsOn": [],
"cache": true
},
"last-checks": {
Expand Down
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@
"private": true,
"funding": "https://opencollective.com/turf",
"scripts": {
"build": "pnpx lerna run build",
"docs": "tsx ./scripts/generate-readmes.ts",
"escheck": "pnpm run /escheck:.*/",
"escheck:cjs": "es-check es8 packages/*/dist/cjs/index.cjs packages/turf/turf.min.js",
"escheck:esm": "es-check --module es8 packages/*/dist/esm/index.js",
"escheck:web": "es-check es5 packages/turf/turf.min.js",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lmao we're still shipping es5 turf.min.js. That should definitely get bumped way forward.
#2989

"lint": "pnpm run /lint:.*/",
"lint:docs": "documentation lint packages/turf-*/index.js",
"lint:escheck-cjs": "es-check es8 packages/*/dist/cjs/index.cjs packages/turf/turf.min.js",
"lint:escheck-esm": "es-check --module es8 packages/*/dist/esm/index.js",
"lint:escheck-web": "es-check es5 packages/turf/turf.min.js",
"lint:eslint": "eslint packages",
"lint:mrl": "mrl check",
"lint:prettier": "prettier --check .",
"preinstall": "npx only-allow pnpm",
"prepare": "husky && lerna run build",
"test": "pnpm run lint && lerna run test && lerna run --scope @turf/turf last-checks"
"prepare": "husky",
"prerelease": "pnpm run build && pnpm run rollup",
"release": "pnpm run test:release && pnpm publish -r",
"rollup": "lerna run --scope @turf/turf rollup",
"test": "pnpx lerna run test",
"test:release": "pnpm run lint && pnpm run escheck && lerna run --scope @turf/turf last-checks"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would be in favor of just keeping this all one test script, instead of breaking it out differently for releases.
We can probably entirely get rid of the escheck step once we swap TypeScript to targeting esnext.

},
"lint-staged": {
"package.json": [
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-along/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
],
"scripts": {
"bench": "tsx bench.ts",
"build": "tsup --config ../../tsup.config.ts",
"build": "tsup",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "pnpm run /test:.*/",
"test:tape": "tsx test.ts"
Expand Down
6 changes: 6 additions & 0 deletions packages/turf-along/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": false
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm a little surprised you can't use the default tsconfig.json for the build step as well.
It might be a little extra work if you do the build step in every package as it will re-check any shared dependencies have already been built, but I think that a build of @turf/turf should just recursively build all packages for free if we're doing it in CI.

}
}
23 changes: 22 additions & 1 deletion packages/turf-along/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
{
"extends": "../../tsconfig.shared.json"
"extends": "../../tsconfig.shared.json",
"include": [
"index.ts",
"lib/**/*.ts"
],
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this can just be moved into tsconfig.shared.json like so:

"include": [
  "${configDir}/index.ts",
  "${configDir}/lib/**/*.ts"
]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Will give it a try.

"references": [
{
"path": "../turf-bearing"
},
{
"path": "../turf-destination"
},
{
"path": "../turf-distance"
},
{
"path": "../turf-helpers"
},
{
"path": "../turf-invariant"
}
]
}
17 changes: 17 additions & 0 deletions packages/turf-along/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineConfig } from "tsup";
import { baseOptions } from "../../tsup.config";

export default [
defineConfig({
...baseOptions,
entry: ["index.ts"],
outDir: "dist/cjs",
format: "cjs",
}),
defineConfig({
...baseOptions,
entry: ["index.ts"],
outDir: "dist/esm",
format: "esm",
}),
];
2 changes: 1 addition & 1 deletion packages/turf-angle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
],
"scripts": {
"bench": "tsx bench.ts",
"build": "tsup --config ../../tsup.config.ts",
"build": "tsup",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "pnpm run /test:.*/",
"test:tape": "tsx test.ts"
Expand Down
6 changes: 6 additions & 0 deletions packages/turf-angle/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": false
}
}
29 changes: 28 additions & 1 deletion packages/turf-angle/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
{
"extends": "../../tsconfig.shared.json"
"extends": "../../tsconfig.shared.json",
"include": [
"index.ts",
"lib/**/*.ts"
],
"references": [
{
"path": "../turf-bearing"
},
{
"path": "../turf-helpers"
},
{
"path": "../turf-invariant"
},
{
"path": "../turf-rhumb-bearing"
},
{
"path": "../turf-distance"
},
{
"path": "../turf-sector"
},
{
"path": "../turf-truncate"
}
]
}
17 changes: 17 additions & 0 deletions packages/turf-angle/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineConfig } from "tsup";
import { baseOptions } from "../../tsup.config";

export default [
defineConfig({
...baseOptions,
entry: ["index.ts"],
outDir: "dist/cjs",
format: "cjs",
}),
defineConfig({
...baseOptions,
entry: ["index.ts"],
outDir: "dist/esm",
format: "esm",
}),
];
2 changes: 1 addition & 1 deletion packages/turf-area/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
],
"scripts": {
"bench": "tsx bench.ts",
"build": "tsup --config ../../tsup.config.ts",
"build": "tsup",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "pnpm run /test:.*/",
"test:tape": "tsx test.ts"
Expand Down
6 changes: 6 additions & 0 deletions packages/turf-area/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": false
}
}
14 changes: 13 additions & 1 deletion packages/turf-area/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
{
"extends": "../../tsconfig.shared.json"
"extends": "../../tsconfig.shared.json",
"include": [
"index.ts",
"lib/**/*.ts"
],
"references": [
{
"path": "../turf-helpers"
},
{
"path": "../turf-meta"
}
]
}
17 changes: 17 additions & 0 deletions packages/turf-area/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineConfig } from "tsup";
import { baseOptions } from "../../tsup.config";

export default [
defineConfig({
...baseOptions,
entry: ["index.ts"],
outDir: "dist/cjs",
format: "cjs",
}),
defineConfig({
...baseOptions,
entry: ["index.ts"],
outDir: "dist/esm",
format: "esm",
}),
];
2 changes: 1 addition & 1 deletion packages/turf-bbox-clip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
],
"scripts": {
"bench": "tsx bench.ts",
"build": "tsup --config ../../tsup.config.ts",
"build": "tsup",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "pnpm run /test:.*/",
"test:tape": "tsx test.ts"
Expand Down
6 changes: 6 additions & 0 deletions packages/turf-bbox-clip/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": false
}
}
17 changes: 16 additions & 1 deletion packages/turf-bbox-clip/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
{
"extends": "../../tsconfig.shared.json"
"extends": "../../tsconfig.shared.json",
"include": [
"index.ts",
"lib/**/*.ts"
],
"references": [
{
"path": "../turf-helpers"
},
{
"path": "../turf-invariant"
},
{
"path": "../turf-bbox"
}
]
}
17 changes: 17 additions & 0 deletions packages/turf-bbox-clip/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineConfig } from "tsup";
import { baseOptions } from "../../tsup.config";

export default [
defineConfig({
...baseOptions,
entry: ["index.ts"],
outDir: "dist/cjs",
format: "cjs",
}),
defineConfig({
...baseOptions,
entry: ["index.ts"],
outDir: "dist/esm",
format: "esm",
}),
];
2 changes: 1 addition & 1 deletion packages/turf-bbox-polygon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
],
"scripts": {
"bench": "tsx bench.ts",
"build": "tsup --config ../../tsup.config.ts",
"build": "tsup",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "pnpm run /test:.*/",
"test:tape": "tsx test.ts"
Expand Down
6 changes: 6 additions & 0 deletions packages/turf-bbox-polygon/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": false
}
}
Loading