Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewharvey authored Aug 25, 2024
2 parents 4c116a0 + 6889237 commit 94029c4
Show file tree
Hide file tree
Showing 262 changed files with 16,184 additions and 55,805 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ jobs:
with:
fetch-depth: 0

- uses: pnpm/[email protected]
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8
run_install: false

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

- uses: pnpm/[email protected]
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8
run_install: false

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
Expand Down
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm lint-staged
11 changes: 10 additions & 1 deletion .monorepolint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export default {
devDependencies: {
"@types/benchmark": "^2.1.5",
"@types/tape": "^4.2.32",
typescript: "^5.2.2",
typescript: "^5.5.4",
},
},
includePackages: TS_PACKAGES,
Expand All @@ -250,5 +250,14 @@ export default {
},
includePackages: [MAIN_PACKAGE],
}),

requireDependency({
options: {
dependencies: {
"@types/geojson": "^7946.0.10",
},
},
includePackages: [MAIN_PACKAGE, ...TS_PACKAGES, ...JS_PACKAGES],
}),
],
};
16 changes: 2 additions & 14 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
dist
*.md
node_modules
tsconfig.json
lerna.json

# slow
packages/turf-directional-mean/test/in/bus_route_gps.json
packages/turf-directional-mean/test/in/bus_route_utm.json

# is actually output
packages/turf/turf.min.js

# Ignore test fixture json in case intentional line breaks help with coord
# readability.
packages/turf-*/test/in/**
packages/turf-*/test/out/**
packages/turf-*/test/true/**
packages/turf-*/test/false/**
packages/turf/test.example.js

pnpm-lock.yaml

/.nx/cache
/.nx/cache
10 changes: 9 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{
"trailingComma": "es5"
"trailingComma": "es5",
"overrides": [
{
"files": "*.{geojson,json}",
"options": {
"printWidth": 90
}
}
]
}
62 changes: 35 additions & 27 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,13 @@ A turf release is initiated from your local computer, and then built and publish
To make a release as a core contributor, you will need:
- Turf repository write permission
- Turf npm organization publish permission
- A local copy of the Turf Github repository (not a fork!). Starting with a fresh clone will ensure it's clean.
- `git clone [email protected]:Turfjs/turf.git turf-release`
- A clean local copy of the Turf Github repository (not a fork!). Starting with a fresh clone will ensure it's clean.
- Depending on your auth method
- `git clone [email protected]:Turfjs/turf.git turf-release`
- or `git clone https://github.com/Turfjs/turf.git turf-release`
- `cd turf-release` - start at the top-level of the repo
- `pnpm install`
- `pnpm test` - make sure everything is passing

- If you choose to clean up an existing copy instead, be very careful:
- `git remote -v` - verify your remote origin points to `https://github.com/Turfjs/turf.git`
Expand All @@ -205,39 +208,44 @@ To make a release as a core contributor, you will need:
Before release:
- If necessary, make and merge a PR with any last minute housekeeping items.
- Turf's documentation (README.md files) should already be up to date as it is generated automatically on commit from JSDoc comments in source files.
- Review PR's and decide the new version number to be published (for example 7.0.1 or 7.1.0).
- If there are breaking changes, then it should be a major version bump, e.g. 7.x.x to 8.0.0. This project follows [semantic versioning](https://semver.org/).
- Review PR's and decide the new version number to be published. See [semantic versioning](https://semver.org/).

Run the release commands, replace `7.0.0` with your version number
- fetch the latest code from remote origin
- `git fetch origin`
Run the following release commands, replacing `7.0.0` with your version number:

- create a release branch, replace mf with your initials to make it clear whose branch it is.
- `git checkout origin/master -b mf/release-7.0.0`
- create a release branch, replacing `xx` with your initials to make it clear who created the branch.
- `git checkout origin/master -b xx/release-7.0.0`

- increment the version number of all packages, without pushing to origin. This will also create a release tag.
- increment the version number of all packages, and create a local commit, without pushing to origin. This will also create a release tag.
- `pnpm lerna version --no-commit-hooks --no-push 7.0.0`

- stage any files changed by the version command.
- `git add packages/*/package.json`
- `git add lerna.json`
`

- create new commit on the release branch
- `git commit -m "Release v7.0.0"`

