Skip to content

Commit

Permalink
Update generate-readmes script to typescript, update content wording,…
Browse files Browse the repository at this point in the history
… and regenerate all readmes (#2528)

* Fix generate-docs to work with tsx (add extension, fix a few TS errors). monorepolint rule changed to reflect ts file extension. Add node to eslint env config so editors can find definitions of node variables (such as __dirname) used in scripts.

* Change project root docs target to use tsx and generate-docs.ts. Tighten up gnerates-docs.ts folder globbing - was inadvertently matching when my working parent directory was named something like ~/code/turf-docs-test/... interpreting docs-test as a package name. Reworded readme postfix content to be clearer on the different ways of installing. Updated a few links from http to https.

* Result of running yarn docs from the project root with the previously committed changes.

* Applying recently merged changes (from PR #2523) to this new module.
  • Loading branch information
smallsaucepan authored Nov 3, 2023
1 parent c11f76b commit 6cb60c9
Show file tree
Hide file tree
Showing 231 changed files with 1,072 additions and 1,838 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {
ecmaVersion: 6,
sourceType: "module",
},
env: { es6: true },
env: { es6: true, node: true },
rules,

overrides: [
Expand Down
2 changes: 1 addition & 1 deletion .monorepolint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ module.exports = {
{
options: {
scripts: {
docs: "tsx ../../scripts/generate-readmes",
docs: "tsx ../../scripts/generate-readmes.ts",
test: "npm-run-all --npm-path npm test:*",
},
},
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

***A modular geospatial engine written in JavaScript***

[turfjs.org](http://turfjs.org/)
[turfjs.org](https://turfjs.org/)

- - -

[Turf](https://turfjs.org) is a [JavaScript library](https://en.wikipedia.org/wiki/JavaScript_library) for [spatial analysis](http://en.wikipedia.org/wiki/Spatial_analysis). It includes traditional spatial operations, helper functions for creating [GeoJSON](http://geojson.org) data, and data classification and statistics tools. Turf can be added to your website as a client-side plugin, or you can [run Turf server-side](https://www.npmjs.com/package/@turf/turf) with [Node.js](http://nodejs.org/) (see below).
[Turf](https://turfjs.org) is a [JavaScript library](https://en.wikipedia.org/wiki/JavaScript_library) for [spatial analysis](https://en.wikipedia.org/wiki/Spatial_analysis). It includes traditional spatial operations, helper functions for creating [GeoJSON](https://geojson.org) data, and data classification and statistics tools. Turf can be added to your website as a client-side plugin, or you can [run Turf server-side](https://www.npmjs.com/package/@turf/turf) with [Node.js](https://nodejs.org/) (see below).

## Installation

Expand Down Expand Up @@ -66,7 +66,7 @@ Ports of Turf.js are available in:

## Data in Turf

Turf uses <a href='http://geojson.org/'>GeoJSON</a> for all geographic data. Turf expects the data to be standard <a href='http://en.wikipedia.org/wiki/World_Geodetic_System'>WGS84</a> longitude, latitude coordinates. Check out <a href='http://geojson.io/#id=gist:anonymous/844f013aae8354eb889c&map=12/38.8955/-77.0135'>geojson.io</a> for a tool to easily create this data.
Turf uses <a href='https://geojson.org/'>GeoJSON</a> for all geographic data. Turf expects the data to be standard <a href='https://en.wikipedia.org/wiki/World_Geodetic_System'>WGS84</a> longitude, latitude coordinates. Check out <a href='https://geojson.io/#id=gist:anonymous/844f013aae8354eb889c&map=12/38.8955/-77.0135'>geojson.io</a> for a tool to easily create this data.

> **NOTE:** Turf expects data in (longitude, latitude) order per the GeoJSON standard.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"pretest": "npm run lint",
"test": "lerna run test",
"posttest": "lerna run --scope @turf/turf last-checks",
"docs": "node ./scripts/generate-readmes"
"docs": "tsx ./scripts/generate-readmes.ts"
},
"husky": {
"hooks": {
Expand Down
33 changes: 12 additions & 21 deletions packages/turf-along/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Takes a [LineString][1] and returns a [Point][2] at a specified distance along t

### Parameters

* `line` **[Feature][3]<[LineString][4]>** input line
* `distance` **[number][5]** distance along the line
* `options` **[Object][6]?** Optional parameters
* `line` **[Feature][3]<[LineString][1]>** input line
* `distance` **[number][4]** distance along the line
* `options` **[Object][5]?** Optional parameters

* `options.units` **[string][7]** can be degrees, radians, miles, or kilometers (optional, default `"kilometers"`)
* `options.units` **[string][6]** can be degrees, radians, miles, or kilometers (optional, default `"kilometers"`)

### Examples

Expand All @@ -26,44 +26,35 @@ var along = turf.along(line, 200, options);
var addToMap = [along, line]
```

Returns **[Feature][3]<[Point][8]>** Point `distance` `units` along the line
Returns **[Feature][3]<[Point][2]>** Point `distance` `units` along the line

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

[2]: https://tools.ietf.org/html/rfc7946#section-3.1.2

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

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

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

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[8]: https://tools.ietf.org/html/rfc7946#section-3.1.2

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->
<!-- 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. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.
This module is part of the [Turfjs project](https://turfjs.org/), an open source module collection dedicated to geographic algorithms. It is maintained in the [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create PRs and issues.

### Installation

Install this module individually:
Install this single module individually:

```sh
$ npm install @turf/along
```

Or install the Turf module that includes it as a function:
Or install the all-encompassing @turf/turf module that includes all modules as functions:

```sh
$ npm install @turf/turf
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 @@ -43,7 +43,7 @@
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "tsx ../../scripts/generate-readmes",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.js"
},
Expand Down
13 changes: 4 additions & 9 deletions packages/turf-angle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,21 @@ Returns **[number][4]** Angle between the provided points, or its explementary.

[4]: 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 (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->
<!-- 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. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.
This module is part of the [Turfjs project](https://turfjs.org/), an open source module collection dedicated to geographic algorithms. It is maintained in the [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create PRs and issues.

### Installation

Install this module individually:
Install this single module individually:

```sh
$ npm install @turf/angle
```

Or install the Turf module that includes it as a function:
Or install the all-encompassing @turf/turf module that includes all modules as functions:

```sh
$ npm install @turf/turf
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-angle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "tsx ../../scripts/generate-readmes",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.js"
},
Expand Down
13 changes: 4 additions & 9 deletions packages/turf-area/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,21 @@ Returns **[number][2]** area in square meters

[2]: 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 (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->
<!-- 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. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.
This module is part of the [Turfjs project](https://turfjs.org/), an open source module collection dedicated to geographic algorithms. It is maintained in the [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create PRs and issues.

### Installation

Install this module individually:
Install this single module individually:

```sh
$ npm install @turf/area
```

Or install the Turf module that includes it as a function:
Or install the all-encompassing @turf/turf module that includes all modules as functions:

```sh
$ npm install @turf/turf
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-area/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "tsx ../../scripts/generate-readmes",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.js"
},
Expand Down
31 changes: 12 additions & 19 deletions packages/turf-bbox-clip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ May result in degenerate edges when clipping Polygons.

### Parameters

* `feature` **[Feature][3]<([LineString][4] | [MultiLineString][5] | [Polygon][6] | [MultiPolygon][7])>** feature to clip to the bbox
* `bbox` **[BBox][8]** extent in \[minX, minY, maxX, maxY] order
* `feature` **[Feature][1]<([LineString][3] | [MultiLineString][4] | [Polygon][5] | [MultiPolygon][6])>** feature to clip to the bbox
* `bbox` **[BBox][7]** extent in \[minX, minY, maxX, maxY] order

### Examples

Expand All @@ -25,44 +25,37 @@ var clipped = turf.bboxClip(poly, bbox);
var addToMap = [bbox, poly, clipped]
```

Returns **[Feature][3]<([LineString][4] | [MultiLineString][5] | [Polygon][6] | [MultiPolygon][7])>** clipped Feature
Returns **[Feature][1]<([LineString][3] | [MultiLineString][4] | [Polygon][5] | [MultiPolygon][6])>** clipped Feature

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

[2]: https://github.com/mapbox/lineclip

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

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

[5]: https://tools.ietf.org/html/rfc7946#section-3.1.5
[5]: https://tools.ietf.org/html/rfc7946#section-3.1.6

[6]: https://tools.ietf.org/html/rfc7946#section-3.1.6
[6]: https://tools.ietf.org/html/rfc7946#section-3.1.7

[7]: https://tools.ietf.org/html/rfc7946#section-3.1.7
[7]: https://tools.ietf.org/html/rfc7946#section-5

[8]: https://tools.ietf.org/html/rfc7946#section-5

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->
<!-- 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. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.
This module is part of the [Turfjs project](https://turfjs.org/), an open source module collection dedicated to geographic algorithms. It is maintained in the [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create PRs and issues.

### Installation

Install this module individually:
Install this single module individually:

```sh
$ npm install @turf/bbox-clip
```

Or install the Turf module that includes it as a function:
Or install the all-encompassing @turf/turf module that includes all modules as functions:

```sh
$ npm install @turf/turf
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-bbox-clip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "tsx ../../scripts/generate-readmes",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.js"
},
Expand Down
17 changes: 5 additions & 12 deletions packages/turf-bbox-polygon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var poly = turf.bboxPolygon(bbox);
var addToMap = [poly]
```

Returns **[Feature][6]<[Polygon][7]>** a Polygon representation of the bounding box
Returns **[Feature][6]<[Polygon][1]>** a Polygon representation of the bounding box

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

Expand All @@ -39,28 +39,21 @@ Returns **[Feature][6]<[Polygon][7]>** a Polygon representation of the bounding

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

[7]: https://tools.ietf.org/html/rfc7946#section-3.1.6

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->
<!-- 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. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.
This module is part of the [Turfjs project](https://turfjs.org/), an open source module collection dedicated to geographic algorithms. It is maintained in the [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create PRs and issues.

### Installation

Install this module individually:
Install this single module individually:

```sh
$ npm install @turf/bbox-polygon
```

Or install the Turf module that includes it as a function:
Or install the all-encompassing @turf/turf module that includes all modules as functions:

```sh
$ npm install @turf/turf
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-bbox-polygon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "tsx ../../scripts/generate-readmes",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.js"
},
Expand Down
13 changes: 4 additions & 9 deletions packages/turf-bbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,21 @@ Returns **[BBox][4]** bbox extent in \[minX, minY, maxX, maxY] order

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

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->
<!-- 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. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.
This module is part of the [Turfjs project](https://turfjs.org/), an open source module collection dedicated to geographic algorithms. It is maintained in the [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create PRs and issues.

### Installation

Install this module individually:
Install this single module individually:

```sh
$ npm install @turf/bbox
```

Or install the Turf module that includes it as a function:
Or install the all-encompassing @turf/turf module that includes all modules as functions:

```sh
$ npm install @turf/turf
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-bbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"build": "npm-run-all --npm-path npm build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "tsx ../../scripts/generate-readmes",
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "npm-run-all --npm-path npm test:*",
"test:tape": "tsx test.js"
},
Expand Down
Loading

0 comments on commit 6cb60c9

Please sign in to comment.