105 Commits

Author SHA1 Message Date
James Beard
4ea81e6b96
Migration to pnpm and improved exports strategy (#2555)
* Moving to pnpm as package manager. Also taking the opportunity to tidy up our cjs / esm situation using tsup (instead of tsc and rollup). Can't get monorepolint to work with new setup so disabling for the time being.

* Changing all Turf imports to use named imports. Adding a few missing named exports. Updating github workflow actions to pnpm instead of yarn.

* Updating typescript module and moduleResolution mechanisms to "node16". Not tracking nodenext just yet. Changing tsup command to generate d.ts files that arethetypeswrong approves of.

* Tweaking github workflows to explicitely install pnpm.

* Looks like node needs the chosen cache binary installed first. Trying without cache as a first step.

* Seem to be hitting the tsx bug described here: https://github.com/privatenumber/tsx/issues/421 Upgrading to latest tsx to remedy.

* Forgot to update lock file after updating tsx dep in package.json files.

* Sorting modules exported from @turf/turf alphabetically. Preparatory commit to add unexported modules.

* Converting index.mjs to typescript, and simplifying re-exported imports, and ordering alphabetically. Added in a couple of packages - convex, booleanValid and nearestNeighbourAnalysis. Rollup now only used in packages/turf so merging project root base config into there. Also now only using rollup in packages/turf to do final conversion to web module. JS and d.ts files generated the same as other modules, using tsup.

* Including tslib in @turf/turf build now that it's a TS module.

* Lot of per-package tsconfig items now on the tsup command line, so stripping back tsconfig.json to the bare minimum. Adding tsconfig.json to packages that while still only JS, are now processed by tsup.

* Same as last commit - simplifying tsconfig.json - except these are the subset of packages that had multiple entry points e.g. 3rd party code hosted locally in lib/

* Incorporating some suggestions from @favna on being more explicit with d.ts entries. https://github.com/Turfjs/turf/issues/2307#issuecomment-1858653048  Specifying overall module type as commonjs explicitly.

* Reapplying cjsInterop / splitting workaround for CJS exports that we had on build target command line earlier in this PR in to tsup config file. Also disabling treeshaking as this was generating a warning for CJS files and causing the workaround above to not work.

* Upgrading rollup and related plugins. Updating to recommended modern browserslist config in babel.config.json e.g. previous chrome 67 and edge 17 are 5 years old, ie11 is just ... ugh

* Fluffed the browserslist config - need to cover es5 as well.

* Update .github/workflows/turf.yml to use actions/checkout v4.

Co-authored-by: Jeroen Claassens <jeroen.claassens@live.nl>

---------

Co-authored-by: Jeroen Claassens <jeroen.claassens@live.nl>
2023-12-19 10:14:18 +11:00
James Beard
948f57e8c6
Upgrading all project dependencies (except monorepolint - troublesome) to latest versions. Some code changes required though only to utility and test scripts, and then only function name changes e.g. load.sync() is now loadJsonFileSync() in the latest version. Removing chroma-js as a turf-isobands devDependency as it doesn't seem to be used. (#2532) 2023-11-10 09:09:26 -05:00
James Beard
6cb60c951d
Update generate-readmes script to typescript, update content wording, 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.
2023-11-03 20:22:53 +11:00
James Beard
f6e64ff826
Upgrade lerna, et al to address security vulnerabilities, modernise build environment (#2507)
* Upgrading to newest @types/node for the typescript version we currently use (3.8.3). https://www.npmjs.com/package/@types/node?activeTab=versions

* Big update to lerna to address security vulnerabilities. bootstrap command no longer required. Seems to build and test ok. May need some tweaking. Will add build caching at a later date.

* Updating documentation (the NPM library) to address security vulnerabilities. Had to wrap body of script so as be async, though otherwise unchanged.

* Updating es-check to address security vulnerabilities.

* Updating tape library to address security vulnerabilities.

* Add lerna caching (via nx). Simplistic setup so will need some tweaking. Remove redundant packages setting from lerna.json (will default to packages setting in package.json instead). Have to add --npm-path to all npm-run-all calls so that lerna doesn't accidentally end up being used as the npm binary. https://github.com/mysticatea/npm-run-all/issues/218 and https://github.com/lerna/lerna/issues/1842 have more details.

* Missed a couple of carats in package.json dependency specs.

* Also need to commit a new yarn.lock file to reflect version spec changes in previous commit.

---------

Co-authored-by: mfedderly <mdfedderly@mdfedderly.com>
2023-10-06 16:48:20 -04:00
mfedderly
f62ba326cb
Fix docs generation (#2279)
* Fix generate-readmes script to work with typescript packages

* auto generated changes from generate-readmes and new documentationjs version

* Update husky to enforce docs builds at commit time
2022-04-02 12:52:52 -04:00
mfedderly
52f54494a3
Target ES2017 (#2237)
* Target ES2017

* Fix rbush usage issue

* More rbush fixes

Co-authored-by: Rowan Winsemius <rowanwins@yahoo.com.au>
2022-01-15 07:30:28 -05:00
mfedderly
96f0c2cb06
Enable more lint rules (#2108)
* @typescript-eslint/ban-types

* @typescript-eslint/no-empty-function

* @typescript-eslint/no-inferrable-types

* @typescript-eslint/no-this-alias

* no-case-declarations

* no-cond-assign

* no-dupe-else-if

* no-empty

* no-explicit-any

* no-prototype-builtins

* no-undef

* no-unreachable

* no-useless-escape

* prefer-spread

* comment the eslintrc

* Almost had it

* clearly my js trivia is not good enough today

Co-authored-by: Matt Fedderly <mfedderly@palantir.com>
2021-06-22 18:42:21 -04:00
mfedderly
bec40ecfdf
Add .js to relative import statements in es output at build time (#2011)
Co-authored-by: Matt Fedderly <mfedderly@palantir.com>
2021-01-19 14:31:28 -05:00
mfedderly
5a029b206c
Only include ES5 code, remove some ES6 that had crept in (#1984)
* Move @turf/polygonize to typescript instead of its own custom rollup

* validate-es5-dependencies -> es-check

* @turf/buffer const -> var

* polygon-clipping dependency from 0.14.3 -> 0.15.2 to swap es6 code for es5 code

* @turf/turf - Change rollup config to better support tree shaking, remove buble reference

* Remove deprecated exports from @turf/helpers, they are still covered in @turf/turf:

- radians2degrees
- degrees2radians
- distanceToDegrees
- distanceToRadians
- radiansToDistance
- bearingToAngle
- convertDistance

Co-authored-by: Matt Fedderly <mfedderly@palantir.com>
2020-12-17 08:36:56 -05:00
mfedderly
e296063455
Upgrade rollup to fix @turf/turf build issue (#1975)
* Upgrade rollup to fix @turf/turf build issue

* prettier issues

* Fix broken test

Co-authored-by: Matt Fedderly <mfedderly@palantir.com>
2020-12-09 19:27:21 -05:00
mfedderly
2e9d3d51f7
Add Prettier and ESLint to the builds (#1965)
* Configure ESlint and Prettier
- Disable all eslint rules that trigger
- Build's lint step now runs monorepoint, prettier, and eslint
- Remove all tslint references

* [auto] run prettier on everything

Co-authored-by: Matt Fedderly <mfedderly@palantir.com>
2020-12-08 19:24:15 -05:00
diachedelic
eafb76cab8
Node ESM support (#1942)
Writes a package.json to each dist/es/ directory, which ensures that
Node loads adjacent files as ES modules.

close #1940

Co-authored-by: mfedderly <mdfedderly@mdfedderly.com>
2020-11-17 09:08:31 -05:00
Rowan Winsemius
b71ed08d5a Add Ts Progress script 2018-06-12 23:00:53 +10:00
Denis
58b6711a16 Patch release Typescript fix 2018-04-04 09:19:52 -04:00
Denis
fe2fc04c47 Add update version method 2018-04-03 18:12:36 -04:00
Denis
856d5010b1 Drop *.ts to all packages 2018-04-03 15:51:47 -04:00
Denis
7511d3489d Enforce strict Typescript config along & destination 2018-03-21 11:33:13 -04:00
Denis
364dc81a97 Add index.d.ts to files 2018-03-21 10:46:50 -04:00
Denis
bd032f6b45 Update types & devDependencies 2018-03-21 10:33:50 -04:00
Denis
027043dcf1 Update package.json configs 2018-03-21 10:30:26 -04:00
Denis
75e61d856e Ponyfill Object.assign - fix for #1157
Ref: https://github.com/Turfjs/turf/issues/1157#issuecomment-353005807
2017-12-21 14:42:27 -05:00
Denis
669315b522
Merge branch 'master' into turf-angle 2017-12-11 23:49:14 -08:00
Denis
b25199d766 Update create new module 2017-12-11 23:48:39 -08:00
Denis
9abd42c453 Updat create new module 2017-12-11 23:42:05 -08:00
Denis
ed929512ab Update create new module 2017-12-10 13:52:55 -08:00
Denis
1efa521108 Rename folder from images => diagrams 2017-12-10 13:23:37 -08:00
Denis
a06bb30fbf
Merge branch 'master' into images 2017-12-10 13:19:54 -08:00
Denis
659d1ff70a Change "module" *.mjs extension to *.es.js 2017-12-09 20:30:12 -08:00
Denis
09b3f0ffd0 Add posttest for ES5 syntax validation 2017-12-09 19:24:00 -08:00
Denis
e1c81f7e58 Add valide ES5 syntax 2017-12-09 19:01:29 -08:00
Denis
b6653d98b4 Update @turf/turf package.json 2017-12-07 14:51:34 -05:00
Denis
481dd5d5b6 Add main.mjs & rollup buble 2017-12-07 13:12:05 -05:00
Denis
68b4f1787e Update list modules to markdown script 2017-12-07 02:08:25 -05:00
Denis
df346108f4 Add images to generate-readmes 2017-12-04 22:12:18 -05:00
Denis
10c01b7736 Add documentation yaml to turf main 2017-12-03 21:25:47 -05:00
Denis
d4d8714cfe
Merge pull request #1136 from Turfjs/update-create-new-module
Correct test.js boilerplate on create-new-module.
2017-11-27 21:48:41 -08:00
Moacir P. de Sá Pereira
1f425793d2 Correct test.js boilerplate on create-new-module. 2017-11-27 23:38:41 -05:00
Denis
26df0d64e8 Bump jsts dependent modules 2017-11-26 23:27:57 -08:00
Denis
c962461a82 Generate readmes per single module 2017-11-26 21:36:46 -08:00
Denis
bb49f24f1d Clean up scripts 2017-11-26 21:31:18 -08:00
Denis
08c873b16d Move @turf/helpers to dependencies 2017-11-26 20:30:24 -08:00
Denis
478f2b5871 Enforce new test rules
- DevDependencies must use * wildcards
- `jsts` dependency must use `turf-jsts`
- external files must be placed in `lib` folder
2017-11-26 20:18:08 -08:00
Moacir P. de Sá Pereira
6d6d5c4dc6 ES6ify bench.js and test.js boilerplate. 2017-11-25 13:23:47 -05:00
Denis Carriere
f5cf38cc57 Add extra geometry support for points-within-polygon 2017-11-22 10:55:49 -08:00
Denis
cd3da1b246
Update generate-readmes 2017-11-22 10:17:13 -08:00
Moacir P. de Sá Pereira
093fa4328d Update TypeScript boilerplate to the best of my ability. 2017-11-19 22:03:05 -05:00
Moacir P. de Sá Pereira
264b04e6e7 Update package.json boilerplate to look like modern modules 2017-11-19 22:02:16 -05:00
Moacir P. de Sá Pereira
b331206c88 Change index.js to use ES6 module export default syntax. 2017-11-19 22:01:05 -05:00
Denis
e427f85d36 Update dependant modules 2017-11-01 14:39:17 -04:00
Denis
24410c93cb Update 5.x and * dependencies 2017-11-01 13:08:48 -04:00