- Push the release branch and the release tag.
- `git push origin mf/release-7.0.0 --follow-tags`
- The tag will trigger the Github [release](https://github.com/Turfjs/turf/blob/master/.github/workflows/release.yml) action which you can view the status of at - https://github.com/Turfjs/turf/actions. If successful, a new [version](https://www.npmjs.com/package/@turf/turf?activeTab=versions) of all turf packages will have been published on NPM.

- If the release action was successful, now create a Pull Request for the release and then merge it.
- A link to create the PR should be in the output of the push command
- Use the version number for the PR title (e.g. v7.0.0).
- If a link isn't provided, just create a PR that merges your release branch to master. Here is an example - https://github.com/Turfjs/turf/pull/2615.
- Don't forget to merge your release PR!
- `git push origin xx/release-7.0.0 --follow-tags`
- Pushing the tag will trigger the Github [release](https://github.com/Turfjs/turf/blob/master/.github/workflows/release.yml) action which you can view the status of at - https://github.com/Turfjs/turf/actions. If successful, a new [version](https://www.npmjs.com/package/@turf/turf?activeTab=versions) of all turf packages will have been published on NPM.

- If the release action was not successful
- commit any changes to master to fix it.
- Make a [prerelease](#prerelease) if helpful to make sure the release action is successful.
- Then reset by deleting your tag and branch locally and remotely.
- `git push --delete origin v7.1.0`
- `git tag --delete v7.1.0`
- `git push -d origin xx/release-7.0.0`
- `git branch -d xx/release-7.0.0`
- Now redo the steps above starting with creating "A clean local copy of the Turf Github repository"

- If the release action was successful, now create a Pull Request for the release to update master.
- You may be given a link in the output of the branch/tag push command to create the PR.
- If you don't get this message, just go to https://github.com/Turfjs/turf/pulls and you should be prompted at the top to create a PR for this new branch you just pushed.
- If that prompt doesn't appear, then just create a new pull request from the PR page and make sure the title is the version number e.g. `v7.0.0` and that it is merging your release branch -> to master.
- Here is an example PR - https://github.com/Turfjs/turf/pull/2615.
- Get approval for the release PR and merge it!

#### Follow-on steps
- As part of the release action, a draft Github release will have been created at https://github.com/Turfjs/turf/releases with an auto-generated changelog. Edit and add to the release notes for readability and completeness, specifically noting any breaking changes. Use past releases as a guide. Be sure to "Save draft" each time, then ask for a review from other contributors. Once ready, click `Publish release`. This will make the release notes publicly accessible and notify all watchers of the project.
- As part of the release action, a draft Github release will have been created at https://github.com/Turfjs/turf/releases with an auto-generated changelog.
- Edit and add to the release notes for readability and completeness, specifically noting any breaking changes. Use past releases as a guide.
- Be sure to "Save draft" each time, then ask for a review or edits from other contributors.
- Try not to leave the notes unpublished more than a day, people rely on these notes for upgrading.
- Once ready, click `Publish release`. This will make the release notes publicly accessible and notify all watchers of the project.
- You can edit and republish your release notes after this, but that will likely notify followers, so best to get it right the first time.
- Release a new version of the [API docs](https://github.com/Turfjs/turf-www/blob/master/CONTRIBUTING.md) for the https://turfjs.org website.

## Documentation
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"npmClient": "pnpm",
"version": "7.0.0",
"version": "7.1.0",
"command": {
"publish": {
"registry": "https://registry.npmjs.org"
Expand Down
16 changes: 7 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,27 @@
"lint:mrl": "mrl check",
"lint:prettier": "prettier --check .",
"preinstall": "npx only-allow pnpm",
"prepare": "lerna run build && husky install",
"prepare": "husky && lerna run build",
"test": "pnpm run lint && lerna run test && lerna run --scope @turf/turf last-checks"
},
"lint-staged": {
"package.json": [
"mrl check --paths"
],
"**/*.{js,ts}": [
"eslint --fix",
"prettier --write"
"eslint --fix"
],
"packages/*/index.{js,ts}": [
"pnpm tsx ./scripts/generate-readmes"
],
"**/*": "prettier --write --ignore-unknown"
"*": "prettier --write --ignore-unknown"
},
"packageManager": "[email protected]+sha512.d1a029e1a447ad90bc96cd58b0fad486d2993d531856396f7babf2d83eb1823bb83c5a3d0fc18f675b2d10321d49eb161fece36fe8134aa5823ecd215feed392",
"devDependencies": {
"@monorepolint/cli": "0.5.0-alpha.132",
"@monorepolint/config": "0.5.0-alpha.132",
"@monorepolint/core": "0.5.0-alpha.132",
"@monorepolint/rules": "0.5.0-alpha.132",
"@types/geojson": "7946.0.8",
"@types/node": "18.11.9",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
Expand All @@ -51,18 +49,18 @@
"esm": "^3.2.25",
"fs-extra": "^11.1.1",
"glob": "^10.3.10",
"husky": "^8.0.0",
"husky": "^9.0.0",
"lerna": "^8.1.7",
"lint-staged": "^10.5.4",
"lint-staged": "^15.2.8",
"load-json-file": "^7.0.1",
"meow": "^12.1.1",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.3",
"prettier": "^3.3.3",
"progress": "^2.0.3",
"ts-node": "^9.0.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"typescript": "^5.5.4",
"yamljs": "^0.3.0"
}
}
5 changes: 3 additions & 2 deletions packages/turf-along/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@turf/along",
"version": "7.0.0",
"version": "7.1.0",
"description": "turf along module",
"author": "Turf Authors",
"license": "MIT",
Expand Down Expand Up @@ -60,14 +60,15 @@
"tape": "^5.7.2",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
"typescript": "^5.5.4"
},
"dependencies": {
"@turf/bearing": "workspace:^",
"@turf/destination": "workspace:^",
"@turf/distance": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"@types/geojson": "^7946.0.10",
"tslib": "^2.6.2"
}
}
5 changes: 3 additions & 2 deletions packages/turf-angle/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@turf/angle",
"version": "7.0.0",
"version": "7.1.0",
"description": "turf angle module",
"author": "Turf Authors",
"contributors": [
Expand Down Expand Up @@ -64,14 +64,15 @@
"tape": "^5.7.2",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"typescript": "^5.5.4",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/bearing": "workspace:^",
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"@turf/rhumb-bearing": "workspace:^",
"@types/geojson": "^7946.0.10",
"tslib": "^2.6.2"
}
}
14 changes: 10 additions & 4 deletions packages/turf-area/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

## area

Takes one or more features and returns their area in square meters.
Calculates the geodesic area in square meters of one or more polygons.

### Parameters

* `geojson` **[GeoJSON][1]** input GeoJSON feature(s)
* `geojson` **[GeoJSON][1]** input polygon(s) as [Geometry][2], [Feature][3], or [FeatureCollection][4]

### Examples

Expand All @@ -22,11 +22,17 @@ var addToMap = [polygon]
polygon.properties.area = area
```

Returns **[number][2]** area in square meters
Returns **[number][5]** area in square meters

[1]: https://tools.ietf.org/html/rfc7946#section-3

[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
[2]: https://tools.ietf.org/html/rfc7946#section-3.1

[3]: https://tools.ietf.org/html/rfc7946#section-3.2

[4]: https://tools.ietf.org/html/rfc7946#section-3.3

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. -->

Expand Down
4 changes: 2 additions & 2 deletions packages/turf-area/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { earthRadius } from "@turf/helpers";
import { geomReduce } from "@turf/meta";

/**
* Takes one or more features and returns their area in square meters.
* Calculates the geodesic area in square meters of one or more polygons.
*
* @name area
* @param {GeoJSON} geojson input GeoJSON feature(s)
* @param {GeoJSON} geojson input polygon(s) as {@link Geometry}, {@link Feature}, or {@link FeatureCollection}
* @returns {number} area in square meters
* @example
* var polygon = turf.polygon([[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]]);
Expand Down
5 changes: 3 additions & 2 deletions packages/turf-area/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@turf/area",
"version": "7.0.0",
"version": "7.1.0",
"description": "turf area module",
"author": "Turf Authors",
"license": "MIT",
Expand Down Expand Up @@ -59,12 +59,13 @@
"tape": "^5.7.2",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"typescript": "^5.5.4",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/helpers": "workspace:^",
"@turf/meta": "workspace:^",
"@types/geojson": "^7946.0.10",
"tslib": "^2.6.2"
}
}
5 changes: 3 additions & 2 deletions packages/turf-bbox-clip/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@turf/bbox-clip",
"version": "7.0.0",
"version": "7.1.0",
"description": "turf bbox-clip module",
"author": "Turf Authors",
"contributors": [
Expand Down Expand Up @@ -66,12 +66,13 @@
"tape": "^5.7.2",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"typescript": "^5.5.4",
"write-json-file": "^5.0.0"
},
"dependencies": {
"@turf/helpers": "workspace:^",
"@turf/invariant": "workspace:^",
"@types/geojson": "^7946.0.10",
"tslib": "^2.6.2"
}
}
Loading

0 comments on commit 94029c4

Please sign in to comment.