diff --git a/.gitignore b/.gitignore index cb1727ba8b..946bdf1629 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ .rpt2_cache -dist +packages/*/dist main.js main.es.js main.mjs diff --git a/package.json b/package.json index 6332e2cecc..a154fc72e1 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,11 @@ "packages/*" ], "scripts": { - "prelint": "tsc", "lint": "echo 'eslint will be moved to TSLint'", "postlint": "documentation lint packages/turf-*/index.js", "pretest": "lerna bootstrap --use-workspaces && npm run lint", "test": "lerna run test --use-workspaces", + "posttest": "lerna run --scope @turf/turf last-checks", "docs": "node ./scripts/generate-readmes", "postinstall": "opencollective postinstall" }, @@ -26,6 +26,7 @@ "lerna": "2.8.0", "load-json-file": "*", "meow": "*", + "npm-run-all": "^4.1.5", "progress": "*", "rollup": "*", "rollup-plugin-typescript": "*", diff --git a/packages/turf-along/.gitignore b/packages/turf-along/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-along/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-along/bench.js b/packages/turf-along/bench.js index dbf47ae016..b42c047968 100644 --- a/packages/turf-along/bench.js +++ b/packages/turf-along/bench.js @@ -1,6 +1,6 @@ const fs = require('fs'); const Benchmark = require('benchmark'); -const along = require('./').default; +const along = require('./dist/js/index.js').default; const line = { type: "Feature", diff --git a/packages/turf-along/index.d.ts b/packages/turf-along/index.d.ts deleted file mode 100644 index 8132157cc5..0000000000 --- a/packages/turf-along/index.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Feature, LineString, Point, Units } from "@turf/helpers"; -/** - * Takes a {@link LineString} and returns a {@link Point} at a specified distance along the line. - * - * @name along - * @param {Feature} line input line - * @param {number} distance distance along the line - * @param {Object} [options] Optional parameters - * @param {string} [options.units="kilometers"] can be degrees, radians, miles, or kilometers - * @returns {Feature} Point `distance` `units` along the line - * @example - * var line = turf.lineString([[-83, 30], [-84, 36], [-78, 41]]); - * var options = {units: 'miles'}; - * - * var along = turf.along(line, 200, options); - * - * //addToMap - * var addToMap = [along, line] - */ -export default function along(line: Feature | LineString, distance: number, options?: { - units?: Units; -}): Feature; diff --git a/packages/turf-along/package.json b/packages/turf-along/package.json index 1a0c57aa95..3190c5521a 100644 --- a/packages/turf-along/package.json +++ b/packages/turf-along/package.json @@ -2,17 +2,17 @@ "name": "@turf/along", "version": "6.1.0", "description": "turf along module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", + "bench": "npm-run-all prepare bench:run", + "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes" }, "repository": { diff --git a/packages/turf-along/test.js b/packages/turf-along/test.js index 95476917a9..929ea473a4 100644 --- a/packages/turf-along/test.js +++ b/packages/turf-along/test.js @@ -2,7 +2,7 @@ const path = require('path'); const test = require('tape'); const load = require('load-json-file'); const { featureCollection } = require('@turf/helpers'); -const along = require('./').default; +const along = require('./dist/js/index.js').default; const line = load.sync(path.join(__dirname, 'test', 'fixtures', 'dc-line.geojson')); diff --git a/packages/turf-along/tsconfig.json b/packages/turf-along/tsconfig.json index 230fe2dd4f..fc76991718 100644 --- a/packages/turf-along/tsconfig.json +++ b/packages/turf-along/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"], +} diff --git a/packages/turf-angle/.gitignore b/packages/turf-angle/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-angle/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-angle/bench.js b/packages/turf-angle/bench.js index 47f59712a4..7db155e0ca 100644 --- a/packages/turf-angle/bench.js +++ b/packages/turf-angle/bench.js @@ -1,6 +1,6 @@ const path = require('path'); const Benchmark = require('benchmark'); -const angle = require('./').default; +const angle = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-angle/index.d.ts b/packages/turf-angle/index.d.ts deleted file mode 100644 index a6370e3de9..0000000000 --- a/packages/turf-angle/index.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Coord } from "@turf/helpers"; -/** - * Finds the angle formed by two adjacent segments defined by 3 points. The result will be the (positive clockwise) - * angle with origin on the `startPoint-midPoint` segment, or its explementary angle if required. - * - * @name angle - * @param {Coord} startPoint Start Point Coordinates - * @param {Coord} midPoint Mid Point Coordinates - * @param {Coord} endPoint End Point Coordinates - * @param {Object} [options={}] Optional parameters - * @param {boolean} [options.explementary=false] Returns the explementary angle instead (360 - angle) - * @param {boolean} [options.mercator=false] if calculations should be performed over Mercator or WGS84 projection - * @returns {number} Angle between the provided points, or its explementary. - * @example - * turf.angle([5, 5], [5, 6], [3, 4]); - * //=45 - */ -declare function angle(startPoint: Coord, midPoint: Coord, endPoint: Coord, options?: { - explementary?: boolean; - mercator?: boolean; -}): number; -export default angle; diff --git a/packages/turf-angle/package.json b/packages/turf-angle/package.json index b9250c7f3d..f669166177 100644 --- a/packages/turf-angle/package.json +++ b/packages/turf-angle/package.json @@ -2,17 +2,17 @@ "name": "@turf/angle", "version": "6.0.1", "description": "turf angle module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", + "bench": "npm-run-all prepare bench:run", + "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes" }, "repository": { diff --git a/packages/turf-angle/test.js b/packages/turf-angle/test.js index fd70529702..d9c06f075c 100644 --- a/packages/turf-angle/test.js +++ b/packages/turf-angle/test.js @@ -8,7 +8,7 @@ const bearing = require('@turf/bearing').default; const truncate = require('@turf/truncate').default; const distance = require('@turf/distance').default; const { point, round, lineString, featureCollection } = require('@turf/helpers'); -const angle = require('./').default; +const angle = require('./dist/js/index.js').default; test('turf-angle', t => { glob.sync(path.join(__dirname, 'test', 'in', '*.json')).forEach(filepath => { diff --git a/packages/turf-angle/tsconfig.json b/packages/turf-angle/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-angle/tsconfig.json +++ b/packages/turf-angle/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-area/.gitignore b/packages/turf-area/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-area/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-area/bench.js b/packages/turf-area/bench.js index 2274418913..e7b2a27388 100644 --- a/packages/turf-area/bench.js +++ b/packages/turf-area/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const area = require('./').default; +const area = require('./dist/js/index.js').default; // Define fixtures const directory = path.join(__dirname, 'test', 'in') + path.sep; diff --git a/packages/turf-area/index.d.ts b/packages/turf-area/index.d.ts deleted file mode 100644 index 6503534b92..0000000000 --- a/packages/turf-area/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Feature, FeatureCollection, Geometry } from "@turf/helpers"; -/** - * Takes one or more features and returns their area in square meters. - * - * @name area - * @param {GeoJSON} geojson input GeoJSON feature(s) - * @returns {number} area in square meters - * @example - * var polygon = turf.polygon([[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]]); - * - * var area = turf.area(polygon); - * - * //addToMap - * var addToMap = [polygon] - * polygon.properties.area = area - */ -export default function area(geojson: Feature | FeatureCollection | Geometry): number; diff --git a/packages/turf-area/package.json b/packages/turf-area/package.json index 456087df98..c3bf85a1e0 100644 --- a/packages/turf-area/package.json +++ b/packages/turf-area/package.json @@ -2,17 +2,17 @@ "name": "@turf/area", "version": "6.0.1", "description": "turf area module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", + "bench": "npm-run-all prepare bench:run", + "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes" }, "repository": { diff --git a/packages/turf-area/test.js b/packages/turf-area/test.js index 7315e6c874..c769fafa89 100644 --- a/packages/turf-area/test.js +++ b/packages/turf-area/test.js @@ -3,7 +3,7 @@ const test = require('tape'); const path = require('path'); const load = require('load-json-file'); const write = require('write-json-file'); -const area = require('./').default; +const area = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-area/tsconfig.json b/packages/turf-area/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-area/tsconfig.json +++ b/packages/turf-area/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-bbox-clip/.gitignore b/packages/turf-bbox-clip/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-bbox-clip/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-bbox-clip/bench.js b/packages/turf-bbox-clip/bench.js index e06921a1e4..8f6b384fac 100644 --- a/packages/turf-bbox-clip/bench.js +++ b/packages/turf-bbox-clip/bench.js @@ -3,7 +3,7 @@ const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); const bbox = require('@turf/bbox').default; -const bboxClip = require('./').default; +const bboxClip = require('./dist/js/index.js').default; const directory = path.join(__dirname, 'test', 'in') + path.sep; const fixtures = fs.readdirSync(directory).map(filename => { diff --git a/packages/turf-bbox-clip/index.d.ts b/packages/turf-bbox-clip/index.d.ts deleted file mode 100644 index 8350daed20..0000000000 --- a/packages/turf-bbox-clip/index.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { BBox, Feature, LineString, MultiLineString, MultiPolygon, Polygon, Properties } from "@turf/helpers"; -/** - * Takes a {@link Feature} and a bbox and clips the feature to the bbox using - * [lineclip](https://github.com/mapbox/lineclip). - * May result in degenerate edges when clipping Polygons. - * - * @name bboxClip - * @param {Feature} feature feature to clip to the bbox - * @param {BBox} bbox extent in [minX, minY, maxX, maxY] order - * @returns {Feature} clipped Feature - * @example - * var bbox = [0, 0, 10, 10]; - * var poly = turf.polygon([[[2, 2], [8, 4], [12, 8], [3, 7], [2, 2]]]); - * - * var clipped = turf.bboxClip(poly, bbox); - * - * //addToMap - * var addToMap = [bbox, poly, clipped] - */ -export default function bboxClip(feature: Feature | G, bbox: BBox): Feature | Feature | Feature | Feature; diff --git a/packages/turf-bbox-clip/index.ts b/packages/turf-bbox-clip/index.ts index 29bc4f492d..850364fb32 100644 --- a/packages/turf-bbox-clip/index.ts +++ b/packages/turf-bbox-clip/index.ts @@ -3,7 +3,7 @@ import { multiLineString, MultiLineString, multiPolygon, MultiPolygon, polygon, Polygon, Properties, } from "@turf/helpers"; import { getCoords, getGeom } from "@turf/invariant"; -import * as lineclip from "./lib/lineclip"; +import {lineclip, polygonclip} from "./lib/lineclip"; /** * Takes a {@link Feature} and a bbox and clips the feature to the bbox using @@ -38,7 +38,7 @@ export default function bboxClip { - lineclip.polyline(line, bbox, lines); + lineclip(line, bbox, lines); }); if (lines.length === 1) { return lineString(lines[0], properties); } return multiLineString(lines, properties); @@ -56,7 +56,7 @@ export default function bboxClip 0) { if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) { clipped.push(clipped[0]); diff --git a/packages/turf-bbox-clip/lib/lineclip.d.ts b/packages/turf-bbox-clip/lib/lineclip.d.ts deleted file mode 100644 index c869fe313b..0000000000 --- a/packages/turf-bbox-clip/lib/lineclip.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { lineclip as polyline, polygonclip as polygon }; -export default function lineclip(points: any, bbox: any, result: any): any; -declare function polygonclip(points: any, bbox: any): any[] | undefined; diff --git a/packages/turf-bbox-clip/lib/lineclip.js b/packages/turf-bbox-clip/lib/lineclip.ts similarity index 93% rename from packages/turf-bbox-clip/lib/lineclip.js rename to packages/turf-bbox-clip/lib/lineclip.ts index 33f7bb332c..cf571befd2 100644 --- a/packages/turf-bbox-clip/lib/lineclip.js +++ b/packages/turf-bbox-clip/lib/lineclip.ts @@ -1,16 +1,7 @@ -'use strict'; - -module.exports = lineclip; -module.exports.default = lineclip; - -lineclip.polyline = lineclip; -lineclip.polygon = polygonclip; - - // Cohen-Sutherland line clippign algorithm, adapted to efficiently // handle polylines rather than just segments -function lineclip(points, bbox, result) { +export function lineclip(points, bbox, result) { var len = points.length, codeA = bitCode(points[0], bbox), @@ -64,7 +55,7 @@ function lineclip(points, bbox, result) { // Sutherland-Hodgeman polygon clipping algorithm -function polygonclip(points, bbox) { +export function polygonclip(points, bbox) { var result, edge, prev, prevInside, i, p, inside; diff --git a/packages/turf-bbox-clip/package.json b/packages/turf-bbox-clip/package.json index 931152291c..52cc82b89b 100644 --- a/packages/turf-bbox-clip/package.json +++ b/packages/turf-bbox-clip/package.json @@ -2,19 +2,17 @@ "name": "@turf/bbox-clip", "version": "6.0.3", "description": "turf bbox-clip module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts", - "lib/lineclip.js", - "lib/lineclip.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", + "bench": "npm-run-all prepare bench:run", + "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes" }, "repository": { diff --git a/packages/turf-bbox-clip/test.js b/packages/turf-bbox-clip/test.js index 0013ed43e6..24d8c334d3 100644 --- a/packages/turf-bbox-clip/test.js +++ b/packages/turf-bbox-clip/test.js @@ -5,7 +5,7 @@ const load = require('load-json-file'); const write = require('write-json-file'); const { point, feature, featureCollection } = require('@turf/helpers'); const turfBBox = require('@turf/bbox').default; -const bboxClip = require('./').default; +const bboxClip = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-bbox-clip/tsconfig.json b/packages/turf-bbox-clip/tsconfig.json index 91cffcbf55..60315e941c 100644 --- a/packages/turf-bbox-clip/tsconfig.json +++ b/packages/turf-bbox-clip/tsconfig.json @@ -1,17 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - }, - "files": [ - "index.ts" - ] -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts", "lib/lineclip.ts"] +} diff --git a/packages/turf-bbox-polygon/.gitignore b/packages/turf-bbox-polygon/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-bbox-polygon/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-bbox-polygon/bench.js b/packages/turf-bbox-polygon/bench.js index e1d5fde57b..7d68fe1faa 100644 --- a/packages/turf-bbox-polygon/bench.js +++ b/packages/turf-bbox-polygon/bench.js @@ -1,6 +1,6 @@ const fs = require('fs'); const Benchmark = require('benchmark'); -const bboxpolygon = require('./').default; +const bboxpolygon = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-bbox-polygon/index.d.ts b/packages/turf-bbox-polygon/index.d.ts deleted file mode 100644 index 41bf38140b..0000000000 --- a/packages/turf-bbox-polygon/index.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { BBox, Feature, Id, Polygon, Properties } from "@turf/helpers"; -/** - * Takes a bbox and returns an equivalent {@link Polygon|polygon}. - * - * @name bboxPolygon - * @param {BBox} bbox extent in [minX, minY, maxX, maxY] order - * @param {Object} [options={}] Optional parameters - * @param {Properties} [options.properties={}] Translate properties to Polygon - * @param {string|number} [options.id={}] Translate Id to Polygon - * @returns {Feature} a Polygon representation of the bounding box - * @example - * var bbox = [0, 0, 10, 10]; - * - * var poly = turf.bboxPolygon(bbox); - * - * //addToMap - * var addToMap = [poly] - */ -export default function bboxPolygon

(bbox: BBox, options?: { - properties?: P; - id?: Id; -}): Feature; diff --git a/packages/turf-bbox-polygon/package.json b/packages/turf-bbox-polygon/package.json index 17e81c03d1..3782c8559a 100644 --- a/packages/turf-bbox-polygon/package.json +++ b/packages/turf-bbox-polygon/package.json @@ -2,17 +2,17 @@ "name": "@turf/bbox-polygon", "version": "6.0.1", "description": "turf bbox-polygon module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", + "bench": "npm-run-all prepare bench:run", + "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes" }, "repository": { diff --git a/packages/turf-bbox-polygon/test.js b/packages/turf-bbox-polygon/test.js index 60b84a7b0a..0222b2ec69 100644 --- a/packages/turf-bbox-polygon/test.js +++ b/packages/turf-bbox-polygon/test.js @@ -1,5 +1,5 @@ const test = require('tape'); -const bboxPolygon = require('./').default; +const bboxPolygon = require('./dist/js/index.js').default; test('bbox-polygon', t => { const poly = bboxPolygon([0, 0, 10, 10]); diff --git a/packages/turf-bbox-polygon/tsconfig.json b/packages/turf-bbox-polygon/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-bbox-polygon/tsconfig.json +++ b/packages/turf-bbox-polygon/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-bbox/.gitignore b/packages/turf-bbox/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-bbox/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-bbox/bench.js b/packages/turf-bbox/bench.js index 9953c743b1..35b9e0eb57 100644 --- a/packages/turf-bbox/bench.js +++ b/packages/turf-bbox/bench.js @@ -1,7 +1,7 @@ const load = require('load-json-file'); const Benchmark = require('benchmark'); const { lineString } = require('@turf/helpers'); -const bbox = require('./').default; +const bbox = require('./dist/js/index.js').default; const line = lineString([[-74, 40], [-78, 42], [-82, 35]]); diff --git a/packages/turf-bbox/index.d.ts b/packages/turf-bbox/index.d.ts deleted file mode 100644 index f1da6f20c9..0000000000 --- a/packages/turf-bbox/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { BBox } from "@turf/helpers"; -/** - * Takes a set of features, calculates the bbox of all input features, and returns a bounding box. - * - * @name bbox - * @param {GeoJSON} geojson any GeoJSON object - * @returns {BBox} bbox extent in [minX, minY, maxX, maxY] order - * @example - * var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]]); - * var bbox = turf.bbox(line); - * var bboxPolygon = turf.bboxPolygon(bbox); - * - * //addToMap - * var addToMap = [line, bboxPolygon] - */ -export default function bbox(geojson: any): BBox; diff --git a/packages/turf-bbox/package.json b/packages/turf-bbox/package.json index c56fcee75d..a9f69088b8 100644 --- a/packages/turf-bbox/package.json +++ b/packages/turf-bbox/package.json @@ -2,17 +2,17 @@ "name": "@turf/bbox", "version": "6.0.1", "description": "turf bbox module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", + "bench": "npm-run-all prepare bench:run", + "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes" }, "repository": { diff --git a/packages/turf-bbox/test.js b/packages/turf-bbox/test.js index 0cb46b5ee7..a7bc56ecad 100644 --- a/packages/turf-bbox/test.js +++ b/packages/turf-bbox/test.js @@ -7,7 +7,7 @@ const { multiPolygon, multiLineString, featureCollection } = require('@turf/helpers') -const bbox = require('./').default; +const bbox = require('./dist/js/index.js').default; // Fixtures const pt = point([102.0, 0.5]); diff --git a/packages/turf-bbox/tsconfig.json b/packages/turf-bbox/tsconfig.json index 91cffcbf55..c3f78e4c94 100644 --- a/packages/turf-bbox/tsconfig.json +++ b/packages/turf-bbox/tsconfig.json @@ -1,17 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - }, - "files": [ - "index.ts" - ] -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-bearing/.gitignore b/packages/turf-bearing/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-bearing/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-bearing/bench.js b/packages/turf-bearing/bench.js index 3cae9804d3..a9308f8c3e 100644 --- a/packages/turf-bearing/bench.js +++ b/packages/turf-bearing/bench.js @@ -1,5 +1,5 @@ const Benchmark = require('benchmark'); -const bearing = require('./').default; +const bearing = require('./dist/js/index.js').default; var start = [-75.4, 39.4]; var end = [-75.534, 39.123]; diff --git a/packages/turf-bearing/index.d.ts b/packages/turf-bearing/index.d.ts deleted file mode 100644 index 2db1773078..0000000000 --- a/packages/turf-bearing/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Coord } from "@turf/helpers"; -/** - * Takes two {@link Point|points} and finds the geographic bearing between them, - * i.e. the angle measured in degrees from the north line (0 degrees) - * - * @name bearing - * @param {Coord} start starting Point - * @param {Coord} end ending Point - * @param {Object} [options={}] Optional parameters - * @param {boolean} [options.final=false] calculates the final bearing if true - * @returns {number} bearing in decimal degrees, between -180 and 180 degrees (positive clockwise) - * @example - * var point1 = turf.point([-75.343, 39.984]); - * var point2 = turf.point([-75.534, 39.123]); - * - * var bearing = turf.bearing(point1, point2); - * - * //addToMap - * var addToMap = [point1, point2] - * point1.properties['marker-color'] = '#f00' - * point2.properties['marker-color'] = '#0f0' - * point1.properties.bearing = bearing - */ -export default function bearing(start: Coord, end: Coord, options?: { - final?: boolean; -}): number; diff --git a/packages/turf-bearing/package.json b/packages/turf-bearing/package.json index 4e5d8df8d1..16b7bebad7 100644 --- a/packages/turf-bearing/package.json +++ b/packages/turf-bearing/package.json @@ -2,17 +2,17 @@ "name": "@turf/bearing", "version": "6.0.1", "description": "turf bearing module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", + "bench": "npm-run-all prepare bench:run", + "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes" }, "repository": { diff --git a/packages/turf-bearing/test.js b/packages/turf-bearing/test.js index c1a148bb4f..d90fd05604 100644 --- a/packages/turf-bearing/test.js +++ b/packages/turf-bearing/test.js @@ -3,7 +3,7 @@ const test = require('tape'); const write = require('write-json-file'); const destination = require('@turf/destination').default; const { point, lineString, featureCollection } = require('@turf/helpers'); -const bearing = require('./').default; +const bearing = require('./dist/js/index.js').default; const out = path.join(__dirname, 'test', 'out') + path.sep; diff --git a/packages/turf-bearing/tsconfig.json b/packages/turf-bearing/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-bearing/tsconfig.json +++ b/packages/turf-bearing/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-bezier-spline/.gitignore b/packages/turf-bezier-spline/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-bezier-spline/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-bezier-spline/bench.js b/packages/turf-bezier-spline/bench.js index 63032ef571..3a76f6823d 100644 --- a/packages/turf-bezier-spline/bench.js +++ b/packages/turf-bezier-spline/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const bezierSpline = require('./').default; +const bezierSpline = require('./dist/js/index.js').default; const directory = path.join(__dirname, 'test', 'in') + path.sep; const fixtures = fs.readdirSync(directory).map(filename => { diff --git a/packages/turf-bezier-spline/index.d.ts b/packages/turf-bezier-spline/index.d.ts deleted file mode 100644 index df13252cb1..0000000000 --- a/packages/turf-bezier-spline/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Feature, LineString, Properties } from "@turf/helpers"; -/** - * Takes a {@link LineString|line} and returns a curved version - * by applying a [Bezier spline](http://en.wikipedia.org/wiki/B%C3%A9zier_spline) - * algorithm. - * - * The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/). - * - * @name bezierSpline - * @param {Feature} line input LineString - * @param {Object} [options={}] Optional parameters - * @param {Object} [options.properties={}] Translate properties to output - * @param {number} [options.resolution=10000] time in milliseconds between points - * @param {number} [options.sharpness=0.85] a measure of how curvy the path should be between splines - * @returns {Feature} curved line - * @example - * var line = turf.lineString([ - * [-76.091308, 18.427501], - * [-76.695556, 18.729501], - * [-76.552734, 19.40443], - * [-74.61914, 19.134789], - * [-73.652343, 20.07657], - * [-73.157958, 20.210656] - * ]); - * - * var curved = turf.bezierSpline(line); - * - * //addToMap - * var addToMap = [line, curved] - * curved.properties = { stroke: '#0F0' }; - */ -declare function bezier

(line: Feature | LineString, options?: { - properties?: P; - resolution?: number; - sharpness?: number; -}): Feature; -export default bezier; diff --git a/packages/turf-bezier-spline/lib/spline.d.ts b/packages/turf-bezier-spline/lib/spline.d.ts deleted file mode 100644 index a4a8e1081b..0000000000 --- a/packages/turf-bezier-spline/lib/spline.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -export interface Point { - x: number; - y: number; - z: number; -} -/** - * BezierSpline - * https://github.com/leszekr/bezier-spline-js - * - * @private - * @copyright - * Copyright (c) 2013 Leszek Rybicki - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -export default class Spline { - duration: number; - points: Point[]; - sharpness: number; - centers: Point[]; - controls: Array<[Point, Point]>; - stepLength: number; - length: number; - delay: number; - steps: number[]; - constructor(options?: any); - /** - * Caches an array of equidistant (more or less) points on the curve. - */ - cacheSteps(mindist: number): number[]; - /** - * returns angle and speed in the given point in the curve - */ - vector(t: number): { - angle: number; - speed: number; - }; - /** - * Gets the position of the point, given time. - * - * WARNING: The speed is not constant. The time it takes between control points is constant. - * - * For constant speed, use Spline.steps[i]; - */ - pos(time: number): Point; -} diff --git a/packages/turf-bezier-spline/lib/spline.js b/packages/turf-bezier-spline/lib/spline.js deleted file mode 100644 index fe4865e4f9..0000000000 --- a/packages/turf-bezier-spline/lib/spline.js +++ /dev/null @@ -1,146 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * BezierSpline - * https://github.com/leszekr/bezier-spline-js - * - * @private - * @copyright - * Copyright (c) 2013 Leszek Rybicki - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -var Spline = /** @class */ (function () { - function Spline(options) { - this.points = options.points || []; - this.duration = options.duration || 10000; - this.sharpness = options.sharpness || 0.85; - this.centers = []; - this.controls = []; - this.stepLength = options.stepLength || 60; - this.length = this.points.length; - this.delay = 0; - // this is to ensure compatibility with the 2d version - for (var i = 0; i < this.length; i++) { - this.points[i].z = this.points[i].z || 0; - } - for (var i = 0; i < this.length - 1; i++) { - var p1 = this.points[i]; - var p2 = this.points[i + 1]; - this.centers.push({ - x: (p1.x + p2.x) / 2, - y: (p1.y + p2.y) / 2, - z: (p1.z + p2.z) / 2, - }); - } - this.controls.push([this.points[0], this.points[0]]); - for (var i = 0; i < this.centers.length - 1; i++) { - var p1 = this.centers[i]; - var p2 = this.centers[i + 1]; - var dx = this.points[i + 1].x - (this.centers[i].x + this.centers[i + 1].x) / 2; - var dy = this.points[i + 1].y - (this.centers[i].y + this.centers[i + 1].y) / 2; - var dz = this.points[i + 1].z - (this.centers[i].y + this.centers[i + 1].z) / 2; - this.controls.push([{ - x: (1.0 - this.sharpness) * this.points[i + 1].x + this.sharpness * (this.centers[i].x + dx), - y: (1.0 - this.sharpness) * this.points[i + 1].y + this.sharpness * (this.centers[i].y + dy), - z: (1.0 - this.sharpness) * this.points[i + 1].z + this.sharpness * (this.centers[i].z + dz) - }, - { - x: (1.0 - this.sharpness) * this.points[i + 1].x + this.sharpness * (this.centers[i + 1].x + dx), - y: (1.0 - this.sharpness) * this.points[i + 1].y + this.sharpness * (this.centers[i + 1].y + dy), - z: (1.0 - this.sharpness) * this.points[i + 1].z + this.sharpness * (this.centers[i + 1].z + dz) - }]); - } - this.controls.push([this.points[this.length - 1], this.points[this.length - 1]]); - this.steps = this.cacheSteps(this.stepLength); - return this; - } - /** - * Caches an array of equidistant (more or less) points on the curve. - */ - Spline.prototype.cacheSteps = function (mindist) { - var steps = []; - var laststep = this.pos(0); - steps.push(0); - for (var t = 0; t < this.duration; t += 10) { - var step = this.pos(t); - var dist = Math.sqrt((step.x - laststep.x) * (step.x - laststep.x) + - (step.y - laststep.y) * (step.y - laststep.y) + - (step.z - laststep.z) * (step.z - laststep.z)); - if (dist > mindist) { - steps.push(t); - laststep = step; - } - } - return steps; - }; - /** - * returns angle and speed in the given point in the curve - */ - Spline.prototype.vector = function (t) { - var p1 = this.pos(t + 10); - var p2 = this.pos(t - 10); - return { - angle: 180 * Math.atan2(p1.y - p2.y, p1.x - p2.x) / 3.14, - speed: Math.sqrt((p2.x - p1.x) * (p2.x - p1.x) + - (p2.y - p1.y) * (p2.y - p1.y) + - (p2.z - p1.z) * (p2.z - p1.z)), - }; - }; - /** - * Gets the position of the point, given time. - * - * WARNING: The speed is not constant. The time it takes between control points is constant. - * - * For constant speed, use Spline.steps[i]; - */ - Spline.prototype.pos = function (time) { - var t = time - this.delay; - if (t < 0) { - t = 0; - } - if (t > this.duration) { - t = this.duration - 1; - } - // t = t-this.delay; - var t2 = (t) / this.duration; - if (t2 >= 1) { - return this.points[this.length - 1]; - } - var n = Math.floor((this.points.length - 1) * t2); - var t1 = (this.length - 1) * t2 - n; - return bezier(t1, this.points[n], this.controls[n][1], this.controls[n + 1][0], this.points[n + 1]); - }; - return Spline; -}()); -exports.default = Spline; -function bezier(t, p1, c1, c2, p2) { - var b = B(t); - var pos = { - x: p2.x * b[0] + c2.x * b[1] + c1.x * b[2] + p1.x * b[3], - y: p2.y * b[0] + c2.y * b[1] + c1.y * b[2] + p1.y * b[3], - z: p2.z * b[0] + c2.z * b[1] + c1.z * b[2] + p1.z * b[3], - }; - return pos; -} -function B(t) { - var t2 = t * t; - var t3 = t2 * t; - return [(t3), (3 * t2 * (1 - t)), (3 * t * (1 - t) * (1 - t)), ((1 - t) * (1 - t) * (1 - t))]; -} diff --git a/packages/turf-bezier-spline/package.json b/packages/turf-bezier-spline/package.json index 6fbd175ce4..2b2ca232f6 100644 --- a/packages/turf-bezier-spline/package.json +++ b/packages/turf-bezier-spline/package.json @@ -2,19 +2,17 @@ "name": "@turf/bezier-spline", "version": "6.0.3", "description": "turf bezier-spline module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts", - "lib/spline.js", - "lib/spline.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", + "bench": "npm-run-all prepare bench:run", + "bench:run": "node bench.js", "docs": "node ../../scripts/generate-readmes" }, "repository": { diff --git a/packages/turf-bezier-spline/test.js b/packages/turf-bezier-spline/test.js index de366b33a0..d59c5e4002 100644 --- a/packages/turf-bezier-spline/test.js +++ b/packages/turf-bezier-spline/test.js @@ -4,7 +4,7 @@ const path = require('path'); const load = require('load-json-file'); const write = require('write-json-file'); const { featureCollection } = require('@turf/helpers'); -const bezierSpline = require('./').default; +const bezierSpline = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-bezier-spline/tsconfig.json b/packages/turf-bezier-spline/tsconfig.json index a896721cb4..bb9b800801 100644 --- a/packages/turf-bezier-spline/tsconfig.json +++ b/packages/turf-bezier-spline/tsconfig.json @@ -1,18 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - }, - "files": [ - "index.ts", - "lib/spline.ts" - ] -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts", "lib/spline.ts"] +} diff --git a/packages/turf-boolean-clockwise/.gitignore b/packages/turf-boolean-clockwise/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-boolean-clockwise/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-boolean-clockwise/bench.js b/packages/turf-boolean-clockwise/bench.js index 6a3975a513..9a05d2d899 100755 --- a/packages/turf-boolean-clockwise/bench.js +++ b/packages/turf-boolean-clockwise/bench.js @@ -2,7 +2,7 @@ const path = require('path'); const glob = require('glob'); const Benchmark = require('benchmark'); const load = require('load-json-file'); -const isClockwise = require('./').default; +const isClockwise = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-boolean-clockwise/index.d.ts b/packages/turf-boolean-clockwise/index.d.ts deleted file mode 100644 index 020ea903b4..0000000000 --- a/packages/turf-boolean-clockwise/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Feature, LineString, Position } from "@turf/helpers"; -/** - * Takes a ring and return true or false whether or not the ring is clockwise or counter-clockwise. - * - * @name booleanClockwise - * @param {Feature|LineString|Array>} line to be evaluated - * @returns {boolean} true/false - * @example - * var clockwiseRing = turf.lineString([[0,0],[1,1],[1,0],[0,0]]); - * var counterClockwiseRing = turf.lineString([[0,0],[1,0],[1,1],[0,0]]); - * - * turf.booleanClockwise(clockwiseRing) - * //=true - * turf.booleanClockwise(counterClockwiseRing) - * //=false - */ -export default function booleanClockwise(line: Feature | LineString | Position[]): boolean; diff --git a/packages/turf-boolean-clockwise/package.json b/packages/turf-boolean-clockwise/package.json index 5eee2bad68..ba6eb6776a 100755 --- a/packages/turf-boolean-clockwise/package.json +++ b/packages/turf-boolean-clockwise/package.json @@ -2,18 +2,18 @@ "name": "@turf/boolean-clockwise", "version": "6.0.1", "description": "turf boolean-clockwise module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-boolean-clockwise/test.js b/packages/turf-boolean-clockwise/test.js index 71af2c311a..897895bee2 100644 --- a/packages/turf-boolean-clockwise/test.js +++ b/packages/turf-boolean-clockwise/test.js @@ -3,7 +3,7 @@ const path = require('path'); const test = require('tape'); const load = require('load-json-file'); const { point, lineString } = require('@turf/helpers'); -const isClockwise = require('./').default; +const isClockwise = require('./dist/js/index.js').default; test('isClockwise#fixtures', t => { // True Fixtures diff --git a/packages/turf-boolean-clockwise/tsconfig.json b/packages/turf-boolean-clockwise/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-boolean-clockwise/tsconfig.json +++ b/packages/turf-boolean-clockwise/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-boolean-concave/.gitignore b/packages/turf-boolean-concave/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-boolean-concave/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-boolean-concave/bench.js b/packages/turf-boolean-concave/bench.js index b8e56cdadf..2307570e20 100644 --- a/packages/turf-boolean-concave/bench.js +++ b/packages/turf-boolean-concave/bench.js @@ -2,7 +2,7 @@ const path = require('path'); const glob = require('glob'); const Benchmark = require('benchmark'); const load = require('load-json-file'); -const concave = require('./').default; +const concave = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-boolean-concave/index.d.ts b/packages/turf-boolean-concave/index.d.ts deleted file mode 100644 index 0b5a5bcf98..0000000000 --- a/packages/turf-boolean-concave/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Feature, Polygon } from "@turf/helpers"; -/** - * Takes a polygon and return true or false as to whether it is concave or not. - * - * @name booleanConcave - * @param {Feature} polygon to be evaluated - * @returns {boolean} true/false - * @example - * var convexPolygon = turf.polygon([[[0,0],[0,1],[1,1],[1,0],[0,0]]]); - * - * turf.booleanConcave(convexPolygon) - * //=false - */ -export default function booleanConcave(polygon: Feature | Polygon): boolean; diff --git a/packages/turf-boolean-concave/package.json b/packages/turf-boolean-concave/package.json index 9083ae2dab..5c5ac53fce 100644 --- a/packages/turf-boolean-concave/package.json +++ b/packages/turf-boolean-concave/package.json @@ -2,18 +2,18 @@ "name": "@turf/boolean-concave", "version": "6.0.1", "description": "turf boolean-concave module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-boolean-concave/test.js b/packages/turf-boolean-concave/test.js index 69ce94d930..a8dc324243 100644 --- a/packages/turf-boolean-concave/test.js +++ b/packages/turf-boolean-concave/test.js @@ -3,7 +3,7 @@ const path = require('path'); const test = require('tape'); const load = require('load-json-file'); const { polygon, point } = require('@turf/helpers'); -const isConcave = require('./').default; +const isConcave = require('./dist/js/index.js').default; test('isConcave#fixtures', t => { // True Fixtures diff --git a/packages/turf-boolean-concave/tsconfig.json b/packages/turf-boolean-concave/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-boolean-concave/tsconfig.json +++ b/packages/turf-boolean-concave/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-boolean-contains/.gitignore b/packages/turf-boolean-contains/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-boolean-contains/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-boolean-contains/bench.js b/packages/turf-boolean-contains/bench.js index dd2114f263..10019e304f 100644 --- a/packages/turf-boolean-contains/bench.js +++ b/packages/turf-boolean-contains/bench.js @@ -3,7 +3,7 @@ import glob from 'glob'; import Benchmark from 'benchmark'; import load from 'load-json-file'; import bbox from '@turf/bbox'; -import contains from './'; +import contains from './dist/js/index.js'; /** * Benchmark Results diff --git a/packages/turf-boolean-contains/index.d.ts b/packages/turf-boolean-contains/index.d.ts deleted file mode 100644 index 5185d36af9..0000000000 --- a/packages/turf-boolean-contains/index.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { BBox, Feature, Geometry, LineString, MultiPoint, Point, Polygon } from "@turf/helpers"; -/** - * Boolean-contains returns True if the second geometry is completely contained by the first geometry. - * The interiors of both geometries must intersect and, the interior and boundary of the secondary (geometry b) - * must not intersect the exterior of the primary (geometry a). - * Boolean-contains returns the exact opposite result of the `@turf/boolean-within`. - * - * @name booleanContains - * @param {Geometry|Feature} feature1 GeoJSON Feature or Geometry - * @param {Geometry|Feature} feature2 GeoJSON Feature or Geometry - * @returns {boolean} true/false - * @example - * var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]); - * var point = turf.point([1, 2]); - * - * turf.booleanContains(line, point); - * //=true - */ -export default function booleanContains(feature1: Feature | Geometry, feature2: Feature | Geometry): boolean; -export declare function isPointInMultiPoint(multiPoint: MultiPoint, pt: Point): boolean; -export declare function isMultiPointInMultiPoint(multiPoint1: MultiPoint, multiPoint2: MultiPoint): boolean; -export declare function isMultiPointOnLine(lineString: LineString, multiPoint: MultiPoint): boolean; -export declare function isMultiPointInPoly(polygon: Polygon, multiPoint: MultiPoint): boolean; -export declare function isLineOnLine(lineString1: LineString, lineString2: LineString): boolean; -export declare function isLineInPoly(polygon: Polygon, linestring: LineString): boolean; -/** - * Is Polygon2 in Polygon1 - * Only takes into account outer rings - * - * @private - * @param {Geometry|Feature} feature1 Polygon1 - * @param {Geometry|Feature} feature2 Polygon2 - * @returns {boolean} true/false - */ -export declare function isPolyInPoly(feature1: Feature | Polygon, feature2: Feature | Polygon): boolean; -export declare function doBBoxOverlap(bbox1: BBox, bbox2: BBox): boolean; -/** - * compareCoords - * - * @private - * @param {Position} pair1 point [x,y] - * @param {Position} pair2 point [x,y] - * @returns {boolean} true/false if coord pairs match - */ -export declare function compareCoords(pair1: number[], pair2: number[]): boolean; -export declare function getMidpoint(pair1: number[], pair2: number[]): number[]; diff --git a/packages/turf-boolean-contains/package.json b/packages/turf-boolean-contains/package.json index 75cb8127c3..21fb6cd9e2 100644 --- a/packages/turf-boolean-contains/package.json +++ b/packages/turf-boolean-contains/package.json @@ -2,18 +2,18 @@ "name": "@turf/boolean-contains", "version": "6.0.1", "description": "turf boolean-contains module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-boolean-contains/test.js b/packages/turf-boolean-contains/test.js index 68dec44391..1ff34d050c 100644 --- a/packages/turf-boolean-contains/test.js +++ b/packages/turf-boolean-contains/test.js @@ -5,7 +5,7 @@ const load = require('load-json-file'); const { point } = require('@turf/helpers'); const booleanJSTS = require('boolean-jsts'); const shapely = require('boolean-shapely'); -const contains = require('./').default; +const contains = require('./dist/js/index.js').default; test('turf-boolean-contains', t => { // True Fixtures diff --git a/packages/turf-boolean-contains/tsconfig.json b/packages/turf-boolean-contains/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-boolean-contains/tsconfig.json +++ b/packages/turf-boolean-contains/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-boolean-crosses/.gitignore b/packages/turf-boolean-crosses/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-boolean-crosses/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-boolean-crosses/bench.js b/packages/turf-boolean-crosses/bench.js index 18a43dd72f..290e4dbe2f 100644 --- a/packages/turf-boolean-crosses/bench.js +++ b/packages/turf-boolean-crosses/bench.js @@ -2,7 +2,7 @@ const path = require('path'); const glob = require('glob'); const Benchmark = require('benchmark'); const load = require('load-json-file'); -const crosses = require('./').default; +const crosses = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-boolean-crosses/package.json b/packages/turf-boolean-crosses/package.json index 4f861ab02a..2a57ef0a62 100644 --- a/packages/turf-boolean-crosses/package.json +++ b/packages/turf-boolean-crosses/package.json @@ -2,18 +2,18 @@ "name": "@turf/boolean-crosses", "version": "6.0.1", "description": "turf boolean-crosses module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-boolean-crosses/test.js b/packages/turf-boolean-crosses/test.js index d2f178a2ac..f0c09d84e8 100644 --- a/packages/turf-boolean-crosses/test.js +++ b/packages/turf-boolean-crosses/test.js @@ -3,7 +3,7 @@ const glob = require('glob'); const path = require('path'); const load = require('load-json-file'); const shapely = require('boolean-shapely'); -const crosses = require('./').default; +const crosses = require('./dist/js/index.js').default; test('turf-boolean-crosses', t => { // True Fixtures diff --git a/packages/turf-boolean-crosses/tsconfig.json b/packages/turf-boolean-crosses/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-boolean-crosses/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-boolean-disjoint/.gitignore b/packages/turf-boolean-disjoint/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-boolean-disjoint/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-boolean-disjoint/bench.js b/packages/turf-boolean-disjoint/bench.js index 12d994d4b1..98f2070193 100644 --- a/packages/turf-boolean-disjoint/bench.js +++ b/packages/turf-boolean-disjoint/bench.js @@ -2,7 +2,7 @@ const path = require('path'); const glob = require('glob'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const disjoint = require('./').default; +const disjoint = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-boolean-disjoint/index.d.ts b/packages/turf-boolean-disjoint/index.d.ts deleted file mode 100644 index a795901af2..0000000000 --- a/packages/turf-boolean-disjoint/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Feature, Geometry } from "@turf/helpers"; -/** - * Boolean-disjoint returns (TRUE) if the intersection of the two geometries is an empty set. - * - * @name booleanDisjoint - * @param {Geometry|Feature} feature1 GeoJSON Feature or Geometry - * @param {Geometry|Feature} feature2 GeoJSON Feature or Geometry - * @returns {boolean} true/false - * @example - * var point = turf.point([2, 2]); - * var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]); - * - * turf.booleanDisjoint(line, point); - * //=true - */ -declare function booleanDisjoint(feature1: Feature | Geometry, feature2: Feature | Geometry): boolean; -export default booleanDisjoint; diff --git a/packages/turf-boolean-disjoint/package.json b/packages/turf-boolean-disjoint/package.json index e14d8fdbf0..a2156f2648 100644 --- a/packages/turf-boolean-disjoint/package.json +++ b/packages/turf-boolean-disjoint/package.json @@ -2,18 +2,18 @@ "name": "@turf/boolean-disjoint", "version": "6.0.2", "description": "turf boolean-disjoint module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-boolean-disjoint/test.js b/packages/turf-boolean-disjoint/test.js index fec7872c9d..17b59057d2 100644 --- a/packages/turf-boolean-disjoint/test.js +++ b/packages/turf-boolean-disjoint/test.js @@ -3,7 +3,7 @@ const path = require('path'); const test = require('tape'); const load = require('load-json-file'); const shapely = require('boolean-shapely'); -const disjoint = require('./').default; +const disjoint = require('./dist/js/index.js').default; test('turf-boolean-disjoint', t => { // True Fixtures diff --git a/packages/turf-boolean-disjoint/tsconfig.json b/packages/turf-boolean-disjoint/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-boolean-disjoint/tsconfig.json +++ b/packages/turf-boolean-disjoint/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-boolean-equal/.gitignore b/packages/turf-boolean-equal/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-boolean-equal/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-boolean-equal/bench.js b/packages/turf-boolean-equal/bench.js index 0071029451..2bf72aadf9 100644 --- a/packages/turf-boolean-equal/bench.js +++ b/packages/turf-boolean-equal/bench.js @@ -2,7 +2,7 @@ const path = require('path'); const glob = require('glob'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const equal = require('./').defualt; +const equal = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-boolean-equal/index.ts b/packages/turf-boolean-equal/index.ts index cdd3d42f1b..088209b8d0 100644 --- a/packages/turf-boolean-equal/index.ts +++ b/packages/turf-boolean-equal/index.ts @@ -1,4 +1,4 @@ -import * as GeojsonEquality from 'geojson-equality'; +import GeojsonEquality from 'geojson-equality'; import cleanCoords from '@turf/clean-coords'; import { getGeom } from '@turf/invariant'; import { Feature, Geometry } from '@turf/helpers'; diff --git a/packages/turf-boolean-equal/package.json b/packages/turf-boolean-equal/package.json index dc4da6e424..a0a641d20c 100644 --- a/packages/turf-boolean-equal/package.json +++ b/packages/turf-boolean-equal/package.json @@ -2,18 +2,18 @@ "name": "@turf/boolean-equal", "version": "6.0.1", "description": "turf boolean-equal module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", @@ -49,7 +49,7 @@ "@types/tape": "*" }, "dependencies": { - "@turf/clean-coords": "6.0.0", + "@turf/clean-coords": "6.x", "@turf/helpers": "6.x", "@turf/invariant": "6.x", "geojson-equality": "0.1.6" diff --git a/packages/turf-boolean-equal/test.js b/packages/turf-boolean-equal/test.js index 441e478fa7..d6fa760452 100644 --- a/packages/turf-boolean-equal/test.js +++ b/packages/turf-boolean-equal/test.js @@ -4,7 +4,7 @@ const test = require('tape'); const load = require('load-json-file'); const shapely = require('boolean-shapely'); const { point, lineString, polygon } = require('@turf/helpers'); -const equal = require('./').default; +const equal = require('./dist/js/index.js').default; test('turf-boolean-equal', t => { // True Fixtures diff --git a/packages/turf-boolean-equal/tsconfig.json b/packages/turf-boolean-equal/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-boolean-equal/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-boolean-intersects/.gitignore b/packages/turf-boolean-intersects/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-boolean-intersects/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-boolean-intersects/bench.js b/packages/turf-boolean-intersects/bench.js index 4e3f531516..9c82a9fcf1 100644 --- a/packages/turf-boolean-intersects/bench.js +++ b/packages/turf-boolean-intersects/bench.js @@ -2,7 +2,7 @@ const path = require('path'); const glob = require('glob'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const intersects = require('./').default; +const intersects = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-boolean-intersects/index.d.ts b/packages/turf-boolean-intersects/index.d.ts deleted file mode 100644 index 5ff5f29194..0000000000 --- a/packages/turf-boolean-intersects/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Feature, Geometry } from "@turf/helpers"; -/** - * Boolean-intersects returns (TRUE) two geometries intersect. - * - * @name booleanIntersects - * @param {Geometry|Feature} feature1 GeoJSON Feature or Geometry - * @param {Geometry|Feature} feature2 GeoJSON Feature or Geometry - * @returns {boolean} true/false - * @example - * var point = turf.point([2, 2]); - * var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]); - * - * turf.booleanIntersects(line, point); - * //=true - */ -export default function booleanIntersects(feature1: Feature | Geometry, feature2: Feature | Geometry): boolean; diff --git a/packages/turf-boolean-intersects/package.json b/packages/turf-boolean-intersects/package.json index 4c60008659..74de80ce63 100644 --- a/packages/turf-boolean-intersects/package.json +++ b/packages/turf-boolean-intersects/package.json @@ -2,18 +2,18 @@ "name": "@turf/boolean-intersects", "version": "6.0.2", "description": "turf boolean-intersects module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-boolean-intersects/test.js b/packages/turf-boolean-intersects/test.js index d0cdae6e0b..e0576ab8b4 100644 --- a/packages/turf-boolean-intersects/test.js +++ b/packages/turf-boolean-intersects/test.js @@ -3,7 +3,7 @@ const path = require('path'); const test = require('tape'); const load = require('load-json-file'); const shapely = require('boolean-shapely'); -const intersects = require('./').default; +const intersects = require('./dist/js/index.js').default; test('turf-boolean-intersects', t => { // True Fixtures diff --git a/packages/turf-boolean-intersects/tsconfig.json b/packages/turf-boolean-intersects/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-boolean-intersects/tsconfig.json +++ b/packages/turf-boolean-intersects/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-boolean-overlap/.gitignore b/packages/turf-boolean-overlap/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-boolean-overlap/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-boolean-overlap/bench.js b/packages/turf-boolean-overlap/bench.js index 0699ecdc02..154bcd7b4a 100755 --- a/packages/turf-boolean-overlap/bench.js +++ b/packages/turf-boolean-overlap/bench.js @@ -2,7 +2,7 @@ const path = require('path'); const glob = require('glob'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const overlap = require('./').default; +const overlap = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-boolean-overlap/index.ts b/packages/turf-boolean-overlap/index.ts index 29f146736c..97cce72f8e 100644 --- a/packages/turf-boolean-overlap/index.ts +++ b/packages/turf-boolean-overlap/index.ts @@ -2,7 +2,7 @@ import { coordAll, segmentEach } from '@turf/meta'; import { getGeom } from '@turf/invariant'; import lineOverlap from '@turf/line-overlap'; import lineIntersect from '@turf/line-intersect'; -import * as GeojsonEquality from 'geojson-equality'; +import GeojsonEquality from 'geojson-equality'; import { Feature, LineString, MultiLineString, Polygon, MultiPolygon, Geometry } from '@turf/helpers'; /** diff --git a/packages/turf-boolean-overlap/package.json b/packages/turf-boolean-overlap/package.json index c4e84295d5..3911a9eda3 100755 --- a/packages/turf-boolean-overlap/package.json +++ b/packages/turf-boolean-overlap/package.json @@ -2,18 +2,18 @@ "name": "@turf/boolean-overlap", "version": "6.0.1", "description": "turf boolean-overlap module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-boolean-overlap/test.js b/packages/turf-boolean-overlap/test.js index ccf798c2e5..050c450d90 100644 --- a/packages/turf-boolean-overlap/test.js +++ b/packages/turf-boolean-overlap/test.js @@ -4,7 +4,7 @@ const test = require('tape'); const load = require('load-json-file'); const shapely = require('boolean-shapely'); const { point, lineString, polygon } = require('@turf/helpers'); -const overlap = require('./').default; +const overlap = require('./dist/js/index.js').default; test('turf-boolean-overlap', t => { // True Fixtures diff --git a/packages/turf-boolean-overlap/tsconfig.json b/packages/turf-boolean-overlap/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-boolean-overlap/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-boolean-parallel/.gitignore b/packages/turf-boolean-parallel/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-boolean-parallel/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-boolean-parallel/bench.js b/packages/turf-boolean-parallel/bench.js index 0250a5badf..0dc100493d 100644 --- a/packages/turf-boolean-parallel/bench.js +++ b/packages/turf-boolean-parallel/bench.js @@ -2,7 +2,7 @@ const path = require('path'); const glob = require('glob'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const booleanParallel = require('./').default; +const booleanParallel = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-boolean-parallel/package.json b/packages/turf-boolean-parallel/package.json index 23f57a8eac..e01a22bf1d 100644 --- a/packages/turf-boolean-parallel/package.json +++ b/packages/turf-boolean-parallel/package.json @@ -2,18 +2,18 @@ "name": "@turf/boolean-parallel", "version": "6.0.1", "description": "turf boolean-parallel module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-boolean-parallel/test.js b/packages/turf-boolean-parallel/test.js index edb2d00f01..e3550f0446 100644 --- a/packages/turf-boolean-parallel/test.js +++ b/packages/turf-boolean-parallel/test.js @@ -3,7 +3,7 @@ const path = require('path'); const test = require('tape'); const load = require('load-json-file'); const { lineString, polygon } = require('@turf/helpers'); -const booleanParallel = require('.').default; +const booleanParallel = require('./dist/js/index.js').default; test('turf-boolean-parallel', t => { // True Fixtures diff --git a/packages/turf-boolean-parallel/tsconfig.json b/packages/turf-boolean-parallel/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-boolean-parallel/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-boolean-point-in-polygon/.gitignore b/packages/turf-boolean-point-in-polygon/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-boolean-point-in-polygon/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-boolean-point-in-polygon/bench.js b/packages/turf-boolean-point-in-polygon/bench.js index 0075cd8e60..5be6d847dc 100644 --- a/packages/turf-boolean-point-in-polygon/bench.js +++ b/packages/turf-boolean-point-in-polygon/bench.js @@ -1,7 +1,7 @@ const fs = require('fs'); const Benchmark = require('benchmark'); const { point, polygon } = require('@turf/helpers'); -const booleanPointInPolygon = require('./').default; +const booleanPointInPolygon = require('./dist/js/index.js').default; var poly = polygon([[[0, 0], [0, 100], [100, 100], [100, 0], [0, 0]]]); var ptIn = point([50, 50]); diff --git a/packages/turf-boolean-point-in-polygon/index.d.ts b/packages/turf-boolean-point-in-polygon/index.d.ts deleted file mode 100644 index 2e75dd5114..0000000000 --- a/packages/turf-boolean-point-in-polygon/index.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Coord, Feature, MultiPolygon, Polygon, Properties } from "@turf/helpers"; -/** - * Takes a {@link Point} and a {@link Polygon} or {@link MultiPolygon} and determines if the point - * resides inside the polygon. The polygon can be convex or concave. The function accounts for holes. - * - * @name booleanPointInPolygon - * @param {Coord} point input point - * @param {Feature} polygon input polygon or multipolygon - * @param {Object} [options={}] Optional parameters - * @param {boolean} [options.ignoreBoundary=false] True if polygon boundary should be ignored when determining if - * the point is inside the polygon otherwise false. - * @returns {boolean} `true` if the Point is inside the Polygon; `false` if the Point is not inside the Polygon - * @example - * var pt = turf.point([-77, 44]); - * var poly = turf.polygon([[ - * [-81, 41], - * [-81, 47], - * [-72, 47], - * [-72, 41], - * [-81, 41] - * ]]); - * - * turf.booleanPointInPolygon(pt, poly); - * //= true - */ -export default function booleanPointInPolygon(point: Coord, polygon: Feature | G, options?: { - ignoreBoundary?: boolean; -}): boolean; diff --git a/packages/turf-boolean-point-in-polygon/package.json b/packages/turf-boolean-point-in-polygon/package.json index 75409c4fb5..bb2b069819 100644 --- a/packages/turf-boolean-point-in-polygon/package.json +++ b/packages/turf-boolean-point-in-polygon/package.json @@ -2,18 +2,18 @@ "name": "@turf/boolean-point-in-polygon", "version": "6.0.1", "description": "turf boolean-point-in-polygon module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-boolean-point-in-polygon/test.js b/packages/turf-boolean-point-in-polygon/test.js index 56532465a4..e5a7f2e7ec 100644 --- a/packages/turf-boolean-point-in-polygon/test.js +++ b/packages/turf-boolean-point-in-polygon/test.js @@ -2,7 +2,7 @@ const fs = require('fs'); const test = require('tape'); const { point } = require('@turf/helpers'); const { polygon } = require('@turf/helpers'); -const booleanPointInPolygon = require('./').default; +const booleanPointInPolygon = require('./dist/js/index.js').default; test('boolean-point-in-polygon -- featureCollection', function (t) { // test for a simple polygon diff --git a/packages/turf-boolean-point-in-polygon/tsconfig.json b/packages/turf-boolean-point-in-polygon/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-boolean-point-in-polygon/tsconfig.json +++ b/packages/turf-boolean-point-in-polygon/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-boolean-point-on-line/.gitignore b/packages/turf-boolean-point-on-line/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-boolean-point-on-line/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-boolean-point-on-line/bench.js b/packages/turf-boolean-point-on-line/bench.js index 4316b6ca8e..beb0353e1a 100644 --- a/packages/turf-boolean-point-on-line/bench.js +++ b/packages/turf-boolean-point-on-line/bench.js @@ -2,7 +2,7 @@ const path = require('path'); const glob = require('glob'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const booleanPointOnLine = require('./').default; +const booleanPointOnLine = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-boolean-point-on-line/index.d.ts b/packages/turf-boolean-point-on-line/index.d.ts deleted file mode 100644 index f1de7e2fae..0000000000 --- a/packages/turf-boolean-point-on-line/index.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Coord, Feature, LineString } from "@turf/helpers"; -/** - * Returns true if a point is on a line. Accepts a optional parameter to ignore the - * start and end vertices of the linestring. - * - * @name booleanPointOnLine - * @param {Coord} pt GeoJSON Point - * @param {Feature} line GeoJSON LineString - * @param {Object} [options={}] Optional parameters - * @param {boolean} [options.ignoreEndVertices=false] whether to ignore the start and end vertices. - * @returns {boolean} true/false - * @example - * var pt = turf.point([0, 0]); - * var line = turf.lineString([[-1, -1],[1, 1],[1.5, 2.2]]); - * var isPointOnLine = turf.booleanPointOnLine(pt, line); - * //=true - */ -declare function booleanPointOnLine(pt: Coord, line: Feature | LineString, options?: { - ignoreEndVertices?: boolean; -}): boolean; -export default booleanPointOnLine; diff --git a/packages/turf-boolean-point-on-line/package.json b/packages/turf-boolean-point-on-line/package.json index 478e25ea60..903d71e863 100644 --- a/packages/turf-boolean-point-on-line/package.json +++ b/packages/turf-boolean-point-on-line/package.json @@ -2,18 +2,18 @@ "name": "@turf/boolean-point-on-line", "version": "6.0.1", "description": "turf boolean-point-on-line module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-boolean-point-on-line/test.js b/packages/turf-boolean-point-on-line/test.js index 7707bc212b..6a585694e8 100644 --- a/packages/turf-boolean-point-on-line/test.js +++ b/packages/turf-boolean-point-on-line/test.js @@ -2,7 +2,7 @@ const glob = require('glob'); const path = require('path'); const test = require('tape'); const load = require('load-json-file'); -const pointOnLine = require('./').default; +const pointOnLine = require('./dist/js/index.js').default; test('turf-boolean-point-on-line', t => { // True Fixtures diff --git a/packages/turf-boolean-point-on-line/tsconfig.json b/packages/turf-boolean-point-on-line/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-boolean-point-on-line/tsconfig.json +++ b/packages/turf-boolean-point-on-line/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-boolean-touches/.gitignore b/packages/turf-boolean-touches/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-boolean-touches/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-boolean-touches/bench.js b/packages/turf-boolean-touches/bench.js index 39b7861db3..de828af6f7 100644 --- a/packages/turf-boolean-touches/bench.js +++ b/packages/turf-boolean-touches/bench.js @@ -2,7 +2,7 @@ const path = require('path'); const glob = require('glob'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const touches = require('./').default; +const touches = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-boolean-touches/package.json b/packages/turf-boolean-touches/package.json index 8c4188b154..9239a70f65 100644 --- a/packages/turf-boolean-touches/package.json +++ b/packages/turf-boolean-touches/package.json @@ -2,18 +2,20 @@ "name": "@turf/boolean-touches", "version": "6.0.1", "description": "turf boolean-touches module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-boolean-touches/test.js b/packages/turf-boolean-touches/test.js index be73720f69..9361f99941 100644 --- a/packages/turf-boolean-touches/test.js +++ b/packages/turf-boolean-touches/test.js @@ -4,7 +4,7 @@ const test = require('tape'); const load = require('load-json-file'); const shapely = require('boolean-shapely'); const booleanJSTS = require('boolean-jsts'); -const touches = require('./').default; +const touches = require('./dist/js/index.js').default; test('turf-boolean-touches', t => { // True Fixtures diff --git a/packages/turf-boolean-touches/tsconfig.json b/packages/turf-boolean-touches/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-boolean-touches/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-boolean-touches/types.ts b/packages/turf-boolean-touches/types.ts index 66fa830281..08b601ee9b 100644 --- a/packages/turf-boolean-touches/types.ts +++ b/packages/turf-boolean-touches/types.ts @@ -1,5 +1,5 @@ import * as helpers from '@turf/helpers' -import booleanWithin from './' +import booleanWithin from './dist/js/index' const pt = helpers.point([0, 0]) const line = helpers.lineString([[0, 0], [10, 10]]) diff --git a/packages/turf-boolean-valid/.gitignore b/packages/turf-boolean-valid/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-boolean-valid/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-boolean-valid/bench.js b/packages/turf-boolean-valid/bench.js index 7fc543290a..d8a6eb7e9b 100644 --- a/packages/turf-boolean-valid/bench.js +++ b/packages/turf-boolean-valid/bench.js @@ -3,7 +3,7 @@ import glob from 'glob'; import Benchmark from 'benchmark'; import load from 'load-json-file'; import bbox from '@turf/bbox'; -import contains from './'; +import contains from './dist/js/index.js'; /** * Benchmark Results diff --git a/packages/turf-boolean-valid/package.json b/packages/turf-boolean-valid/package.json index 754c0ae6df..d4e37233dd 100644 --- a/packages/turf-boolean-valid/package.json +++ b/packages/turf-boolean-valid/package.json @@ -2,18 +2,19 @@ "name": "@turf/boolean-valid", "version": "6.0.1", "description": "turf boolean-valid module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist/js/index.js", + "dist/js/index.d.ts" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-boolean-valid/test.js b/packages/turf-boolean-valid/test.js index 620c564cb0..ab672a694d 100644 --- a/packages/turf-boolean-valid/test.js +++ b/packages/turf-boolean-valid/test.js @@ -3,7 +3,7 @@ const path = require('path'); const test = require('tape'); const load = require('load-json-file'); // const shapely = require('boolean-shapely'); -const isValid = require('./').default; +const isValid = require('./dist/js/index.js').default; test('turf-boolean-valid', t => { // True Fixtures diff --git a/packages/turf-boolean-valid/tsconfig.json b/packages/turf-boolean-valid/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-boolean-valid/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-boolean-within/.gitignore b/packages/turf-boolean-within/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-boolean-within/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-boolean-within/bench.js b/packages/turf-boolean-within/bench.js index 713a075e6b..edf8aa3a06 100644 --- a/packages/turf-boolean-within/bench.js +++ b/packages/turf-boolean-within/bench.js @@ -2,7 +2,7 @@ const path = require('path'); const glob = require('glob'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const within = require('./').default; +const within = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-boolean-within/package.json b/packages/turf-boolean-within/package.json index 8a6ba6e93d..dce34906e8 100644 --- a/packages/turf-boolean-within/package.json +++ b/packages/turf-boolean-within/package.json @@ -2,18 +2,20 @@ "name": "@turf/boolean-within", "version": "6.0.1", "description": "turf boolean-within module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-boolean-within/test.js b/packages/turf-boolean-within/test.js index ef42ca9238..0a572978cd 100644 --- a/packages/turf-boolean-within/test.js +++ b/packages/turf-boolean-within/test.js @@ -4,7 +4,7 @@ const test = require('tape'); const load = require('load-json-file'); const shapely = require('boolean-shapely'); const booleanJSTS = require('boolean-jsts'); -const within = require('./').default; +const within = require('./dist/js/index.js').default; test('turf-boolean-within', t => { // True Fixtures diff --git a/packages/turf-boolean-within/tsconfig.json b/packages/turf-boolean-within/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-boolean-within/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-boolean-within/types.ts b/packages/turf-boolean-within/types.ts index 66fa830281..08b601ee9b 100644 --- a/packages/turf-boolean-within/types.ts +++ b/packages/turf-boolean-within/types.ts @@ -1,5 +1,5 @@ import * as helpers from '@turf/helpers' -import booleanWithin from './' +import booleanWithin from './dist/js/index' const pt = helpers.point([0, 0]) const line = helpers.lineString([[0, 0], [10, 10]]) diff --git a/packages/turf-buffer/package.json b/packages/turf-buffer/package.json index 2670002dbe..46df5f438e 100644 --- a/packages/turf-buffer/package.json +++ b/packages/turf-buffer/package.json @@ -13,7 +13,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-center-mean/.gitignore b/packages/turf-center-mean/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-center-mean/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-center-mean/bench.js b/packages/turf-center-mean/bench.js index 2574757510..bb104d3dd6 100644 --- a/packages/turf-center-mean/bench.js +++ b/packages/turf-center-mean/bench.js @@ -2,7 +2,7 @@ const path = require('path'); const glob = require('glob'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const centerMean = require('./').default; +const centerMean = require('./dist/js/index.js').default; const fixtures = glob.sync(path.join(__dirname, 'test', 'in', '*.geojson')).map(input => { return { diff --git a/packages/turf-center-mean/package.json b/packages/turf-center-mean/package.json index 43eddcc28c..c61cd02d05 100644 --- a/packages/turf-center-mean/package.json +++ b/packages/turf-center-mean/package.json @@ -2,18 +2,20 @@ "name": "@turf/center-mean", "version": "6.0.1", "description": "turf center-mean module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-center-mean/test.js b/packages/turf-center-mean/test.js index f60e744317..9ac7edd795 100644 --- a/packages/turf-center-mean/test.js +++ b/packages/turf-center-mean/test.js @@ -7,7 +7,7 @@ const truncate = require('@turf/truncate').default; const { featureEach, coordEach } = require('@turf/meta'); const { lineString, featureCollection } = require('@turf/helpers'); const center = require('@turf/center').default; -const centerMean = require('./').default; +const centerMean = require('./dist/js/index.js').default; test('turf-center-mean', t => { glob.sync(path.join(__dirname, 'test', 'in', '*.geojson')).forEach(filepath => { diff --git a/packages/turf-center-mean/tsconfig.json b/packages/turf-center-mean/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-center-mean/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-center-mean/types.ts b/packages/turf-center-mean/types.ts index f5bfd8166d..9ddba18fd1 100644 --- a/packages/turf-center-mean/types.ts +++ b/packages/turf-center-mean/types.ts @@ -1,5 +1,5 @@ import {lineString} from '@turf/helpers' -import centerMean from './' +import centerMean from './dist/js/index' const line = lineString([[0, 0], [10, 10]]); diff --git a/packages/turf-center-median/.gitignore b/packages/turf-center-median/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-center-median/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-center-median/bench.js b/packages/turf-center-median/bench.js index 879a983131..672f32ffab 100644 --- a/packages/turf-center-median/bench.js +++ b/packages/turf-center-median/bench.js @@ -1,6 +1,6 @@ const Benchmark = require('benchmark'); const { randomPoint } = require('@turf/random'); -const centerMedian = require('.').default; +const centerMedian = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-center-median/package.json b/packages/turf-center-median/package.json index d1a1cf345c..ddc6e73e91 100644 --- a/packages/turf-center-median/package.json +++ b/packages/turf-center-median/package.json @@ -2,18 +2,18 @@ "name": "@turf/center-median", "version": "6.0.1", "description": "turf center-median module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-center-median/test.js b/packages/turf-center-median/test.js index 33e6c7141f..ccd36a53ed 100644 --- a/packages/turf-center-median/test.js +++ b/packages/turf-center-median/test.js @@ -8,7 +8,7 @@ const truncate = require('@turf/truncate').default; const centerMean = require('@turf/center-mean').default; const centerOfMass = require('@turf/center-of-mass').default; const { featureCollection, round } = require('@turf/helpers'); -const centerMedian = require('./').default; +const centerMedian = require('./dist/js/index.js').default; test('turf-center-median', t => { glob.sync(path.join(__dirname, 'test', 'in', '*.json')).forEach(filepath => { diff --git a/packages/turf-center-median/tsconfig.json b/packages/turf-center-median/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-center-median/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-center-of-mass/.gitignore b/packages/turf-center-of-mass/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-center-of-mass/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-center-of-mass/bench.js b/packages/turf-center-of-mass/bench.js index ee32a51015..bea44ded2c 100644 --- a/packages/turf-center-of-mass/bench.js +++ b/packages/turf-center-of-mass/bench.js @@ -3,7 +3,7 @@ import path from 'path'; import glob from 'glob'; import load from 'load-json-file'; import Benchmark from 'benchmark'; -import centerOfMass from './'; +import centerOfMass from './dist/js/index.js'; const fixtures = glob.sync(path.join(__dirname, 'test', 'in', '*.geojson')).map(input => { return { diff --git a/packages/turf-center-of-mass/package.json b/packages/turf-center-of-mass/package.json index c3dd3083dd..5235437027 100644 --- a/packages/turf-center-of-mass/package.json +++ b/packages/turf-center-of-mass/package.json @@ -2,18 +2,20 @@ "name": "@turf/center-of-mass", "version": "6.0.1", "description": "turf center-of-mass module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-center-of-mass/test.js b/packages/turf-center-of-mass/test.js index a20d9251d9..0c522b7e4b 100644 --- a/packages/turf-center-of-mass/test.js +++ b/packages/turf-center-of-mass/test.js @@ -10,7 +10,7 @@ const { polygon, featureCollection, } = require('@turf/helpers'); -const centerOfMass = require('./').default; +const centerOfMass = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-center-of-mass/tsconfig.json b/packages/turf-center-of-mass/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-center-of-mass/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-center-of-mass/types.ts b/packages/turf-center-of-mass/types.ts index c8c4fd57fe..efdb9ad08f 100644 --- a/packages/turf-center-of-mass/types.ts +++ b/packages/turf-center-of-mass/types.ts @@ -1,5 +1,5 @@ import {lineString} from '@turf/helpers' -import centerOfMass from './' +import centerOfMass from './dist/js/index' const line = lineString([[0, 0], [10, 10]]); diff --git a/packages/turf-center/.gitignore b/packages/turf-center/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-center/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-center/bench.js b/packages/turf-center/bench.js index db55a05537..5174079adf 100644 --- a/packages/turf-center/bench.js +++ b/packages/turf-center/bench.js @@ -2,7 +2,7 @@ const path = require('path'); const glob = require('glob'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const center = require('./').default; +const center = require('./dist/js/index.js').default; const fixtures = glob.sync(path.join(__dirname, 'test', 'in', '*.geojson')).map(input => { return { diff --git a/packages/turf-center/package.json b/packages/turf-center/package.json index 12ede8c8ec..bcb93272c9 100644 --- a/packages/turf-center/package.json +++ b/packages/turf-center/package.json @@ -2,18 +2,20 @@ "name": "@turf/center", "version": "6.0.1", "description": "turf center module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-center/test.js b/packages/turf-center/test.js index 4c4ca3c409..9522fb9119 100644 --- a/packages/turf-center/test.js +++ b/packages/turf-center/test.js @@ -8,7 +8,7 @@ const bboxPolygon = require('@turf/bbox-polygon').default; const bbox = require('@turf/bbox').default; const { featureEach, coordEach } = require('@turf/meta'); const { lineString, featureCollection } = require('@turf/helpers'); -const center = require('./').default; +const center = require('./dist/js/index.js').default; test('turf-center', t => { glob.sync(path.join(__dirname, 'test', 'in', '*.geojson')).forEach(filepath => { diff --git a/packages/turf-center/tsconfig.json b/packages/turf-center/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-center/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-center/types.ts b/packages/turf-center/types.ts index e376031d09..bcc2212c38 100644 --- a/packages/turf-center/types.ts +++ b/packages/turf-center/types.ts @@ -1,5 +1,5 @@ import {lineString} from '@turf/helpers' -import center from './' +import center from './dist/js/index' const line = lineString([[0, 0], [10, 10]]); diff --git a/packages/turf-centroid/.gitignore b/packages/turf-centroid/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-centroid/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-centroid/bench.js b/packages/turf-centroid/bench.js index 1c6fd5c4ef..60c41ad576 100644 --- a/packages/turf-centroid/bench.js +++ b/packages/turf-centroid/bench.js @@ -2,7 +2,7 @@ const path = require('path'); const glob = require('glob'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const centroid = require('./').default; +const centroid = require('./dist/js/index.js').default; const fixtures = glob.sync(path.join(__dirname, 'test', 'in', '*.geojson')).map(input => { return { diff --git a/packages/turf-centroid/package.json b/packages/turf-centroid/package.json index 84c0fb75bd..1ec6b07c81 100644 --- a/packages/turf-centroid/package.json +++ b/packages/turf-centroid/package.json @@ -2,18 +2,20 @@ "name": "@turf/centroid", "version": "6.0.2", "description": "turf centroid module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-centroid/test.js b/packages/turf-centroid/test.js index ac1a481fd7..82adae4a03 100644 --- a/packages/turf-centroid/test.js +++ b/packages/turf-centroid/test.js @@ -5,7 +5,7 @@ const load = require('load-json-file'); const write = require('write-json-file'); const { featureEach } = require('@turf/meta'); const { featureCollection, lineString } = require('@turf/helpers'); -const centroid = require('.').default; +const centroid = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-centroid/tsconfig.json b/packages/turf-centroid/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-centroid/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-centroid/types.ts b/packages/turf-centroid/types.ts index 5a661b59fa..29486fc52b 100644 --- a/packages/turf-centroid/types.ts +++ b/packages/turf-centroid/types.ts @@ -1,5 +1,5 @@ import {lineString} from '@turf/helpers' -import centroid from './' +import centroid from './dist/js/index' const line = lineString([[0, 0], [10, 10]]); diff --git a/packages/turf-circle/.gitignore b/packages/turf-circle/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-circle/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-circle/bench.js b/packages/turf-circle/bench.js index eaa9314897..d8a3a030a3 100644 --- a/packages/turf-circle/bench.js +++ b/packages/turf-circle/bench.js @@ -1,5 +1,5 @@ const Benchmark = require('benchmark'); -const circle = require('./').default; +const circle = require('./dist/js/index.js').default; const center = [-75.0, 39.0]; const radius = 5; diff --git a/packages/turf-circle/package.json b/packages/turf-circle/package.json index ac7e612223..47106c02e1 100644 --- a/packages/turf-circle/package.json +++ b/packages/turf-circle/package.json @@ -2,18 +2,20 @@ "name": "@turf/circle", "version": "6.0.1", "description": "turf circle module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-circle/test.js b/packages/turf-circle/test.js index 986857a445..40448dea4b 100644 --- a/packages/turf-circle/test.js +++ b/packages/turf-circle/test.js @@ -6,7 +6,7 @@ const write = require('write-json-file'); const truncate = require('@turf/truncate').default; const { featureCollection } = require('@turf/helpers'); const geojsonhint = require('@mapbox/geojsonhint'); -const circle = require('./').default; +const circle = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-circle/tsconfig.json b/packages/turf-circle/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-circle/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-circle/types.ts b/packages/turf-circle/types.ts index 14ddd92e43..962ed54f11 100644 --- a/packages/turf-circle/types.ts +++ b/packages/turf-circle/types.ts @@ -1,5 +1,5 @@ import { point } from '@turf/helpers' -import circle from '.' +import circle from './dist/js/index' const center = point([-75.343, 39.984]); const units = 'kilometers'; diff --git a/packages/turf-clean-coords/.gitignore b/packages/turf-clean-coords/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-clean-coords/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-clean-coords/bench.js b/packages/turf-clean-coords/bench.js index fd9685062d..8d293d06ca 100644 --- a/packages/turf-clean-coords/bench.js +++ b/packages/turf-clean-coords/bench.js @@ -2,7 +2,7 @@ const path = require('path'); const glob = require('glob'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const cleanCoords = require('./').default; +const cleanCoords = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-clean-coords/index.d.ts b/packages/turf-clean-coords/index.d.ts deleted file mode 100644 index 035a646499..0000000000 --- a/packages/turf-clean-coords/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Geometry, Feature } from "@turf/helpers"; - -/** - * Removes redundant coordinates from any GeoJSON Geometry. - * - * @name cleanCoords - * @param {Geometry|Feature} geojson Feature or Geometry - * @param {Object} [options={}] Optional parameters - * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated - * @returns {Geometry|Feature} the cleaned input Feature/Geometry - * @example - * var line = turf.lineString([[0, 0], [0, 2], [0, 5], [0, 8], [0, 8], [0, 10]]); - * var multiPoint = turf.multiPoint([[0, 0], [0, 0], [2, 2]]); - * - * turf.cleanCoords(line).geometry.coordinates; - * //= [[0, 0], [0, 10]] - * - * turf.cleanCoords(multiPoint).geometry.coordinates; - * //= [[0, 0], [2, 2]] - */ -export default function cleanCoords( - geojson: T, - options?: { - mutate?: boolean - } -): T; diff --git a/packages/turf-clean-coords/package.json b/packages/turf-clean-coords/package.json index bfdc0c2891..a63b604031 100644 --- a/packages/turf-clean-coords/package.json +++ b/packages/turf-clean-coords/package.json @@ -2,18 +2,20 @@ "name": "@turf/clean-coords", "version": "6.0.1", "description": "turf clean-coords module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-clean-coords/test.js b/packages/turf-clean-coords/test.js index 57a076f160..67c84089db 100644 --- a/packages/turf-clean-coords/test.js +++ b/packages/turf-clean-coords/test.js @@ -11,7 +11,7 @@ const { polygon, } = require('@turf/helpers'); const write = require('write-json-file'); -const cleanCoords = require('./').default; +const cleanCoords = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-clean-coords/tsconfig.json b/packages/turf-clean-coords/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-clean-coords/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-clean-coords/types.ts b/packages/turf-clean-coords/types.ts index 90a7cc650a..d1eb441945 100644 --- a/packages/turf-clean-coords/types.ts +++ b/packages/turf-clean-coords/types.ts @@ -1,5 +1,5 @@ import {multiPoint} from '@turf/helpers' -import cleanCoords from './' +import cleanCoords from './dist/js/index' // Fixtures const multiPt = multiPoint([[0, 0], [0, 0], [2, 2]]) diff --git a/packages/turf-clone/.gitignore b/packages/turf-clone/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-clone/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-clone/bench.js b/packages/turf-clone/bench.js index 575825ef56..b2eedc471d 100644 --- a/packages/turf-clone/bench.js +++ b/packages/turf-clone/bench.js @@ -1,6 +1,6 @@ const Benchmark = require('benchmark'); const { point, lineString, polygon, featureCollection } = require('@turf/helpers'); -const clone = require('./').default; +const clone = require('./dist/js/index.js').default; const fixtures = [ point([0, 20]), diff --git a/packages/turf-clone/index.d.ts b/packages/turf-clone/index.d.ts deleted file mode 100644 index af04f267f0..0000000000 --- a/packages/turf-clone/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { AllGeoJSON } from "@turf/helpers"; -/** - * Returns a cloned copy of the passed GeoJSON Object, including possible 'Foreign Members'. - * ~3-5x faster than the common JSON.parse + JSON.stringify combo method. - * - * @name clone - * @param {GeoJSON} geojson GeoJSON Object - * @returns {GeoJSON} cloned GeoJSON Object - * @example - * var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]], {color: 'red'}); - * - * var lineCloned = turf.clone(line); - */ -declare function clone(geojson: AllGeoJSON): any; -export default clone; diff --git a/packages/turf-clone/package.json b/packages/turf-clone/package.json index ab0cefaf20..f9e737b14c 100644 --- a/packages/turf-clone/package.json +++ b/packages/turf-clone/package.json @@ -2,18 +2,20 @@ "name": "@turf/clone", "version": "6.0.2", "description": "turf clone module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-clone/test.js b/packages/turf-clone/test.js index 84d2fefebc..1e0fc08185 100644 --- a/packages/turf-clone/test.js +++ b/packages/turf-clone/test.js @@ -7,7 +7,7 @@ const { geometryCollection, } = require('@turf/helpers'); const { coordEach } = require('@turf/meta'); -const clone = require('./').default; +const clone = require('./dist/js/index.js').default; test('turf-clone', t => { diff --git a/packages/turf-clone/tsconfig.json b/packages/turf-clone/tsconfig.json index 91cffcbf55..c3f78e4c94 100644 --- a/packages/turf-clone/tsconfig.json +++ b/packages/turf-clone/tsconfig.json @@ -1,17 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - }, - "files": [ - "index.ts" - ] -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-clone/types.ts b/packages/turf-clone/types.ts index 1df9a69d09..34ac1d757e 100644 --- a/packages/turf-clone/types.ts +++ b/packages/turf-clone/types.ts @@ -1,5 +1,5 @@ import {Feature, lineString, LineString, point, Point} from "@turf/helpers"; -import clone from "./"; +import clone from "./dist/js/index"; const pt = point([0, 20]); const ptCloned: Feature = clone(pt); diff --git a/packages/turf-clusters-dbscan/.gitignore b/packages/turf-clusters-dbscan/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-clusters-dbscan/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-clusters-dbscan/bench.js b/packages/turf-clusters-dbscan/bench.js index 01c9e4c06a..84e32ad821 100644 --- a/packages/turf-clusters-dbscan/bench.js +++ b/packages/turf-clusters-dbscan/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const clustersDbscan = require('./').default; +const clustersDbscan = require('./dist/js/index.js').default; // Define Fixtures const directory = path.join(__dirname, 'test', 'in') + path.sep; diff --git a/packages/turf-clusters-dbscan/index.ts b/packages/turf-clusters-dbscan/index.ts index fe85142256..8dcc38a69d 100644 --- a/packages/turf-clusters-dbscan/index.ts +++ b/packages/turf-clusters-dbscan/index.ts @@ -3,7 +3,7 @@ import distance from '@turf/distance'; import { coordAll } from '@turf/meta'; import { convertLength, Properties, Units, FeatureCollection, Feature, Point } from '@turf/helpers'; import { collectionOf } from '@turf/invariant'; -import * as clustering from 'density-clustering'; +import clustering from 'density-clustering'; export type Dbscan = 'core' | 'edge' | 'noise' export interface DbscanProps extends Properties { diff --git a/packages/turf-clusters-dbscan/package.json b/packages/turf-clusters-dbscan/package.json index a9daf85e0c..a71e0fde5e 100644 --- a/packages/turf-clusters-dbscan/package.json +++ b/packages/turf-clusters-dbscan/package.json @@ -2,18 +2,20 @@ "name": "@turf/clusters-dbscan", "version": "6.0.1", "description": "turf clusters-dbscan module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-clusters-dbscan/test.js b/packages/turf-clusters-dbscan/test.js index 996926c210..e5c0be6d52 100644 --- a/packages/turf-clusters-dbscan/test.js +++ b/packages/turf-clusters-dbscan/test.js @@ -9,7 +9,7 @@ const concaveman = require('concaveman'); const { point, polygon, featureCollection } = require('@turf/helpers'); const { clusterReduce, clusterEach } = require('@turf/clusters'); const { coordAll, featureEach } = require('@turf/meta'); -const clustersDbscan = require('./').default; +const clustersDbscan = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-clusters-dbscan/tsconfig.json b/packages/turf-clusters-dbscan/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-clusters-dbscan/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-clusters-dbscan/types.ts b/packages/turf-clusters-dbscan/types.ts index 756ffd2ed4..6418eb6a04 100644 --- a/packages/turf-clusters-dbscan/types.ts +++ b/packages/turf-clusters-dbscan/types.ts @@ -1,5 +1,5 @@ import { featureCollection, point } from '@turf/helpers' -import clustersDbscan from './' +import clustersDbscan from './dist/js/index' // Fixtures const points = featureCollection([ diff --git a/packages/turf-clusters-kmeans/.gitignore b/packages/turf-clusters-kmeans/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-clusters-kmeans/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-clusters-kmeans/bench.js b/packages/turf-clusters-kmeans/bench.js index 20c1000499..51b991e18e 100644 --- a/packages/turf-clusters-kmeans/bench.js +++ b/packages/turf-clusters-kmeans/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const clustersKmeans = require('./').default; +const clustersKmeans = require('./dist/js/index.js').default; // Define Fixtures const directory = path.join(__dirname, 'test', 'in') + path.sep; diff --git a/packages/turf-clusters-kmeans/index.ts b/packages/turf-clusters-kmeans/index.ts index f67940a540..16e9a91836 100644 --- a/packages/turf-clusters-kmeans/index.ts +++ b/packages/turf-clusters-kmeans/index.ts @@ -1,7 +1,7 @@ import clone from '@turf/clone'; import { coordAll, featureEach } from '@turf/meta'; import { FeatureCollection, Feature, Point, Properties } from '@turf/helpers'; -import * as skmeans from 'skmeans'; +import skmeans from 'skmeans'; export interface KmeansProps extends Properties { cluster?: number; diff --git a/packages/turf-clusters-kmeans/package.json b/packages/turf-clusters-kmeans/package.json index adbadd5441..44546532ee 100644 --- a/packages/turf-clusters-kmeans/package.json +++ b/packages/turf-clusters-kmeans/package.json @@ -2,18 +2,18 @@ "name": "@turf/clusters-kmeans", "version": "6.0.1", "description": "turf clusters-kmeans module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-clusters-kmeans/test.js b/packages/turf-clusters-kmeans/test.js index 8a4d9230ba..b5d551a265 100644 --- a/packages/turf-clusters-kmeans/test.js +++ b/packages/turf-clusters-kmeans/test.js @@ -9,7 +9,7 @@ const concaveman = require('concaveman'); const { point, polygon, featureCollection } = require('@turf/helpers'); const { clusterReduce, clusterEach } = require('@turf/clusters'); const { coordAll, featureEach } = require('@turf/meta'); -const clustersKmeans = require('./').default; +const clustersKmeans = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-clusters-kmeans/tsconfig.json b/packages/turf-clusters-kmeans/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-clusters-kmeans/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-clusters/.gitignore b/packages/turf-clusters/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-clusters/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-clusters/bench.js b/packages/turf-clusters/bench.js index 4668783977..b546809ca0 100644 --- a/packages/turf-clusters/bench.js +++ b/packages/turf-clusters/bench.js @@ -8,7 +8,7 @@ const { filterProperties, applyFilter, createBins -} = require('./'); +} = require('./dist/js/index.js'); const geojson = featureCollection([ point([0, 0], {cluster: 0}), diff --git a/packages/turf-clusters/package.json b/packages/turf-clusters/package.json index 84c5aee14f..0f8170c3d2 100644 --- a/packages/turf-clusters/package.json +++ b/packages/turf-clusters/package.json @@ -2,18 +2,20 @@ "name": "@turf/clusters", "version": "6.0.1", "description": "turf clusters module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-clusters/test.js b/packages/turf-clusters/test.js index 1938ed87af..eac8720665 100644 --- a/packages/turf-clusters/test.js +++ b/packages/turf-clusters/test.js @@ -9,7 +9,7 @@ const { applyFilter, filterProperties, propertiesContainsFilter -} = require('./'); +} = require('./dist/js/index.js'); const properties = {foo: 'bar', cluster: 0}; const geojson = featureCollection([ diff --git a/packages/turf-clusters/tsconfig.json b/packages/turf-clusters/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-clusters/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-clusters/types.ts b/packages/turf-clusters/types.ts index d421b82614..de23a58227 100644 --- a/packages/turf-clusters/types.ts +++ b/packages/turf-clusters/types.ts @@ -1,6 +1,6 @@ import * as clusters from './' import { featureCollection, point, Point} from '@turf/helpers' -import { getCluster, clusterEach, clusterReduce } from './' +import { getCluster, clusterEach, clusterReduce } from './dist/js/index' /** * Fixtures diff --git a/packages/turf-collect/.gitignore b/packages/turf-collect/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-collect/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-collect/bench.js b/packages/turf-collect/bench.js index 790cbd973b..6d4da4658e 100644 --- a/packages/turf-collect/bench.js +++ b/packages/turf-collect/bench.js @@ -1,6 +1,6 @@ const Benchmark = require('benchmark'); const { polygon, featureCollection, point } = require('@turf/helpers'); -const collect = require('./').default; +const collect = require('./dist/js/index.js').default; var poly1 = polygon([[[0, 0], [10, 0], [0, 10], [0, 10], [0, 0]]]); var poly2 = polygon([[[10, 0], [20, 10], [20, 20], [20, 0], [10, 0]]]); diff --git a/packages/turf-collect/package.json b/packages/turf-collect/package.json index a48cbb860a..f1c58c28a7 100644 --- a/packages/turf-collect/package.json +++ b/packages/turf-collect/package.json @@ -2,18 +2,18 @@ "name": "@turf/collect", "version": "6.0.1", "description": "turf collect module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-collect/test.js b/packages/turf-collect/test.js index 594392ad8e..9428f8391b 100644 --- a/packages/turf-collect/test.js +++ b/packages/turf-collect/test.js @@ -1,6 +1,6 @@ const test = require('tape'); const { featureCollection, point, polygon } = require('@turf/helpers'); -const collect = require('./').default; +const collect = require('./dist/js/index.js').default; test('turf collect module', t => { const poly1 = polygon([[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]]); diff --git a/packages/turf-collect/tsconfig.json b/packages/turf-collect/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-collect/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-combine/.gitignore b/packages/turf-combine/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-combine/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-combine/bench.js b/packages/turf-combine/bench.js index 898631c7cf..90bbe598b5 100644 --- a/packages/turf-combine/bench.js +++ b/packages/turf-combine/bench.js @@ -1,7 +1,7 @@ const fs = require('fs'); const Benchmark = require('benchmark'); const { point, polygon, lineString, featureCollection } = require('@turf/helpers'); -const combine = require('./').default; +const combine = require('./dist/js/index.js').default; // MultiPoint var pt1 = point(50, 51) diff --git a/packages/turf-combine/package.json b/packages/turf-combine/package.json index ba02c37dbc..446bb3fde9 100644 --- a/packages/turf-combine/package.json +++ b/packages/turf-combine/package.json @@ -2,18 +2,18 @@ "name": "@turf/combine", "version": "6.0.1", "description": "turf combine module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-combine/test.js b/packages/turf-combine/test.js index 72b81fb4c1..327a4fea28 100644 --- a/packages/turf-combine/test.js +++ b/packages/turf-combine/test.js @@ -1,6 +1,6 @@ const test = require('tape'); const { point, multiPoint, polygon, multiPolygon, lineString, multiLineString, featureCollection, feature } = require('@turf/helpers'); -const combine = require('./').default; +const combine = require('./dist/js/index.js').default; test('combine -- points', t => { // MultiPoint diff --git a/packages/turf-combine/tsconfig.json b/packages/turf-combine/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-combine/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-concave/.gitignore b/packages/turf-concave/.gitignore deleted file mode 100644 index 10b7cd00cf..0000000000 --- a/packages/turf-concave/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -index.js -lib/turf-dissolve.js -lib/turf-line-dissolve.js -lib/turf-polygon-dissolve.js \ No newline at end of file diff --git a/packages/turf-concave/bench.js b/packages/turf-concave/bench.js index 50599c4777..b1ddba03dc 100644 --- a/packages/turf-concave/bench.js +++ b/packages/turf-concave/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const concave = require('./').default; +const concave = require('./dist/js/index.js').default; const directory = path.join(__dirname, 'test', 'in') + path.sep; const fixtures = fs.readdirSync(directory).map(filename => { diff --git a/packages/turf-concave/index.d.ts b/packages/turf-concave/index.d.ts deleted file mode 100644 index 6282217c94..0000000000 --- a/packages/turf-concave/index.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Feature, FeatureCollection, MultiPolygon, Point, Polygon, Units } from "@turf/helpers"; -/** - * Takes a set of {@link Point|points} and returns a concave hull Polygon or MultiPolygon. - * Internally, this uses [turf-tin](https://github.com/Turfjs/turf-tin) to generate geometries. - * - * @name concave - * @param {FeatureCollection} points input points - * @param {Object} [options={}] Optional parameters - * @param {number} [options.maxEdge=Infinity] the length (in 'units') of an edge necessary for part of the - * hull to become concave. - * @param {string} [options.units='kilometers'] can be degrees, radians, miles, or kilometers - * @returns {Feature<(Polygon|MultiPolygon)>|null} a concave hull (null value is returned if unable to compute hull) - * @example - * var points = turf.featureCollection([ - * turf.point([-63.601226, 44.642643]), - * turf.point([-63.591442, 44.651436]), - * turf.point([-63.580799, 44.648749]), - * turf.point([-63.573589, 44.641788]), - * turf.point([-63.587665, 44.64533]), - * turf.point([-63.595218, 44.64765]) - * ]); - * var options = {units: 'miles', maxEdge: 1}; - * - * var hull = turf.concave(points, options); - * - * //addToMap - * var addToMap = [points, hull] - */ -declare function concave(points: FeatureCollection, options?: { - maxEdge?: number; - units?: Units; -}): Feature | null; -export default concave; diff --git a/packages/turf-concave/lib/turf-dissolve.d.ts b/packages/turf-concave/lib/turf-dissolve.d.ts deleted file mode 100644 index 953acecfce..0000000000 --- a/packages/turf-concave/lib/turf-dissolve.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Feature, FeatureCollection, LineString, MultiLineString, MultiPolygon, Polygon } from "@turf/helpers"; -/** - * Transform function: attempts to dissolve geojson objects where possible - * [GeoJSON] -> GeoJSON geometry - * - * @private - * @param {FeatureCollection} geojson Features to dissolved - * @param {Object} [options={}] Optional parameters - * @param {boolean} [options.mutate=false] Prevent input mutation - * @returns {Feature} Dissolved Features - */ -declare function dissolve(geojson: FeatureCollection, options?: { - mutate?: boolean; -}): Feature | null; -export default dissolve; diff --git a/packages/turf-concave/lib/turf-line-dissolve.d.ts b/packages/turf-concave/lib/turf-line-dissolve.d.ts deleted file mode 100644 index fc5af1da9e..0000000000 --- a/packages/turf-concave/lib/turf-line-dissolve.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Feature, FeatureCollection, LineString, MultiLineString } from "@turf/helpers"; -/** - * Merges all connected (non-forking, non-junctioning) line strings into single lineStrings. - * [LineString] -> LineString|MultiLineString - * - * @param {FeatureCollection} geojson Lines to dissolve - * @param {Object} [options={}] Optional parameters - * @param {boolean} [options.mutate=false] Prevent input mutation - * @returns {Feature} Dissolved lines - */ -declare function lineDissolve(geojson: FeatureCollection, options?: { - mutate?: boolean; -}): Feature | null; -export default lineDissolve; diff --git a/packages/turf-concave/lib/turf-polygon-dissolve.d.ts b/packages/turf-concave/lib/turf-polygon-dissolve.d.ts deleted file mode 100644 index b90fcc2e62..0000000000 --- a/packages/turf-concave/lib/turf-polygon-dissolve.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Feature, FeatureCollection, MultiPolygon, Polygon } from "@turf/helpers"; -/** - * Dissolves all overlapping (Multi)Polygon - * - * @param {FeatureCollection} geojson Polygons to dissolve - * @param {Object} [options={}] Optional parameters - * @param {boolean} [options.mutate=false] Prevent input mutation - * @returns {Feature} Dissolved Polygons - */ -export default function polygonDissolve(geojson: FeatureCollection, options?: { - mutate?: boolean; -}): Feature | null; diff --git a/packages/turf-concave/package.json b/packages/turf-concave/package.json index 0abc892c3d..56a7f5a4c4 100644 --- a/packages/turf-concave/package.json +++ b/packages/turf-concave/package.json @@ -2,24 +2,18 @@ "name": "@turf/concave", "version": "6.0.5", "description": "turf concave module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts", - "lib/turf-dissolve.js", - "lib/turf-dissolve.d.ts", - "lib/turf-line-dissolve.js", - "lib/turf-line-dissolve.d.ts", - "lib/turf-polygon-dissolve.js", - "lib/turf-polygon-dissolve.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-concave/test.js b/packages/turf-concave/test.js index a46f871c40..14db38daf1 100644 --- a/packages/turf-concave/test.js +++ b/packages/turf-concave/test.js @@ -5,7 +5,7 @@ const load = require('load-json-file'); const write = require('write-json-file'); const { point, featureCollection } = require('@turf/helpers'); const { featureEach } = require('@turf/meta'); -const concave = require('./').default; +const concave = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-concave/tsconfig.json b/packages/turf-concave/tsconfig.json index 4368468818..aaf678f03b 100644 --- a/packages/turf-concave/tsconfig.json +++ b/packages/turf-concave/tsconfig.json @@ -1,20 +1,12 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - }, - "files": [ - "index.ts", - "lib/turf-dissolve.ts", - "lib/turf-line-dissolve.ts", - "lib/turf-polygon-dissolve.ts" - ] -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": [ + "index.ts", + "lib/turf-dissolve.ts", + "lib/turf-line-dissolve.ts", + "lib/turf-polygon-dissolve.ts" + ] +} diff --git a/packages/turf-convex/.gitignore b/packages/turf-convex/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-convex/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-convex/bench.js b/packages/turf-convex/bench.js index 2afc6cf077..997f1da39b 100644 --- a/packages/turf-convex/bench.js +++ b/packages/turf-convex/bench.js @@ -2,7 +2,7 @@ const glob = require('glob'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const convex = require('./').default; +const convex = require('./dist/js/index.js').default; const suite = new Benchmark.Suite('turf-convex'); diff --git a/packages/turf-convex/index.d.ts b/packages/turf-convex/index.d.ts deleted file mode 100644 index 6a5ca544bf..0000000000 --- a/packages/turf-convex/index.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { AllGeoJSON, Feature, Polygon, Properties } from "@turf/helpers"; -/** - * Takes a {@link Feature} or a {@link FeatureCollection} and returns a convex hull {@link Polygon}. - * - * Internally this uses - * the [convex-hull](https://github.com/mikolalysenko/convex-hull) module that implements a - * [monotone chain hull](http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain). - * - * @name convex - * @param {GeoJSON} geojson input Feature or FeatureCollection - * @param {Object} [options={}] Optional parameters - * @param {number} [options.concavity=Infinity] 1 - thin shape. Infinity - convex hull. - * @param {Object} [options.properties={}] Translate Properties to Feature - * @returns {Feature} a convex hull - * @example - * var points = turf.featureCollection([ - * turf.point([10.195312, 43.755225]), - * turf.point([10.404052, 43.8424511]), - * turf.point([10.579833, 43.659924]), - * turf.point([10.360107, 43.516688]), - * turf.point([10.14038, 43.588348]), - * turf.point([10.195312, 43.755225]) - * ]); - * - * var hull = turf.convex(points); - * - * //addToMap - * var addToMap = [points, hull] - */ -export default function convex

(geojson: AllGeoJSON, options?: { - concavity?: number; - properties?: P; -}): Feature | null; diff --git a/packages/turf-convex/package.json b/packages/turf-convex/package.json index b273540863..e25ba59bc8 100644 --- a/packages/turf-convex/package.json +++ b/packages/turf-convex/package.json @@ -2,18 +2,18 @@ "name": "@turf/convex", "version": "6.0.3", "description": "turf convex module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-convex/test.js b/packages/turf-convex/test.js index 5a223f7cd7..f6a1b95ab1 100644 --- a/packages/turf-convex/test.js +++ b/packages/turf-convex/test.js @@ -4,7 +4,7 @@ const path = require('path'); const write = require('write-json-file'); const load = require('load-json-file'); const { featureCollection } = require('@turf/helpers'); -const convex = require('./').default; +const convex = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-convex/tsconfig.json b/packages/turf-convex/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-convex/tsconfig.json +++ b/packages/turf-convex/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-destination/.gitignore b/packages/turf-destination/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-destination/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-destination/bench.js b/packages/turf-destination/bench.js index 85178a8166..ceb21c45b0 100644 --- a/packages/turf-destination/bench.js +++ b/packages/turf-destination/bench.js @@ -1,6 +1,6 @@ const fs = require('fs'); const Benchmark = require('benchmark'); -const destination = require('./').default; +const destination = require('./dist/js/index.js').default; var pt1 = [-75.0, 39.0] var dist = 100; diff --git a/packages/turf-destination/index.d.ts b/packages/turf-destination/index.d.ts deleted file mode 100644 index d1f422fbc8..0000000000 --- a/packages/turf-destination/index.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Coord, Feature, Point, Properties, Units } from "@turf/helpers"; -/** - * Takes a {@link Point} and calculates the location of a destination point given a distance in - * degrees, radians, miles, or kilometers; and bearing in degrees. - * This uses the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature. - * - * @name destination - * @param {Coord} origin starting point - * @param {number} distance distance from the origin point - * @param {number} bearing ranging from -180 to 180 - * @param {Object} [options={}] Optional parameters - * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians - * @param {Object} [options.properties={}] Translate properties to Point - * @returns {Feature} destination point - * @example - * var point = turf.point([-75.343, 39.984]); - * var distance = 50; - * var bearing = 90; - * var options = {units: 'miles'}; - * - * var destination = turf.destination(point, distance, bearing, options); - * - * //addToMap - * var addToMap = [point, destination] - * destination.properties['marker-color'] = '#f00'; - * point.properties['marker-color'] = '#0f0'; - */ -export default function destination

(origin: Coord, distance: number, bearing: number, options?: { - units?: Units; - properties?: P; -}): Feature; diff --git a/packages/turf-destination/package.json b/packages/turf-destination/package.json index 8e8cb61ecd..58cc4d238d 100644 --- a/packages/turf-destination/package.json +++ b/packages/turf-destination/package.json @@ -2,18 +2,18 @@ "name": "@turf/destination", "version": "6.0.1", "description": "turf destination module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-destination/test.js b/packages/turf-destination/test.js index f6a2461922..1665e4cc71 100644 --- a/packages/turf-destination/test.js +++ b/packages/turf-destination/test.js @@ -6,7 +6,7 @@ const write = require('write-json-file'); const { getCoords } = require('@turf/invariant'); const { lineString, featureCollection, round } = require('@turf/helpers'); const truncate = require('@turf/truncate').default; -const destination = require('./').default; +const destination = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-destination/tsconfig.json b/packages/turf-destination/tsconfig.json index f1852b8e46..c3f78e4c94 100644 --- a/packages/turf-destination/tsconfig.json +++ b/packages/turf-destination/tsconfig.json @@ -1,14 +1,7 @@ { + "extends": "../../tsconfig.shared.json", "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-directional-mean/.gitignore b/packages/turf-directional-mean/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-directional-mean/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-directional-mean/bench.js b/packages/turf-directional-mean/bench.js index a2407ecd6e..324390d539 100644 --- a/packages/turf-directional-mean/bench.js +++ b/packages/turf-directional-mean/bench.js @@ -1,5 +1,5 @@ const Benchmark = require('benchmark'); -const directionalMean = require('.').default; +const directionalMean = require('./dist/js/index.js').default; const glob = require('glob'); const path = require('path'); const load = require('load-json-file'); diff --git a/packages/turf-directional-mean/index.d.ts b/packages/turf-directional-mean/index.d.ts deleted file mode 100644 index 166783ba25..0000000000 --- a/packages/turf-directional-mean/index.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Feature, FeatureCollection, LineString } from "@turf/helpers"; -export interface DirectionalMeanLine extends Feature { - properties: { - cartesianAngle: number; - bearingAngle: number; - circularVariance: number; - averageX: number; - averageY: number; - averageLength: number; - countOfLines: number; - [key: string]: any; - }; -} -/** - * @typedef {Object} DirectionalMeanLine - * @property {number} cartesianAngle the mean angle of all lines. (measure from due earth counterclockwise). - * @property {number} bearingAngle the mean angle of all lines. (bearing). - * @property {number} circularVariance the extent to which features all point in the same direction. - * the value ranges 0-1, the bigger the value, the more variation in directions between lines. - * @property {number} averageX the centroid of all lines. - * @property {number} averageY the centroid of all line. - * @property {number} averageLength the average length of line. - * @property {number} countOfLines the count of features. - */ -/** - * This module calculate the average angle of a set of lines, measuring the trend of it. - * It can be used in both project coordinate system and geography coordinate system. - * It can handle segments of line or the whole line. - * @name directionalMean - * @param {FeatureCollection} lines - * @param {object} [options={}] - * @param {boolean} [options.planar=true] whether the spatial reference system is projected or geographical. - * @param {boolean} [options.segment=false] whether treat a LineString as a whole or a set of segments. - * @returns {DirectionalMeanLine} Directional Mean Line - * @example - * - * var lines = turf.lineStrings([ - * [[110, 45], [120, 50]], - * [[100, 50], [115, 55]], - * ]) - * var directionalMeanLine = turf.directionalMean(lines); - * // => directionalMeanLine - */ -export default function directionalMean(lines: FeatureCollection, options?: { - planar?: boolean; - segment?: boolean; -}): DirectionalMeanLine; diff --git a/packages/turf-directional-mean/package.json b/packages/turf-directional-mean/package.json index f191a4ff99..024bde6a8b 100644 --- a/packages/turf-directional-mean/package.json +++ b/packages/turf-directional-mean/package.json @@ -2,18 +2,18 @@ "name": "@turf/directional-mean", "version": "6.0.2", "description": "turf directional-mean module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-directional-mean/test.js b/packages/turf-directional-mean/test.js index 332581a713..7a5b012478 100644 --- a/packages/turf-directional-mean/test.js +++ b/packages/turf-directional-mean/test.js @@ -3,7 +3,7 @@ const glob = require('glob'); const path = require('path'); const load = require('load-json-file'); const write = require('write-json-file'); -const directionalMean = require('.').default; +const directionalMean = require('./dist/js/index.js').default; diff --git a/packages/turf-directional-mean/tsconfig.json b/packages/turf-directional-mean/tsconfig.json index adfc6f96e7..c3f78e4c94 100644 --- a/packages/turf-directional-mean/tsconfig.json +++ b/packages/turf-directional-mean/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - // "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-distance-weight/.gitignore b/packages/turf-distance-weight/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-distance-weight/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-distance-weight/bench.js b/packages/turf-distance-weight/bench.js index dc6e3c4c07..171f4f3296 100644 --- a/packages/turf-distance-weight/bench.js +++ b/packages/turf-distance-weight/bench.js @@ -1,5 +1,5 @@ const Benchmark = require('benchmark'); -const distanceWeight = require('.').default; +const distanceWeight = require('./dist/js/index.js').default; const glob = require('glob'); const path = require('path'); const load = require('load-json-file'); diff --git a/packages/turf-distance-weight/index.d.ts b/packages/turf-distance-weight/index.d.ts deleted file mode 100644 index 78c2673fb0..0000000000 --- a/packages/turf-distance-weight/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Feature, FeatureCollection, Point } from "@turf/helpers"; -/** - * calcualte the Minkowski p-norm distance between two features. - * @param feature1 point feature - * @param feature2 point feature - * @param p p-norm 1=, feature2: Feature, p?: number): number; -/** - * - * - * @name distanceWeight - * @param {FeatureCollection} fc FeatureCollection. - * @param {Object} [options] option object. - * @param {number} [options.threshold=10000] If the distance between neighbor and - * target features is greater than threshold, the weight of that neighbor is 0. - * @param {number} [options.p=2] Minkowski p-norm distance parameter. - * 1: Manhattan distance. 2: Euclidean distance. 1=>} distance weight matrix. - * @example - * - * var bbox = [-65, 40, -63, 42]; - * var dataset = turf.randomPoint(100, { bbox: bbox }); - * var result = turf.distanceWeight(dataset); - */ -export default function distanceWeight(fc: FeatureCollection, options?: { - threshold?: number; - p?: number; - binary?: boolean; - alpha?: number; - standardization?: boolean; -}): number[][]; diff --git a/packages/turf-distance-weight/package.json b/packages/turf-distance-weight/package.json index 4f77520caa..da2f2679fc 100644 --- a/packages/turf-distance-weight/package.json +++ b/packages/turf-distance-weight/package.json @@ -2,18 +2,18 @@ "name": "@turf/distance-weight", "version": "6.0.1", "description": "turf distance-weight module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-distance-weight/test.js b/packages/turf-distance-weight/test.js index 04f9367e29..621f58b807 100644 --- a/packages/turf-distance-weight/test.js +++ b/packages/turf-distance-weight/test.js @@ -5,8 +5,8 @@ const glob = require('glob'); const path = require('path'); const load = require('load-json-file'); const write = require('write-json-file'); -const distanceWeight = require('.').default; -const { pNormDistance } = require('.'); +const distanceWeight = require('./dist/js/index.js').default; +const { pNormDistance } = require('./dist/js/index.js'); test('pNormDistance function', t => { diff --git a/packages/turf-distance-weight/tsconfig.json b/packages/turf-distance-weight/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-distance-weight/tsconfig.json +++ b/packages/turf-distance-weight/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-distance/.gitignore b/packages/turf-distance/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-distance/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-distance/bench.js b/packages/turf-distance/bench.js index 6a19628f03..dcee415bfb 100644 --- a/packages/turf-distance/bench.js +++ b/packages/turf-distance/bench.js @@ -1,5 +1,5 @@ const Benchmark = require('benchmark'); -const distance = require('./').default; +const distance = require('./dist/js/index.js').default; var pt1 = [-75.4, 39.4]; var pt2 = [-75.534, 39.123]; diff --git a/packages/turf-distance/package.json b/packages/turf-distance/package.json index b0783af247..ccc1671da9 100644 --- a/packages/turf-distance/package.json +++ b/packages/turf-distance/package.json @@ -2,18 +2,18 @@ "name": "@turf/distance", "version": "6.0.1", "description": "turf distance module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-distance/test.js b/packages/turf-distance/test.js index 62e12b0e4f..7e27cb74a6 100644 --- a/packages/turf-distance/test.js +++ b/packages/turf-distance/test.js @@ -4,7 +4,7 @@ const test = require('tape'); const load = require('load-json-file'); const write = require('write-json-file'); const { point } = require('@turf/helpers'); -const distance = require('./').default; +const distance = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-distance/tsconfig.json b/packages/turf-distance/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-distance/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-flatten/package.json b/packages/turf-flatten/package.json index 3ad8e2a781..2fdad2efdb 100644 --- a/packages/turf-flatten/package.json +++ b/packages/turf-flatten/package.json @@ -13,7 +13,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-flip/package.json b/packages/turf-flip/package.json index 4ae09f0dec..75137f094c 100644 --- a/packages/turf-flip/package.json +++ b/packages/turf-flip/package.json @@ -13,7 +13,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-great-circle/package.json b/packages/turf-great-circle/package.json index 5acd547efd..91a7ae9c44 100644 --- a/packages/turf-great-circle/package.json +++ b/packages/turf-great-circle/package.json @@ -14,7 +14,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-helpers/.gitignore b/packages/turf-helpers/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-helpers/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-helpers/bench.js b/packages/turf-helpers/bench.js index f86dc42cfe..1544b54357 100644 --- a/packages/turf-helpers/bench.js +++ b/packages/turf-helpers/bench.js @@ -4,7 +4,7 @@ const { multiPoint, multiLineString, multiPolygon, featureCollection, geometryCollection, round -} = require('./'); +} = require('./dist/js/index.js'); /** * Benchmark Results diff --git a/packages/turf-helpers/index.d.ts b/packages/turf-helpers/index.d.ts deleted file mode 100644 index e764a0c9a4..0000000000 --- a/packages/turf-helpers/index.d.ts +++ /dev/null @@ -1,489 +0,0 @@ -import { BBox, CollectionTypes, Feature, FeatureCollection, GeoJSONObject, Geometries, Geometry, GeometryCollection, GeometryObject, GeometryTypes, Id, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, Position, Properties, Types } from "./lib/geojson"; -export { Id, Properties, BBox, Position, Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, GeometryObject, GeoJSONObject, GeometryCollection, Geometry, GeometryTypes, Types, CollectionTypes, Geometries, Feature, FeatureCollection }; -export declare type Coord = Feature | Point | Position; -export declare type Units = "meters" | "millimeters" | "centimeters" | "kilometers" | "acres" | "miles" | "nauticalmiles" | "inches" | "yards" | "feet" | "radians" | "degrees"; -export declare type Grid = "point" | "square" | "hex" | "triangle"; -export declare type Corners = "sw" | "se" | "nw" | "ne" | "center" | "centroid"; -export declare type Lines = LineString | MultiLineString | Polygon | MultiPolygon; -export declare type AllGeoJSON = Feature | FeatureCollection | Geometry | GeometryCollection; -/** - * @module helpers - */ -/** - * Earth Radius used with the Harvesine formula and approximates using a spherical (non-ellipsoid) Earth. - * - * @memberof helpers - * @type {number} - */ -export declare let earthRadius: number; -/** - * Unit of measurement factors using a spherical (non-ellipsoid) earth radius. - * - * @memberof helpers - * @type {Object} - */ -export declare let factors: { - [key: string]: number; -}; -/** - * Units of measurement factors based on 1 meter. - * - * @memberof helpers - * @type {Object} - */ -export declare let unitsFactors: { - [key: string]: number; -}; -/** - * Area of measurement factors based on 1 square meter. - * - * @memberof helpers - * @type {Object} - */ -export declare let areaFactors: any; -/** - * Wraps a GeoJSON {@link Geometry} in a GeoJSON {@link Feature}. - * - * @name feature - * @param {Geometry} geometry input geometry - * @param {Object} [properties={}] an Object of key-value pairs to add as properties - * @param {Object} [options={}] Optional Parameters - * @param {Array} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature - * @param {string|number} [options.id] Identifier associated with the Feature - * @returns {Feature} a GeoJSON Feature - * @example - * var geometry = { - * "type": "Point", - * "coordinates": [110, 50] - * }; - * - * var feature = turf.feature(geometry); - * - * //=feature - */ -export declare function feature(geom: G, properties?: P, options?: { - bbox?: BBox; - id?: Id; -}): Feature; -/** - * Creates a GeoJSON {@link Geometry} from a Geometry string type & coordinates. - * For GeometryCollection type use `helpers.geometryCollection` - * - * @name geometry - * @param {string} type Geometry Type - * @param {Array} coordinates Coordinates - * @param {Object} [options={}] Optional Parameters - * @returns {Geometry} a GeoJSON Geometry - * @example - * var type = "Point"; - * var coordinates = [110, 50]; - * var geometry = turf.geometry(type, coordinates); - * // => geometry - */ -export declare function geometry(type: "Point" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon", coordinates: any[], options?: {}): Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon; -/** - * Creates a {@link Point} {@link Feature} from a Position. - * - * @name point - * @param {Array} coordinates longitude, latitude position (each in decimal degrees) - * @param {Object} [properties={}] an Object of key-value pairs to add as properties - * @param {Object} [options={}] Optional Parameters - * @param {Array} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature - * @param {string|number} [options.id] Identifier associated with the Feature - * @returns {Feature} a Point feature - * @example - * var point = turf.point([-75.343, 39.984]); - * - * //=point - */ -export declare function point

(coordinates: Position, properties?: P, options?: { - bbox?: BBox; - id?: Id; -}): Feature; -/** - * Creates a {@link Point} {@link FeatureCollection} from an Array of Point coordinates. - * - * @name points - * @param {Array>} coordinates an array of Points - * @param {Object} [properties={}] Translate these properties to each Feature - * @param {Object} [options={}] Optional Parameters - * @param {Array} [options.bbox] Bounding Box Array [west, south, east, north] - * associated with the FeatureCollection - * @param {string|number} [options.id] Identifier associated with the FeatureCollection - * @returns {FeatureCollection} Point Feature - * @example - * var points = turf.points([ - * [-75, 39], - * [-80, 45], - * [-78, 50] - * ]); - * - * //=points - */ -export declare function points

(coordinates: Position[], properties?: P, options?: { - bbox?: BBox; - id?: Id; -}): FeatureCollection; -/** - * Creates a {@link Polygon} {@link Feature} from an Array of LinearRings. - * - * @name polygon - * @param {Array>>} coordinates an array of LinearRings - * @param {Object} [properties={}] an Object of key-value pairs to add as properties - * @param {Object} [options={}] Optional Parameters - * @param {Array} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature - * @param {string|number} [options.id] Identifier associated with the Feature - * @returns {Feature} Polygon Feature - * @example - * var polygon = turf.polygon([[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]], { name: 'poly1' }); - * - * //=polygon - */ -export declare function polygon

(coordinates: Position[][], properties?: P, options?: { - bbox?: BBox; - id?: Id; -}): Feature; -/** - * Creates a {@link Polygon} {@link FeatureCollection} from an Array of Polygon coordinates. - * - * @name polygons - * @param {Array>>>} coordinates an array of Polygon coordinates - * @param {Object} [properties={}] an Object of key-value pairs to add as properties - * @param {Object} [options={}] Optional Parameters - * @param {Array} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature - * @param {string|number} [options.id] Identifier associated with the FeatureCollection - * @returns {FeatureCollection} Polygon FeatureCollection - * @example - * var polygons = turf.polygons([ - * [[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]], - * [[[-15, 42], [-14, 46], [-12, 41], [-17, 44], [-15, 42]]], - * ]); - * - * //=polygons - */ -export declare function polygons

(coordinates: Position[][][], properties?: P, options?: { - bbox?: BBox; - id?: Id; -}): FeatureCollection; -/** - * Creates a {@link LineString} {@link Feature} from an Array of Positions. - * - * @name lineString - * @param {Array>} coordinates an array of Positions - * @param {Object} [properties={}] an Object of key-value pairs to add as properties - * @param {Object} [options={}] Optional Parameters - * @param {Array} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature - * @param {string|number} [options.id] Identifier associated with the Feature - * @returns {Feature} LineString Feature - * @example - * var linestring1 = turf.lineString([[-24, 63], [-23, 60], [-25, 65], [-20, 69]], {name: 'line 1'}); - * var linestring2 = turf.lineString([[-14, 43], [-13, 40], [-15, 45], [-10, 49]], {name: 'line 2'}); - * - * //=linestring1 - * //=linestring2 - */ -export declare function lineString

(coordinates: Position[], properties?: P, options?: { - bbox?: BBox; - id?: Id; -}): Feature; -/** - * Creates a {@link LineString} {@link FeatureCollection} from an Array of LineString coordinates. - * - * @name lineStrings - * @param {Array>>} coordinates an array of LinearRings - * @param {Object} [properties={}] an Object of key-value pairs to add as properties - * @param {Object} [options={}] Optional Parameters - * @param {Array} [options.bbox] Bounding Box Array [west, south, east, north] - * associated with the FeatureCollection - * @param {string|number} [options.id] Identifier associated with the FeatureCollection - * @returns {FeatureCollection} LineString FeatureCollection - * @example - * var linestrings = turf.lineStrings([ - * [[-24, 63], [-23, 60], [-25, 65], [-20, 69]], - * [[-14, 43], [-13, 40], [-15, 45], [-10, 49]] - * ]); - * - * //=linestrings - */ -export declare function lineStrings

(coordinates: Position[][], properties?: P, options?: { - bbox?: BBox; - id?: Id; -}): FeatureCollection; -/** - * Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}. - * - * @name featureCollection - * @param {Feature[]} features input features - * @param {Object} [options={}] Optional Parameters - * @param {Array} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature - * @param {string|number} [options.id] Identifier associated with the Feature - * @returns {FeatureCollection} FeatureCollection of Features - * @example - * var locationA = turf.point([-75.343, 39.984], {name: 'Location A'}); - * var locationB = turf.point([-75.833, 39.284], {name: 'Location B'}); - * var locationC = turf.point([-75.534, 39.123], {name: 'Location C'}); - * - * var collection = turf.featureCollection([ - * locationA, - * locationB, - * locationC - * ]); - * - * //=collection - */ -export declare function featureCollection(features: Array>, options?: { - bbox?: BBox; - id?: Id; -}): FeatureCollection; -/** - * Creates a {@link Feature} based on a - * coordinate array. Properties can be added optionally. - * - * @name multiLineString - * @param {Array>>} coordinates an array of LineStrings - * @param {Object} [properties={}] an Object of key-value pairs to add as properties - * @param {Object} [options={}] Optional Parameters - * @param {Array} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature - * @param {string|number} [options.id] Identifier associated with the Feature - * @returns {Feature} a MultiLineString feature - * @throws {Error} if no coordinates are passed - * @example - * var multiLine = turf.multiLineString([[[0,0],[10,10]]]); - * - * //=multiLine - */ -export declare function multiLineString

(coordinates: Position[][], properties?: P, options?: { - bbox?: BBox; - id?: Id; -}): Feature; -/** - * Creates a {@link Feature} based on a - * coordinate array. Properties can be added optionally. - * - * @name multiPoint - * @param {Array>} coordinates an array of Positions - * @param {Object} [properties={}] an Object of key-value pairs to add as properties - * @param {Object} [options={}] Optional Parameters - * @param {Array} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature - * @param {string|number} [options.id] Identifier associated with the Feature - * @returns {Feature} a MultiPoint feature - * @throws {Error} if no coordinates are passed - * @example - * var multiPt = turf.multiPoint([[0,0],[10,10]]); - * - * //=multiPt - */ -export declare function multiPoint

(coordinates: Position[], properties?: P, options?: { - bbox?: BBox; - id?: Id; -}): Feature; -/** - * Creates a {@link Feature} based on a - * coordinate array. Properties can be added optionally. - * - * @name multiPolygon - * @param {Array>>>} coordinates an array of Polygons - * @param {Object} [properties={}] an Object of key-value pairs to add as properties - * @param {Object} [options={}] Optional Parameters - * @param {Array} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature - * @param {string|number} [options.id] Identifier associated with the Feature - * @returns {Feature} a multipolygon feature - * @throws {Error} if no coordinates are passed - * @example - * var multiPoly = turf.multiPolygon([[[[0,0],[0,10],[10,10],[10,0],[0,0]]]]); - * - * //=multiPoly - * - */ -export declare function multiPolygon

(coordinates: Position[][][], properties?: P, options?: { - bbox?: BBox; - id?: Id; -}): Feature; -/** - * Creates a {@link Feature} based on a - * coordinate array. Properties can be added optionally. - * - * @name geometryCollection - * @param {Array} geometries an array of GeoJSON Geometries - * @param {Object} [properties={}] an Object of key-value pairs to add as properties - * @param {Object} [options={}] Optional Parameters - * @param {Array} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature - * @param {string|number} [options.id] Identifier associated with the Feature - * @returns {Feature} a GeoJSON GeometryCollection Feature - * @example - * var pt = turf.geometry("Point", [100, 0]); - * var line = turf.geometry("LineString", [[101, 0], [102, 1]]); - * var collection = turf.geometryCollection([pt, line]); - * - * // => collection - */ -export declare function geometryCollection

(geometries: Array, properties?: P, options?: { - bbox?: BBox; - id?: Id; -}): Feature; -/** - * Round number to precision - * - * @param {number} num Number - * @param {number} [precision=0] Precision - * @returns {number} rounded number - * @example - * turf.round(120.4321) - * //=120 - * - * turf.round(120.4321, 2) - * //=120.43 - */ -export declare function round(num: number, precision?: number): number; -/** - * Convert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit. - * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet - * - * @name radiansToLength - * @param {number} radians in radians across the sphere - * @param {string} [units="kilometers"] can be degrees, radians, miles, or kilometers inches, yards, metres, - * meters, kilometres, kilometers. - * @returns {number} distance - */ -export declare function radiansToLength(radians: number, units?: Units): number; -/** - * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians - * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet - * - * @name lengthToRadians - * @param {number} distance in real units - * @param {string} [units="kilometers"] can be degrees, radians, miles, or kilometers inches, yards, metres, - * meters, kilometres, kilometers. - * @returns {number} radians - */ -export declare function lengthToRadians(distance: number, units?: Units): number; -/** - * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees - * Valid units: miles, nauticalmiles, inches, yards, meters, metres, centimeters, kilometres, feet - * - * @name lengthToDegrees - * @param {number} distance in real units - * @param {string} [units="kilometers"] can be degrees, radians, miles, or kilometers inches, yards, metres, - * meters, kilometres, kilometers. - * @returns {number} degrees - */ -export declare function lengthToDegrees(distance: number, units?: Units): number; -/** - * Converts any bearing angle from the north line direction (positive clockwise) - * and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line - * - * @name bearingToAzimuth - * @param {number} bearing angle, between -180 and +180 degrees - * @returns {number} angle between 0 and 360 degrees - */ -export declare function bearingToAzimuth(bearing: number): number; -/** - * Converts an angle in radians to degrees - * - * @name radiansToDegrees - * @param {number} radians angle in radians - * @returns {number} degrees between 0 and 360 degrees - */ -export declare function radiansToDegrees(radians: number): number; -/** - * Converts an angle in degrees to radians - * - * @name degreesToRadians - * @param {number} degrees angle between 0 and 360 degrees - * @returns {number} angle in radians - */ -export declare function degreesToRadians(degrees: number): number; -/** - * Converts a length to the requested unit. - * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet - * - * @param {number} length to be converted - * @param {Units} [originalUnit="kilometers"] of the length - * @param {Units} [finalUnit="kilometers"] returned unit - * @returns {number} the converted length - */ -export declare function convertLength(length: number, originalUnit?: Units, finalUnit?: Units): number; -/** - * Converts a area to the requested unit. - * Valid units: kilometers, kilometres, meters, metres, centimetres, millimeters, acres, miles, yards, feet, inches - * @param {number} area to be converted - * @param {Units} [originalUnit="meters"] of the distance - * @param {Units} [finalUnit="kilometers"] returned unit - * @returns {number} the converted distance - */ -export declare function convertArea(area: number, originalUnit?: Units, finalUnit?: Units): number; -/** - * isNumber - * - * @param {*} num Number to validate - * @returns {boolean} true/false - * @example - * turf.isNumber(123) - * //=true - * turf.isNumber('foo') - * //=false - */ -export declare function isNumber(num: any): boolean; -/** - * isObject - * - * @param {*} input variable to validate - * @returns {boolean} true/false - * @example - * turf.isObject({elevation: 10}) - * //=true - * turf.isObject('foo') - * //=false - */ -export declare function isObject(input: any): boolean; -/** - * Validate BBox - * - * @private - * @param {Array} bbox BBox to validate - * @returns {void} - * @throws Error if BBox is not valid - * @example - * validateBBox([-180, -40, 110, 50]) - * //=OK - * validateBBox([-180, -40]) - * //=Error - * validateBBox('Foo') - * //=Error - * validateBBox(5) - * //=Error - * validateBBox(null) - * //=Error - * validateBBox(undefined) - * //=Error - */ -export declare function validateBBox(bbox: any): void; -/** - * Validate Id - * - * @private - * @param {string|number} id Id to validate - * @returns {void} - * @throws Error if Id is not valid - * @example - * validateId([-180, -40, 110, 50]) - * //=Error - * validateId([-180, -40]) - * //=Error - * validateId('Foo') - * //=OK - * validateId(5) - * //=OK - * validateId(null) - * //=Error - * validateId(undefined) - * //=Error - */ -export declare function validateId(id: any): void; -export declare function radians2degrees(): void; -export declare function degrees2radians(): void; -export declare function distanceToDegrees(): void; -export declare function distanceToRadians(): void; -export declare function radiansToDistance(): void; -export declare function bearingToAngle(): void; -export declare function convertDistance(): void; diff --git a/packages/turf-helpers/lib/geojson.d.ts b/packages/turf-helpers/lib/geojson.ts similarity index 100% rename from packages/turf-helpers/lib/geojson.d.ts rename to packages/turf-helpers/lib/geojson.ts diff --git a/packages/turf-helpers/package.json b/packages/turf-helpers/package.json index b86ca54cad..d341f40ce9 100644 --- a/packages/turf-helpers/package.json +++ b/packages/turf-helpers/package.json @@ -2,19 +2,20 @@ "name": "@turf/helpers", "version": "6.1.3", "description": "turf helpers module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts", - "lib" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-helpers/test.js b/packages/turf-helpers/test.js index 728699e8a4..3d9c7dbfed 100644 --- a/packages/turf-helpers/test.js +++ b/packages/turf-helpers/test.js @@ -6,8 +6,8 @@ const { radiansToLength, lengthToRadians, lengthToDegrees, radiansToDegrees, degreesToRadians, bearingToAzimuth, convertLength, convertArea, round, isObject, isNumber, earthRadius -} = require('./'); -const turf = require('./'); +} = require('./dist/js/index.js'); +const turf = require('./dist/js/index.js'); test('point', t => { const ptArray = point([5, 10], {name: 'test point'}); diff --git a/packages/turf-helpers/tsconfig.json b/packages/turf-helpers/tsconfig.json index b3d69bef60..1100f70e6c 100644 --- a/packages/turf-helpers/tsconfig.json +++ b/packages/turf-helpers/tsconfig.json @@ -1,17 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - }, - "files": [ - "index.ts" - ] -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts", "lib/geojson.ts"] +} diff --git a/packages/turf-helpers/types.ts b/packages/turf-helpers/types.ts index 8249de993f..816d89bb92 100644 --- a/packages/turf-helpers/types.ts +++ b/packages/turf-helpers/types.ts @@ -1,4 +1,4 @@ -import * as helpers from "./"; +import * as helpers from "./dist/js/index"; import { BBox, bearingToAzimuth, diff --git a/packages/turf-hex-grid/.gitignore b/packages/turf-hex-grid/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-hex-grid/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-hex-grid/bench.js b/packages/turf-hex-grid/bench.js index c7cf0f39dd..50ccf1fcc0 100644 --- a/packages/turf-hex-grid/bench.js +++ b/packages/turf-hex-grid/bench.js @@ -1,5 +1,5 @@ const Benchmark = require('benchmark'); -const grid = require('./').default; +const grid = require('./dist/js/index.js').default; var bbox = [ -96.6357421875, diff --git a/packages/turf-hex-grid/package.json b/packages/turf-hex-grid/package.json index fbf9cc6c92..0a6c1228d8 100644 --- a/packages/turf-hex-grid/package.json +++ b/packages/turf-hex-grid/package.json @@ -2,18 +2,20 @@ "name": "@turf/hex-grid", "version": "6.0.2", "description": "turf hex-grid module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-hex-grid/test.js b/packages/turf-hex-grid/test.js index 02da71b6f1..b405d580a2 100644 --- a/packages/turf-hex-grid/test.js +++ b/packages/turf-hex-grid/test.js @@ -5,7 +5,7 @@ const load = require('load-json-file'); const write = require('write-json-file'); const truncate = require('@turf/truncate').default; const bboxPoly = require('@turf/bbox-polygon').default; -const hexGrid = require('./').default; +const hexGrid = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-hex-grid/tsconfig.json b/packages/turf-hex-grid/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-hex-grid/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-hex-grid/types.ts b/packages/turf-hex-grid/types.ts index 6e5d7521d4..487632140e 100644 --- a/packages/turf-hex-grid/types.ts +++ b/packages/turf-hex-grid/types.ts @@ -1,5 +1,5 @@ import {BBox} from '@turf/helpers' -import hexGrid from './' +import hexGrid from './dist/js/index' const bbox: BBox = [ -96.6357421875, diff --git a/packages/turf-interpolate/package.json b/packages/turf-interpolate/package.json index 874d59535b..c08bb12822 100644 --- a/packages/turf-interpolate/package.json +++ b/packages/turf-interpolate/package.json @@ -13,7 +13,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-intersect/.gitignore b/packages/turf-intersect/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-intersect/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-intersect/bench.js b/packages/turf-intersect/bench.js index 00c4381939..25d190af5b 100644 --- a/packages/turf-intersect/bench.js +++ b/packages/turf-intersect/bench.js @@ -1,7 +1,7 @@ const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const intersect = require('./').default; +const intersect = require('./dist/js/index.js').default; // Fixtures const armenia = load.sync(path.join(__dirname, 'test', 'in', 'armenia.geojson')); diff --git a/packages/turf-intersect/index.d.ts b/packages/turf-intersect/index.d.ts deleted file mode 100644 index 6c4788ef3f..0000000000 --- a/packages/turf-intersect/index.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Feature, MultiPolygon, Polygon, Properties } from "@turf/helpers"; -/** - * Takes two {@link Polygon|polygon} or {@link MultiPolygon|multi-polygon} geometries and - * finds their polygonal intersection. If they don't intersect, returns null. - * - * @name intersect - * @param {Feature} poly1 the first polygon or multipolygon - * @param {Feature} poly2 the second polygon or multipolygon - * @param {Object} [options={}] Optional Parameters - * @param {Object} [options.properties={}] Translate GeoJSON Properties to Feature - * @returns {Feature|null} returns a feature representing the area they share (either a {@link Polygon} or - * {@link MultiPolygon}). If they do not share any area, returns `null`. - * @example - * var poly1 = turf.polygon([[ - * [-122.801742, 45.48565], - * [-122.801742, 45.60491], - * [-122.584762, 45.60491], - * [-122.584762, 45.48565], - * [-122.801742, 45.48565] - * ]]); - * - * var poly2 = turf.polygon([[ - * [-122.520217, 45.535693], - * [-122.64038, 45.553967], - * [-122.720031, 45.526554], - * [-122.669906, 45.507309], - * [-122.723464, 45.446643], - * [-122.532577, 45.408574], - * [-122.487258, 45.477466], - * [-122.520217, 45.535693] - * ]]); - * - * var intersection = turf.intersect(poly1, poly2); - * - * //addToMap - * var addToMap = [poly1, poly2, intersection]; - */ -export default function intersect

(poly1: Feature | Polygon | MultiPolygon, poly2: Feature | Polygon | MultiPolygon, options?: { - properties?: P; -}): Feature | null; diff --git a/packages/turf-intersect/package.json b/packages/turf-intersect/package.json index 383d9aaf2c..1428fdd6d7 100644 --- a/packages/turf-intersect/package.json +++ b/packages/turf-intersect/package.json @@ -2,18 +2,20 @@ "name": "@turf/intersect", "version": "6.1.2", "description": "turf intersect module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-intersect/test.js b/packages/turf-intersect/test.js index 1b8a623fe5..d6b9c9454a 100644 --- a/packages/turf-intersect/test.js +++ b/packages/turf-intersect/test.js @@ -4,7 +4,7 @@ const test = require('tape'); const load = require('load-json-file'); const write = require('write-json-file'); const { featureCollection } = require('@turf/helpers'); -const intersect = require('./').default; +const intersect = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-intersect/tsconfig.json b/packages/turf-intersect/tsconfig.json index 91cffcbf55..c3f78e4c94 100644 --- a/packages/turf-intersect/tsconfig.json +++ b/packages/turf-intersect/tsconfig.json @@ -1,17 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - }, - "files": [ - "index.ts" - ] -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-intersect/types.ts b/packages/turf-intersect/types.ts index ea7b9d6432..7eee543192 100644 --- a/packages/turf-intersect/types.ts +++ b/packages/turf-intersect/types.ts @@ -1,5 +1,5 @@ import { polygon } from '@turf/helpers' -import intersect from './' +import intersect from './dist/js/index' const poly1 = polygon([[[0, 0], [1, 1], [3, 0], [0, 0]]]) const poly2 = polygon([[[10, 10], [21, 21], [0, 4], [10, 10]]]) diff --git a/packages/turf-invariant/.gitignore b/packages/turf-invariant/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-invariant/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-invariant/bench.js b/packages/turf-invariant/bench.js index 834a124ad9..e80bd134c2 100644 --- a/packages/turf-invariant/bench.js +++ b/packages/turf-invariant/bench.js @@ -1,6 +1,6 @@ const Benchmark = require('benchmark'); const helpers = require('@turf/helpers'); -const invariant = require('./'); +const invariant = require('./dist/js/index.js'); const pt = helpers.point([-75, 40]); const line = helpers.lineString([[-75, 40], [-70, 50]]); diff --git a/packages/turf-invariant/index.d.ts b/packages/turf-invariant/index.d.ts deleted file mode 100644 index 74eaab8365..0000000000 --- a/packages/turf-invariant/index.d.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { Feature, FeatureCollection, Geometries, GeometryCollection, Point } from "@turf/helpers"; -/** - * Unwrap a coordinate from a Point Feature, Geometry or a single coordinate. - * - * @name getCoord - * @param {Array|Geometry|Feature} coord GeoJSON Point or an Array of numbers - * @returns {Array} coordinates - * @example - * var pt = turf.point([10, 10]); - * - * var coord = turf.getCoord(pt); - * //= [10, 10] - */ -export declare function getCoord(coord: Feature | Point | number[]): number[]; -/** - * Unwrap coordinates from a Feature, Geometry Object or an Array - * - * @name getCoords - * @param {Array|Geometry|Feature} coords Feature, Geometry Object or an Array - * @returns {Array} coordinates - * @example - * var poly = turf.polygon([[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]); - * - * var coords = turf.getCoords(poly); - * //= [[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]] - */ -export declare function getCoords(coords: any[] | Feature | G): any[]; -/** - * Checks if coordinates contains a number - * - * @name containsNumber - * @param {Array} coordinates GeoJSON Coordinates - * @returns {boolean} true if Array contains a number - */ -export declare function containsNumber(coordinates: any[]): boolean; -/** - * Enforce expectations about types of GeoJSON objects for Turf. - * - * @name geojsonType - * @param {GeoJSON} value any GeoJSON object - * @param {string} type expected GeoJSON type - * @param {string} name name of calling function - * @throws {Error} if value is not the expected type. - */ -export declare function geojsonType(value: any, type: string, name: string): void; -/** - * Enforce expectations about types of {@link Feature} inputs for Turf. - * Internally this uses {@link geojsonType} to judge geometry types. - * - * @name featureOf - * @param {Feature} feature a feature with an expected geometry type - * @param {string} type expected GeoJSON type - * @param {string} name name of calling function - * @throws {Error} error if value is not the expected type. - */ -export declare function featureOf(feature: Feature, type: string, name: string): void; -/** - * Enforce expectations about types of {@link FeatureCollection} inputs for Turf. - * Internally this uses {@link geojsonType} to judge geometry types. - * - * @name collectionOf - * @param {FeatureCollection} featureCollection a FeatureCollection for which features will be judged - * @param {string} type expected GeoJSON type - * @param {string} name name of calling function - * @throws {Error} if value is not the expected type. - */ -export declare function collectionOf(featureCollection: FeatureCollection, type: string, name: string): void; -/** - * Get Geometry from Feature or Geometry Object - * - * @param {Feature|Geometry} geojson GeoJSON Feature or Geometry Object - * @returns {Geometry|null} GeoJSON Geometry Object - * @throws {Error} if geojson is not a Feature or Geometry Object - * @example - * var point = { - * "type": "Feature", - * "properties": {}, - * "geometry": { - * "type": "Point", - * "coordinates": [110, 40] - * } - * } - * var geom = turf.getGeom(point) - * //={"type": "Point", "coordinates": [110, 40]} - */ -export declare function getGeom(geojson: Feature | G): G; -/** - * Get GeoJSON object's type, Geometry type is prioritize. - * - * @param {GeoJSON} geojson GeoJSON object - * @param {string} [name="geojson"] name of the variable to display in error message - * @returns {string} GeoJSON type - * @example - * var point = { - * "type": "Feature", - * "properties": {}, - * "geometry": { - * "type": "Point", - * "coordinates": [110, 40] - * } - * } - * var geom = turf.getType(point) - * //="Point" - */ -export declare function getType(geojson: Feature | FeatureCollection | Geometries | GeometryCollection, name?: string): string; diff --git a/packages/turf-invariant/package.json b/packages/turf-invariant/package.json index cb860e5c11..32a25ca27a 100644 --- a/packages/turf-invariant/package.json +++ b/packages/turf-invariant/package.json @@ -2,18 +2,20 @@ "name": "@turf/invariant", "version": "6.1.2", "description": "turf invariant module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-invariant/test.js b/packages/turf-invariant/test.js index 31ce7ff0b2..c428a1e167 100644 --- a/packages/turf-invariant/test.js +++ b/packages/turf-invariant/test.js @@ -4,7 +4,7 @@ const { feature, featureCollection, geometryCollection, multiLineString, lineStrings } = require('@turf/helpers'); -const invariant = require('.'); +const invariant = require('./dist/js/index.js'); test('invariant -- containsNumber', t => { t.equals(invariant.containsNumber([1, 1]), true); diff --git a/packages/turf-invariant/tsconfig.json b/packages/turf-invariant/tsconfig.json index 91cffcbf55..c3f78e4c94 100644 --- a/packages/turf-invariant/tsconfig.json +++ b/packages/turf-invariant/tsconfig.json @@ -1,17 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - }, - "files": [ - "index.ts" - ] -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-invariant/types.ts b/packages/turf-invariant/types.ts index f7d1e6c561..b99d271de8 100644 --- a/packages/turf-invariant/types.ts +++ b/packages/turf-invariant/types.ts @@ -9,7 +9,7 @@ import { Position, Types, } from "@turf/helpers"; -import * as invariant from "./"; +import * as invariant from "./dist/js/index"; /** * Fixtures diff --git a/packages/turf-isolines/package.json b/packages/turf-isolines/package.json index 3e7c49e4be..ff4f096432 100644 --- a/packages/turf-isolines/package.json +++ b/packages/turf-isolines/package.json @@ -14,7 +14,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" }, diff --git a/packages/turf-kinks/.gitignore b/packages/turf-kinks/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-kinks/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-kinks/bench.js b/packages/turf-kinks/bench.js index e10f16c577..fb031c608e 100644 --- a/packages/turf-kinks/bench.js +++ b/packages/turf-kinks/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const kinks = require('./').default; +const kinks = require('./dist/js/index.js').default; const suite = new Benchmark.Suite('turf-kinks'); diff --git a/packages/turf-kinks/index.d.ts b/packages/turf-kinks/index.d.ts deleted file mode 100644 index f9dfe266f0..0000000000 --- a/packages/turf-kinks/index.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Feature, FeatureCollection, LineString, MultiLineString, MultiPolygon, Point, Polygon } from "@turf/helpers"; -/** - * Takes a {@link LineString|linestring}, {@link MultiLineString|multi-linestring}, - * {@link MultiPolygon|multi-polygon} or {@link Polygon|polygon} and - * returns {@link Point|points} at all self-intersections. - * - * @name kinks - * @param {Feature} featureIn input feature - * @returns {FeatureCollection} self-intersections - * @example - * var poly = turf.polygon([[ - * [-12.034835, 8.901183], - * [-12.060413, 8.899826], - * [-12.03638, 8.873199], - * [-12.059383, 8.871418], - * [-12.034835, 8.901183] - * ]]); - * - * var kinks = turf.kinks(poly); - * - * //addToMap - * var addToMap = [poly, kinks] - */ -export default function kinks(featureIn: Feature | T): FeatureCollection; diff --git a/packages/turf-kinks/package.json b/packages/turf-kinks/package.json index 745b23135a..24d10c36a3 100644 --- a/packages/turf-kinks/package.json +++ b/packages/turf-kinks/package.json @@ -3,18 +3,20 @@ "name": "@turf/kinks", "version": "6.0.0", "description": "turf kinks module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-kinks/test.js b/packages/turf-kinks/test.js index 4a61f0986d..6114b2b459 100644 --- a/packages/turf-kinks/test.js +++ b/packages/turf-kinks/test.js @@ -4,7 +4,7 @@ const path = require('path'); const load = require('load-json-file'); const write = require('write-json-file'); const { featureEach } = require('@turf/meta'); -const kinks = require('.').default; +const kinks = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-kinks/tsconfig.json b/packages/turf-kinks/tsconfig.json index 91cffcbf55..c3f78e4c94 100644 --- a/packages/turf-kinks/tsconfig.json +++ b/packages/turf-kinks/tsconfig.json @@ -1,17 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - }, - "files": [ - "index.ts" - ] -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-kinks/types.ts b/packages/turf-kinks/types.ts index 67982052e6..ca5c3ce8f1 100644 --- a/packages/turf-kinks/types.ts +++ b/packages/turf-kinks/types.ts @@ -1,5 +1,5 @@ import {polygon} from '@turf/helpers' -import kinks from './' +import kinks from './dist/js/index' const hourglass = polygon([[[-50, 5], [-40, -10], [-50, -10], [-40, 5], [-50, 5]]]); kinks(hourglass) diff --git a/packages/turf-length/.gitignore b/packages/turf-length/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-length/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-length/bench.js b/packages/turf-length/bench.js index 49f9806c15..c0b39dc7b7 100644 --- a/packages/turf-length/bench.js +++ b/packages/turf-length/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const length = require('./').default; +const length = require('./dist/js/index.js').default; // Define fixtures const directory = path.join(__dirname, 'test', 'in') + path.sep; diff --git a/packages/turf-length/index.d.ts b/packages/turf-length/index.d.ts deleted file mode 100644 index 8dff74bfb9..0000000000 --- a/packages/turf-length/index.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Feature, FeatureCollection, GeometryCollection, Units } from "@turf/helpers"; -/** - * Takes a {@link GeoJSON} and measures its length in the specified units, {@link (Multi)Point}'s distance are ignored. - * - * @name length - * @param {Feature} geojson GeoJSON to measure - * @param {Object} [options={}] Optional parameters - * @param {string} [options.units=kilometers] can be degrees, radians, miles, or kilometers - * @returns {number} length of GeoJSON - * @example - * var line = turf.lineString([[115, -32], [131, -22], [143, -25], [150, -34]]); - * var length = turf.length(line, {units: 'miles'}); - * - * //addToMap - * var addToMap = [line]; - * line.properties.distance = length; - */ -export default function length(geojson: Feature | FeatureCollection | GeometryCollection, options?: { - units?: Units; -}): number; diff --git a/packages/turf-length/package.json b/packages/turf-length/package.json index c16bb32fa3..7f9ad16a8e 100644 --- a/packages/turf-length/package.json +++ b/packages/turf-length/package.json @@ -2,18 +2,18 @@ "name": "@turf/length", "version": "6.0.2", "description": "turf length module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-length/test.js b/packages/turf-length/test.js index d3ad02f3bf..9a60d8649e 100644 --- a/packages/turf-length/test.js +++ b/packages/turf-length/test.js @@ -3,7 +3,7 @@ const test = require('tape'); const path = require('path'); const load = require('load-json-file'); const write = require('write-json-file'); -const length = require('./').default; +const length = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-length/tsconfig.json b/packages/turf-length/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-length/tsconfig.json +++ b/packages/turf-length/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-line-arc/.gitignore b/packages/turf-line-arc/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-line-arc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-line-arc/bench.js b/packages/turf-line-arc/bench.js index f15a338764..ca8646d880 100644 --- a/packages/turf-line-arc/bench.js +++ b/packages/turf-line-arc/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const lineArc = require('./').default; +const lineArc = require('./dist/js/index.js').default; const directory = path.join(__dirname, 'test', 'in') + path.sep; const fixtures = fs.readdirSync(directory).map(filename => { diff --git a/packages/turf-line-arc/index.d.ts b/packages/turf-line-arc/index.d.ts deleted file mode 100644 index 043ce697e2..0000000000 --- a/packages/turf-line-arc/index.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Coord, Feature, LineString, Units } from "@turf/helpers"; -/** - * Creates a circular arc, of a circle of the given radius and center point, between bearing1 and bearing2; - * 0 bearing is North of center point, positive clockwise. - * - * @name lineArc - * @param {Coord} center center point - * @param {number} radius radius of the circle - * @param {number} bearing1 angle, in decimal degrees, of the first radius of the arc - * @param {number} bearing2 angle, in decimal degrees, of the second radius of the arc - * @param {Object} [options={}] Optional parameters - * @param {number} [options.steps=64] number of steps - * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians - * @returns {Feature} line arc - * @example - * var center = turf.point([-75, 40]); - * var radius = 5; - * var bearing1 = 25; - * var bearing2 = 47; - * - * var arc = turf.lineArc(center, radius, bearing1, bearing2); - * - * //addToMap - * var addToMap = [center, arc] - */ -export default function lineArc(center: Coord, radius: number, bearing1: number, bearing2: number, options?: { - steps?: number; - units?: Units; -}): Feature; diff --git a/packages/turf-line-arc/index.js b/packages/turf-line-arc/index.js deleted file mode 100644 index a0a020a9e3..0000000000 --- a/packages/turf-line-arc/index.js +++ /dev/null @@ -1,74 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var circle_1 = __importDefault(require("@turf/circle")); -var destination_1 = __importDefault(require("@turf/destination")); -var helpers_1 = require("@turf/helpers"); -/** - * Creates a circular arc, of a circle of the given radius and center point, between bearing1 and bearing2; - * 0 bearing is North of center point, positive clockwise. - * - * @name lineArc - * @param {Coord} center center point - * @param {number} radius radius of the circle - * @param {number} bearing1 angle, in decimal degrees, of the first radius of the arc - * @param {number} bearing2 angle, in decimal degrees, of the second radius of the arc - * @param {Object} [options={}] Optional parameters - * @param {number} [options.steps=64] number of steps - * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians - * @returns {Feature} line arc - * @example - * var center = turf.point([-75, 40]); - * var radius = 5; - * var bearing1 = 25; - * var bearing2 = 47; - * - * var arc = turf.lineArc(center, radius, bearing1, bearing2); - * - * //addToMap - * var addToMap = [center, arc] - */ -function lineArc(center, radius, bearing1, bearing2, options) { - if (options === void 0) { options = {}; } - // default params - var steps = options.steps || 64; - var angle1 = convertAngleTo360(bearing1); - var angle2 = convertAngleTo360(bearing2); - var properties = (!Array.isArray(center) && center.type === "Feature") ? center.properties : {}; - // handle angle parameters - if (angle1 === angle2) { - return helpers_1.lineString(circle_1.default(center, radius, options).geometry.coordinates[0], properties); - } - var arcStartDegree = angle1; - var arcEndDegree = (angle1 < angle2) ? angle2 : angle2 + 360; - var alfa = arcStartDegree; - var coordinates = []; - var i = 0; - while (alfa < arcEndDegree) { - coordinates.push(destination_1.default(center, radius, alfa, options).geometry.coordinates); - i++; - alfa = arcStartDegree + i * 360 / steps; - } - if (alfa > arcEndDegree) { - coordinates.push(destination_1.default(center, radius, arcEndDegree, options).geometry.coordinates); - } - return helpers_1.lineString(coordinates, properties); -} -exports.default = lineArc; -/** - * Takes any angle in degrees - * and returns a valid angle between 0-360 degrees - * - * @private - * @param {number} alfa angle between -180-180 degrees - * @returns {number} angle between 0-360 degrees - */ -function convertAngleTo360(alfa) { - var beta = alfa % 360; - if (beta < 0) { - beta += 360; - } - return beta; -} diff --git a/packages/turf-line-arc/package.json b/packages/turf-line-arc/package.json index b9949743b1..df4f785ce9 100644 --- a/packages/turf-line-arc/package.json +++ b/packages/turf-line-arc/package.json @@ -2,18 +2,20 @@ "name": "@turf/line-arc", "version": "6.0.0", "description": "turf line-arc module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-line-arc/test.js b/packages/turf-line-arc/test.js index 8d1015f474..e0197358a6 100644 --- a/packages/turf-line-arc/test.js +++ b/packages/turf-line-arc/test.js @@ -5,7 +5,7 @@ const load = require('load-json-file'); const write = require('write-json-file'); const truncate = require('@turf/truncate').default; const { featureCollection } = require('@turf/helpers'); -const lineArc = require('./index').default; +const lineArc = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-line-arc/tsconfig.json b/packages/turf-line-arc/tsconfig.json index 91cffcbf55..c3f78e4c94 100644 --- a/packages/turf-line-arc/tsconfig.json +++ b/packages/turf-line-arc/tsconfig.json @@ -1,17 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - }, - "files": [ - "index.ts" - ] -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-line-arc/types.ts b/packages/turf-line-arc/types.ts index 48e22b4ca7..5a1fef0e12 100644 --- a/packages/turf-line-arc/types.ts +++ b/packages/turf-line-arc/types.ts @@ -1,5 +1,5 @@ import {point} from "@turf/helpers"; -import linearc from "./"; +import linearc from "./dist/js/index"; const center = point([-75.343, 39.984]); const bearing1 = 10; diff --git a/packages/turf-line-chunk/package.json b/packages/turf-line-chunk/package.json index 722a715ade..31d5a39585 100644 --- a/packages/turf-line-chunk/package.json +++ b/packages/turf-line-chunk/package.json @@ -13,7 +13,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-line-intersect/.gitignore b/packages/turf-line-intersect/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-line-intersect/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-line-intersect/bench.js b/packages/turf-line-intersect/bench.js index e949b7137f..5b506f47b4 100644 --- a/packages/turf-line-intersect/bench.js +++ b/packages/turf-line-intersect/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const lineIntersect = require('./'); +const lineIntersect = require('./dist/js/index.js'); const directory = path.join(__dirname, 'test', 'in') + path.sep; const fixtures = fs.readdirSync(directory).map(filename => { diff --git a/packages/turf-line-intersect/index.d.ts b/packages/turf-line-intersect/index.d.ts deleted file mode 100644 index 488224b7e6..0000000000 --- a/packages/turf-line-intersect/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Feature, FeatureCollection, LineString, MultiLineString, MultiPolygon, Point, Polygon } from "@turf/helpers"; -/** - * Takes any LineString or Polygon GeoJSON and returns the intersecting point(s). - * - * @name lineIntersect - * @param {GeoJSON} line1 any LineString or Polygon - * @param {GeoJSON} line2 any LineString or Polygon - * @returns {FeatureCollection} point(s) that intersect both - * @example - * var line1 = turf.lineString([[126, -11], [129, -21]]); - * var line2 = turf.lineString([[123, -18], [131, -14]]); - * var intersects = turf.lineIntersect(line1, line2); - * - * //addToMap - * var addToMap = [line1, line2, intersects] - */ -declare function lineIntersect(line1: FeatureCollection | Feature | G1, line2: FeatureCollection | Feature | G2): FeatureCollection; -export default lineIntersect; diff --git a/packages/turf-line-intersect/package.json b/packages/turf-line-intersect/package.json index 6c9c3293b1..24b7769379 100644 --- a/packages/turf-line-intersect/package.json +++ b/packages/turf-line-intersect/package.json @@ -2,18 +2,18 @@ "name": "@turf/line-intersect", "version": "6.0.2", "description": "turf line-intersect module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-line-intersect/test.js b/packages/turf-line-intersect/test.js index b171069845..abc65999aa 100644 --- a/packages/turf-line-intersect/test.js +++ b/packages/turf-line-intersect/test.js @@ -5,7 +5,7 @@ const load = require('load-json-file'); const write = require('write-json-file'); const truncate = require('@turf/truncate').default; const { featureCollection, geometryCollection, lineString, polygon } = require('@turf/helpers'); -const lineIntersect = require('./').default; +const lineIntersect = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-line-intersect/tsconfig.json b/packages/turf-line-intersect/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-line-intersect/tsconfig.json +++ b/packages/turf-line-intersect/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-line-offset/package.json b/packages/turf-line-offset/package.json index 18060fe99f..ef9e8e40f4 100644 --- a/packages/turf-line-offset/package.json +++ b/packages/turf-line-offset/package.json @@ -14,7 +14,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-line-overlap/.gitignore b/packages/turf-line-overlap/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-line-overlap/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-line-overlap/bench.js b/packages/turf-line-overlap/bench.js index 184806f1be..a7a8696b88 100644 --- a/packages/turf-line-overlap/bench.js +++ b/packages/turf-line-overlap/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const lineOverlap = require('./').default; +const lineOverlap = require('./dist/js/index.js').default; const directory = path.join(__dirname, 'test', 'in') + path.sep; const fixtures = fs.readdirSync(directory).map(filename => { diff --git a/packages/turf-line-overlap/index.ts b/packages/turf-line-overlap/index.ts index bd09be183f..5232358cd9 100644 --- a/packages/turf-line-overlap/index.ts +++ b/packages/turf-line-overlap/index.ts @@ -8,7 +8,7 @@ import { featureCollection, isObject, FeatureCollection, Feature, LineString, MultiLineString, Polygon, MultiPolygon, } from '@turf/helpers'; -import * as equal from 'deep-equal'; +import equal from 'deep-equal'; /** * Takes any LineString or Polygon and returns the overlapping lines between both features. diff --git a/packages/turf-line-overlap/package.json b/packages/turf-line-overlap/package.json index 1be66aba49..74f46da4e1 100644 --- a/packages/turf-line-overlap/package.json +++ b/packages/turf-line-overlap/package.json @@ -2,18 +2,20 @@ "name": "@turf/line-overlap", "version": "6.0.2", "description": "turf line-overlap module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-line-overlap/test.js b/packages/turf-line-overlap/test.js index 0de641757b..6e6c37a0f0 100644 --- a/packages/turf-line-overlap/test.js +++ b/packages/turf-line-overlap/test.js @@ -5,7 +5,7 @@ const load = require('load-json-file'); const write = require('write-json-file'); const { featureEach } = require('@turf/meta'); const { featureCollection, lineString } = require('@turf/helpers'); -const lineOverlap = require('./').default; +const lineOverlap = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-line-overlap/tsconfig.json b/packages/turf-line-overlap/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-line-overlap/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-line-overlap/types.ts b/packages/turf-line-overlap/types.ts index 3ff385f4ea..b8aa02d5f5 100644 --- a/packages/turf-line-overlap/types.ts +++ b/packages/turf-line-overlap/types.ts @@ -1,5 +1,5 @@ import { lineString, multiLineString, polygon, multiPolygon } from '@turf/helpers' -import lineOverlap from './' +import lineOverlap from './dist/js/index' const line = lineString([[0, 0], [10, 10]]); const multiLine = multiLineString([[[0, 0], [10, 10]], [[30, 30], [50, 50]]]); diff --git a/packages/turf-line-segment/.gitignore b/packages/turf-line-segment/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-line-segment/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-line-segment/bench.js b/packages/turf-line-segment/bench.js index 6f86727aa9..7d36c59095 100644 --- a/packages/turf-line-segment/bench.js +++ b/packages/turf-line-segment/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const lineSegment = require('./').default; +const lineSegment = require('./dist/js/index.js').default; // Fixtures const directory = path.join(__dirname, 'test', 'in') + path.sep; diff --git a/packages/turf-line-segment/index.d.ts b/packages/turf-line-segment/index.d.ts deleted file mode 100644 index 78fff5e3ca..0000000000 --- a/packages/turf-line-segment/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Feature, FeatureCollection, LineString, MultiLineString, MultiPolygon, Polygon } from "@turf/helpers"; -/** - * Creates a {@link FeatureCollection} of 2-vertex {@link LineString} segments from a - * {@link LineString|(Multi)LineString} or {@link Polygon|(Multi)Polygon}. - * - * @name lineSegment - * @param {GeoJSON} geojson GeoJSON Polygon or LineString - * @returns {FeatureCollection} 2-vertex line segments - * @example - * var polygon = turf.polygon([[[-50, 5], [-40, -10], [-50, -10], [-40, 5], [-50, 5]]]); - * var segments = turf.lineSegment(polygon); - * - * //addToMap - * var addToMap = [polygon, segments] - */ -declare function lineSegment(geojson: Feature | FeatureCollection | G): FeatureCollection; -export default lineSegment; diff --git a/packages/turf-line-segment/package.json b/packages/turf-line-segment/package.json index 3d62390590..ee697a28c8 100644 --- a/packages/turf-line-segment/package.json +++ b/packages/turf-line-segment/package.json @@ -2,18 +2,18 @@ "name": "@turf/line-segment", "version": "6.0.2", "description": "turf line-segment module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-line-segment/test.js b/packages/turf-line-segment/test.js index 9f9d103204..ec0113a968 100644 --- a/packages/turf-line-segment/test.js +++ b/packages/turf-line-segment/test.js @@ -5,7 +5,7 @@ const load = require('load-json-file'); const write = require('write-json-file'); const { featureEach } = require('@turf/meta'); const { featureCollection, lineString } = require('@turf/helpers'); -const lineSegment = require('./').default; +const lineSegment = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-line-segment/tsconfig.json b/packages/turf-line-segment/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-line-segment/tsconfig.json +++ b/packages/turf-line-segment/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-line-to-polygon/.gitignore b/packages/turf-line-to-polygon/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-line-to-polygon/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-line-to-polygon/bench.js b/packages/turf-line-to-polygon/bench.js index 3eecf1d106..c17cad5fe1 100644 --- a/packages/turf-line-to-polygon/bench.js +++ b/packages/turf-line-to-polygon/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const lineToPolygon = require('./').default; +const lineToPolygon = require('./dist/js/index.js').default; const directory = path.join(__dirname, 'test', 'in') + path.sep; let fixtures = fs.readdirSync(directory).map(filename => { diff --git a/packages/turf-line-to-polygon/package.json b/packages/turf-line-to-polygon/package.json index ce61efbbeb..919ceadda1 100644 --- a/packages/turf-line-to-polygon/package.json +++ b/packages/turf-line-to-polygon/package.json @@ -2,18 +2,20 @@ "name": "@turf/line-to-polygon", "version": "6.0.1", "description": "turf line-to-polygon module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-line-to-polygon/test.js b/packages/turf-line-to-polygon/test.js index d311b1a9f7..e076bf4109 100644 --- a/packages/turf-line-to-polygon/test.js +++ b/packages/turf-line-to-polygon/test.js @@ -4,7 +4,7 @@ const path = require('path'); const load = require('load-json-file'); const write = require('write-json-file'); const { point, lineString } = require('@turf/helpers'); -const lineToPolygon = require('./').default; +const lineToPolygon = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-line-to-polygon/tsconfig.json b/packages/turf-line-to-polygon/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-line-to-polygon/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-line-to-polygon/types.ts b/packages/turf-line-to-polygon/types.ts index 33ed394010..557c334cc9 100644 --- a/packages/turf-line-to-polygon/types.ts +++ b/packages/turf-line-to-polygon/types.ts @@ -9,7 +9,7 @@ import { Feature, FeatureCollection } from '@turf/helpers' -import lineToPolygon from './' +import lineToPolygon from './dist/js/index' // Fixtures const coords = [[125, -30], [145, -30], [145, -20], [125, -20], [125, -30]]; diff --git a/packages/turf-mask/package.json b/packages/turf-mask/package.json index e67f335d9e..c4c1c6f643 100644 --- a/packages/turf-mask/package.json +++ b/packages/turf-mask/package.json @@ -13,7 +13,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-meta/package.json b/packages/turf-meta/package.json index d95ac9bc01..fd14811432 100644 --- a/packages/turf-meta/package.json +++ b/packages/turf-meta/package.json @@ -12,7 +12,9 @@ ], "scripts": { "pretest": "rollup -f cjs -o index.js index.mjs", - "test": "node test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "bench": "node bench.js", "docs": "node ../../scripts/generate-readmes" }, diff --git a/packages/turf-moran-index/.gitignore b/packages/turf-moran-index/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-moran-index/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-moran-index/bench.js b/packages/turf-moran-index/bench.js index 9b61f42b02..68ef70ead4 100644 --- a/packages/turf-moran-index/bench.js +++ b/packages/turf-moran-index/bench.js @@ -1,5 +1,5 @@ const Benchmark = require('benchmark'); -const moranIndex = require('.').default; +const moranIndex = require('./dist/js/index.js').default; const glob = require('glob'); const path = require('path'); const load = require('load-json-file'); diff --git a/packages/turf-moran-index/index.d.ts b/packages/turf-moran-index/index.d.ts deleted file mode 100644 index c4c8d7ee23..0000000000 --- a/packages/turf-moran-index/index.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { FeatureCollection } from "@turf/helpers"; -/** - * Moran's I measures patterns of attribute values associated with features. - * The method reveal whether similar values tend to occur near each other, - * or whether high or low values are interspersed. - * - * Moran's I > 0 means a clusterd pattern. - * Moran's I < 0 means a dispersed pattern. - * Moran's I = 0 means a random pattern. - * - * In order to test the significance of the result. The z score is calculated. - * A positive enough z-score (ex. >1.96) indicates clustering, - * while a negative enough z-score (ex. <-1.96) indicates a dispersed pattern. - * - * the z-score can be calculated based on a normal or random assumption. - * - * **Bibliography*** - * - * 1. [Moran's I](https://en.wikipedia.org/wiki/Moran%27s_I) - * - * 2. [pysal](http://pysal.readthedocs.io/en/latest/index.html) - * - * 3. Andy Mitchell, The ESRI Guide to GIS Analysis Volume 2: Spatial Measurements & Statistics. - * - * @name moranIndex - * @param {FeatureCollection} fc - * @param {Object} options - * @param {string} options.inputField the property name, must contain numeric values - * @param {number} [options.threshold=100000] the distance threshold - * @param {number} [options.p=2] the Minkowski p-norm distance parameter - * @param {boolean} [options.binary=false] whether transfrom the distance to binary - * @param {number} [options.alpha=-1] the distance decay parameter - * @param {boolean} [options.standardization=true] wheter row standardization the distance - * @returns {MoranIndex} - * @example - * - * const bbox = [-65, 40, -63, 42]; - * const dataset = turf.randomPoint(100, { bbox: bbox }); - * - * const result = turf.moranIndex(dataset, { - * inputField: 'CRIME', - * }); - */ -export default function (fc: FeatureCollection, options: { - inputField: string; - threshold?: number; - p?: number; - binary?: boolean; - alpha?: number; - standardization?: boolean; -}): { - moranIndex: number; - expectedMoranIndex: number; - stdNorm: number; - zNorm: number; -}; diff --git a/packages/turf-moran-index/package.json b/packages/turf-moran-index/package.json index b592c4b4d0..4feb4bf24c 100644 --- a/packages/turf-moran-index/package.json +++ b/packages/turf-moran-index/package.json @@ -2,18 +2,18 @@ "name": "@turf/moran-index", "version": "6.0.1", "description": "turf moran-index module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-moran-index/test.js b/packages/turf-moran-index/test.js index 44a70277ed..b03e945647 100644 --- a/packages/turf-moran-index/test.js +++ b/packages/turf-moran-index/test.js @@ -3,7 +3,7 @@ const glob = require('glob'); const path = require('path'); const load = require('load-json-file'); const write = require('write-json-file'); -const moranIndex = require('.').default; +const moranIndex = require('./dist/js/index.js').default; test('turf-moran-index', t => { diff --git a/packages/turf-moran-index/tsconfig.json b/packages/turf-moran-index/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-moran-index/tsconfig.json +++ b/packages/turf-moran-index/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-nearest-neighbor-analysis/.gitignore b/packages/turf-nearest-neighbor-analysis/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-nearest-neighbor-analysis/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-nearest-neighbor-analysis/bench.js b/packages/turf-nearest-neighbor-analysis/bench.js index 79da960565..48dfd57373 100644 --- a/packages/turf-nearest-neighbor-analysis/bench.js +++ b/packages/turf-nearest-neighbor-analysis/bench.js @@ -2,7 +2,7 @@ const Benchmark = require('benchmark'); const glob = require('glob'); const path = require('path'); const load = require('load-json-file'); -const nearestNeighborAnalysis = require('.').default; +const nearestNeighborAnalysis = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-nearest-neighbor-analysis/index.d.ts b/packages/turf-nearest-neighbor-analysis/index.d.ts deleted file mode 100644 index d6ca6bcf17..0000000000 --- a/packages/turf-nearest-neighbor-analysis/index.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { FeatureCollection, Feature, Polygon, Units, Properties } from '@turf/helpers'; -export interface NearestNeighborStatistics { - units: Units; - arealUnits: string; - observedMeanDistance: number; - expectedMeanDistance: number; - numberOfPoints: number; - zScore: number; -} -export interface NearestNeighborStudyArea extends Feature { - properties: { - nearestNeighborAnalysis: NearestNeighborStatistics; - [key: string]: any; - }; -} -/** - * Nearest Neighbor Analysis calculates an index based the average distances - * between points in the dataset, thereby providing inference as to whether the - * data is clustered, dispersed, or randomly distributed within the study area. - * - * It returns a {@link Feature} of the study area, with the results of - * the analysis attached as part of of the `nearestNeighborAnalysis` property - * of the study area's `properties`. The attached - * [_z_-score](https://en.wikipedia.org/wiki/Standard_score) indicates how many - * standard deviations above or below the expected mean distance the data's - * observed mean distance is. The more negative, the more clustered. The more - * positive, the more evenly dispersed. A _z_-score between -2 and 2 indicates - * a seemingly random distribution. That is, within _p_ of less than 0.05, the - * distribution appears statistically significantly neither clustered nor - * dispersed. - * - * **Remarks** - * - * - Though the analysis will work on any {@link FeatureCollection} type, it - * works best with {@link Point} collections. - * - * - This analysis is _very_ sensitive to the study area provided. - * If no {@link Feature} is passed as the study area, the function draws a box - * around the data, which may distort the findings. This analysis works best - * with a bounded area of interest within with the data is either clustered, - * dispersed, or randomly distributed. For example, a city's subway stops may - * look extremely clustered if the study area is an entire state. On the other - * hand, they may look rather evenly dispersed if the study area is limited to - * the city's downtown. - * - * **Bibliography** - * - * Philip J. Clark and Francis C. Evans, “Distance to Nearest Neighbor as a - * Measure of Spatial Relationships in Populations,” _Ecology_ 35, no. 4 - * (1954): 445–453, doi:[10.2307/1931034](http://doi.org/10.2307/1931034). - * - * @name nearestNeighborAnalysis - * @param {FeatureCollection} dataset FeatureCollection (pref. of points) to study - * @param {Object} [options={}] Optional parameters - * @param {Feature} [options.studyArea] polygon representing the study area - * @param {string} [options.units='kilometers'] unit of measurement for distances and, squared, area. - * @param {Object} [options.properties={}] properties - * @returns {Feature} A polygon of the study area or an approximation of one. - * @example - * var bbox = [-65, 40, -63, 42]; - * var dataset = turf.randomPoint(100, { bbox: bbox }); - * var nearestNeighborStudyArea = turf.nearestNeighborAnalysis(dataset); - * - * //addToMap - * var addToMap = [dataset, nearestNeighborStudyArea]; - */ -declare function nearestNeighborAnalysis(dataset: FeatureCollection, options?: { - studyArea?: Feature; - units?: Units; - properties?: Properties; -}): NearestNeighborStudyArea; -export default nearestNeighborAnalysis; diff --git a/packages/turf-nearest-neighbor-analysis/package.json b/packages/turf-nearest-neighbor-analysis/package.json index a2a7b3bf45..a31d7a63f1 100644 --- a/packages/turf-nearest-neighbor-analysis/package.json +++ b/packages/turf-nearest-neighbor-analysis/package.json @@ -2,18 +2,18 @@ "name": "@turf/nearest-neighbor-analysis", "version": "6.0.1", "description": "turf nearest-neighbor-analysis module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-nearest-neighbor-analysis/test.js b/packages/turf-nearest-neighbor-analysis/test.js index de802d0888..567d296c6a 100644 --- a/packages/turf-nearest-neighbor-analysis/test.js +++ b/packages/turf-nearest-neighbor-analysis/test.js @@ -1,3 +1,4 @@ +const fs = require('fs'); const test = require('tape'); const glob = require('glob'); const path = require('path'); @@ -7,25 +8,35 @@ const truncate = require('@turf/truncate').default; const centroid = require('@turf/centroid').default; const { featureEach } = require('@turf/meta'); const { featureCollection } = require('@turf/helpers'); -const nearestNeighborAnalysis = require('.').default; +const nearestNeighborAnalysis = require('./dist/js/index.js').default; +const directories = { + in: path.join(__dirname, 'test', 'in') + path.sep, + out: path.join(__dirname, 'test', 'out') + path.sep +}; +const fixtures = fs.readdirSync(directories.in).map(filename => { + return { + filename, + name: path.parse(filename).name, + geojson: load.sync(directories.in + filename) + }; +}); test('turf-nearest-neighbor', t => { - glob.sync(path.join(__dirname, 'test', 'in', '*.json')).forEach(filepath => { - // Define params - const {name} = path.parse(filepath); - const geojson = load.sync(filepath); - const options = geojson.options; - const results = featureCollection([]); - featureEach(geojson, feature => results.features.push(truncate(feature))); - if (geojson.features[0].geometry.type === "Polygon") { - featureEach(geojson, feature => results.features.push(truncate(centroid(feature, {properties: {"marker-color": "#0a0"}})))); - } - results.features.push(truncate(nearestNeighborAnalysis(geojson, options))); - const out = filepath.replace('in', 'out'); - if (process.env.REGEN) write.sync(out, results); - t.deepEqual(results, load.sync(out), name); + fixtures.forEach(fixture => { + const filename = fixture.filename; + const name = fixture.name; + const geojson = fixture.geojson; + const options = geojson.options; + const results = featureCollection([]); + featureEach(geojson, feature => results.features.push(truncate(feature))); + if (geojson.features[0].geometry.type === "Polygon") { + featureEach(geojson, feature => results.features.push(truncate(centroid(feature, {properties: {"marker-color": "#0a0"}})))); + } + results.features.push(truncate(nearestNeighborAnalysis(geojson, options))); + if (process.env.REGEN) write.sync(directories.out + filename, results); + t.deepEqual(results, load.sync(directories.out + filename), name); }); t.end(); diff --git a/packages/turf-nearest-neighbor-analysis/tsconfig.json b/packages/turf-nearest-neighbor-analysis/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-nearest-neighbor-analysis/tsconfig.json +++ b/packages/turf-nearest-neighbor-analysis/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-nearest-point-on-line/.gitignore b/packages/turf-nearest-point-on-line/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-nearest-point-on-line/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-nearest-point-on-line/bench.js b/packages/turf-nearest-point-on-line/bench.js index 4852da0f39..194de75d05 100644 --- a/packages/turf-nearest-point-on-line/bench.js +++ b/packages/turf-nearest-point-on-line/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const nearestPointOnLine = require('./').default; +const nearestPointOnLine = require('./dist/js/index.js').default; const directory = path.join(__dirname, 'test', 'in') + path.sep; const fixtures = fs.readdirSync(directory).map(filename => { diff --git a/packages/turf-nearest-point-on-line/package.json b/packages/turf-nearest-point-on-line/package.json index fe86dc735e..d7618843c2 100644 --- a/packages/turf-nearest-point-on-line/package.json +++ b/packages/turf-nearest-point-on-line/package.json @@ -2,18 +2,20 @@ "name": "@turf/nearest-point-on-line", "version": "6.0.2", "description": "turf nearest-point-on-line module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-nearest-point-on-line/test.js b/packages/turf-nearest-point-on-line/test.js index 0fb44744da..ae09a9cfca 100644 --- a/packages/turf-nearest-point-on-line/test.js +++ b/packages/turf-nearest-point-on-line/test.js @@ -8,7 +8,7 @@ const distance = require('@turf/distance').default; const truncate = require('@turf/truncate').default; const length = require('@turf/length').default; const { lineString, multiLineString, point, featureCollection, round } = require('@turf/helpers'); -const nearestPointOnLine = require('./').default; +const nearestPointOnLine = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-nearest-point-on-line/tsconfig.json b/packages/turf-nearest-point-on-line/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-nearest-point-on-line/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-nearest-point-on-line/types.ts b/packages/turf-nearest-point-on-line/types.ts index 5e204ebb16..b7e4458cb1 100644 --- a/packages/turf-nearest-point-on-line/types.ts +++ b/packages/turf-nearest-point-on-line/types.ts @@ -1,4 +1,4 @@ -import nearestPointOnLine from './' +import nearestPointOnLine from './dist/js/index' import { point, lineString, multiLineString } from '@turf/helpers' const units = 'miles' diff --git a/packages/turf-nearest-point-to-line/.gitignore b/packages/turf-nearest-point-to-line/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-nearest-point-to-line/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-nearest-point-to-line/bench.js b/packages/turf-nearest-point-to-line/bench.js index b16987afab..ea3b89d642 100644 --- a/packages/turf-nearest-point-to-line/bench.js +++ b/packages/turf-nearest-point-to-line/bench.js @@ -2,7 +2,7 @@ import path from 'path'; import glob from 'glob'; import load from 'load-json-file'; import Benchmark from 'benchmark'; -import nearestPointToLine from './'; +import nearestPointToLine from './dist/js/index.js'; /** * Benchmark Results diff --git a/packages/turf-nearest-point-to-line/index.d.ts b/packages/turf-nearest-point-to-line/index.d.ts deleted file mode 100644 index e18e0e0560..0000000000 --- a/packages/turf-nearest-point-to-line/index.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Feature, FeatureCollection, GeometryCollection, LineString, Point, Properties, Units } from "@turf/helpers"; -/** - * Returns the closest {@link Point|point}, of a {@link FeatureCollection|collection} of points, - * to a {@link LineString|line}. The returned point has a `dist` property indicating its distance to the line. - * - * @name nearestPointToLine - * @param {FeatureCollection|GeometryCollection} points Point Collection - * @param {Feature|Geometry} line Line Feature - * @param {Object} [options] Optional parameters - * @param {string} [options.units='kilometers'] unit of the output distance property - * (eg: degrees, radians, miles, or kilometers) - * @param {Object} [options.properties={}] Translate Properties to Point - * @returns {Feature} the closest point - * @example - * var pt1 = turf.point([0, 0]); - * var pt2 = turf.point([0.5, 0.5]); - * var points = turf.featureCollection([pt1, pt2]); - * var line = turf.lineString([[1,1], [-1,1]]); - * - * var nearest = turf.nearestPointToLine(points, line); - * - * //addToMap - * var addToMap = [nearest, line]; - */ -declare function nearestPointToLine

(points: FeatureCollection | Feature | GeometryCollection, line: Feature | LineString, options?: { - units?: Units; - properties?: Properties; -}): Feature; -export default nearestPointToLine; diff --git a/packages/turf-nearest-point-to-line/package.json b/packages/turf-nearest-point-to-line/package.json index b0cfbe57ca..93a4492213 100644 --- a/packages/turf-nearest-point-to-line/package.json +++ b/packages/turf-nearest-point-to-line/package.json @@ -2,18 +2,20 @@ "name": "@turf/nearest-point-to-line", "version": "6.0.0", "description": "turf nearest-point-to-line module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-nearest-point-to-line/test.js b/packages/turf-nearest-point-to-line/test.js index f1ef3e6bd5..cbefd67c94 100644 --- a/packages/turf-nearest-point-to-line/test.js +++ b/packages/turf-nearest-point-to-line/test.js @@ -6,7 +6,7 @@ const write = require('write-json-file'); const circle = require('@turf/circle').default; const truncate = require('@turf/truncate').default; const { geometryCollection, featureCollection, point, lineString, round } = require('@turf/helpers'); -const nearestPointToLine = require('./').default; +const nearestPointToLine = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-nearest-point-to-line/tsconfig.json b/packages/turf-nearest-point-to-line/tsconfig.json index 91cffcbf55..c3f78e4c94 100644 --- a/packages/turf-nearest-point-to-line/tsconfig.json +++ b/packages/turf-nearest-point-to-line/tsconfig.json @@ -1,17 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - }, - "files": [ - "index.ts" - ] -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-nearest-point-to-line/types.ts b/packages/turf-nearest-point-to-line/types.ts index a6957bff61..1a287ef133 100644 --- a/packages/turf-nearest-point-to-line/types.ts +++ b/packages/turf-nearest-point-to-line/types.ts @@ -5,7 +5,7 @@ import { lineString, Point } from '@turf/helpers' -import nearestPointToLine from './' +import nearestPointToLine from './dist/js/index' const points = featureCollection([point([0, 0]), point([0.5, 0.5])]); const line = lineString([[1,1], [-1,1]]); diff --git a/packages/turf-nearest-point/.gitignore b/packages/turf-nearest-point/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-nearest-point/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-nearest-point/bench.js b/packages/turf-nearest-point/bench.js index 85ffc6d4cf..5a1f8a8bd6 100644 --- a/packages/turf-nearest-point/bench.js +++ b/packages/turf-nearest-point/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const Benchmark = require('benchmark'); const load = require('load-json-file'); -const nearestPoint = require('./').default; +const nearestPoint = require('./dist/js/index.js').default; const pts = load.sync(path.join(__dirname, 'test', 'in', 'points.json')); diff --git a/packages/turf-nearest-point/index.d.ts b/packages/turf-nearest-point/index.d.ts deleted file mode 100644 index d8ab680cd5..0000000000 --- a/packages/turf-nearest-point/index.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Coord, Feature, FeatureCollection, Point } from '@turf/helpers'; -export interface NearestPoint extends Feature { - properties: { - featureIndex: number; - distanceToPoint: number; - [key: string]: any; - }; -} -/** - * Takes a reference {@link Point|point} and a FeatureCollection of Features - * with Point geometries and returns the - * point from the FeatureCollection closest to the reference. This calculation - * is geodesic. - * - * @name nearestPoint - * @param {Coord} targetPoint the reference point - * @param {FeatureCollection} points against input point set - * @returns {Feature} the closest point in the set to the reference point - * @example - * var targetPoint = turf.point([28.965797, 41.010086], {"marker-color": "#0F0"}); - * var points = turf.featureCollection([ - * turf.point([28.973865, 41.011122]), - * turf.point([28.948459, 41.024204]), - * turf.point([28.938674, 41.013324]) - * ]); - * - * var nearest = turf.nearestPoint(targetPoint, points); - * - * //addToMap - * var addToMap = [targetPoint, points, nearest]; - * nearest.properties['marker-color'] = '#F00'; - */ -declare function nearestPoint(targetPoint: Coord, points: FeatureCollection): NearestPoint; -export default nearestPoint; diff --git a/packages/turf-nearest-point/package.json b/packages/turf-nearest-point/package.json index 61159f45f3..31c8426dff 100644 --- a/packages/turf-nearest-point/package.json +++ b/packages/turf-nearest-point/package.json @@ -2,18 +2,18 @@ "name": "@turf/nearest-point", "version": "6.0.1", "description": "turf nearest-point module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-nearest-point/test.js b/packages/turf-nearest-point/test.js index 6089632c70..e3bcaf4944 100644 --- a/packages/turf-nearest-point/test.js +++ b/packages/turf-nearest-point/test.js @@ -5,7 +5,7 @@ const path = require('path'); const load = require('load-json-file'); const write = require('write-json-file'); const {featureCollection, point} = require('@turf/helpers'); -const nearestPoint = require('./').default; +const nearestPoint = require('./dist/js/index.js').default; const directories = { diff --git a/packages/turf-nearest-point/tsconfig.json b/packages/turf-nearest-point/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-nearest-point/tsconfig.json +++ b/packages/turf-nearest-point/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-planepoint/package.json b/packages/turf-planepoint/package.json index 846ee6e4fb..2767aaf332 100644 --- a/packages/turf-planepoint/package.json +++ b/packages/turf-planepoint/package.json @@ -13,7 +13,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-point-grid/.gitignore b/packages/turf-point-grid/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-point-grid/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-point-grid/bench.js b/packages/turf-point-grid/bench.js index 674d4d70b3..363d530dce 100644 --- a/packages/turf-point-grid/bench.js +++ b/packages/turf-point-grid/bench.js @@ -1,6 +1,6 @@ const Benchmark = require('benchmark'); const { polygon } = require('@turf/helpers'); -const grid = require('./'); +const grid = require('./dist/js/index.js'); var bbox = [-95, 30, -85, 40]; var mask = polygon([[[6.5, 44.6 ], [ 9.2, 44.8 ], [ 8.3, 46.4 ], [ 6.5, 44.6 ]]]); diff --git a/packages/turf-point-grid/package.json b/packages/turf-point-grid/package.json index 037e29af08..0a770626ed 100644 --- a/packages/turf-point-grid/package.json +++ b/packages/turf-point-grid/package.json @@ -2,18 +2,20 @@ "name": "@turf/point-grid", "version": "6.0.1", "description": "turf point-grid module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-point-grid/test.js b/packages/turf-point-grid/test.js index 0e97804749..84cc5c07c6 100644 --- a/packages/turf-point-grid/test.js +++ b/packages/turf-point-grid/test.js @@ -6,7 +6,7 @@ const write = require('write-json-file'); const bboxPoly = require('@turf/bbox-polygon').default; const truncate = require('@turf/truncate').default; const { point } = require('@turf/helpers'); -const pointGrid = require('./').default; +const pointGrid = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-point-grid/tsconfig.json b/packages/turf-point-grid/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-point-grid/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-point-grid/types.ts b/packages/turf-point-grid/types.ts index 94c4bf98b7..dd1ee35ea3 100644 --- a/packages/turf-point-grid/types.ts +++ b/packages/turf-point-grid/types.ts @@ -1,5 +1,5 @@ import { BBox, polygon, Polygon} from '@turf/helpers'; -import pointGrid from './'; +import pointGrid from './dist/js/index'; const cellSide = 50; const bbox: BBox = [-95, 30, -85, 40]; diff --git a/packages/turf-point-to-line-distance/.gitignore b/packages/turf-point-to-line-distance/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-point-to-line-distance/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-point-to-line-distance/bench.js b/packages/turf-point-to-line-distance/bench.js index ed31cf4270..c246831367 100644 --- a/packages/turf-point-to-line-distance/bench.js +++ b/packages/turf-point-to-line-distance/bench.js @@ -2,7 +2,7 @@ import fs from 'fs'; import path from 'path'; import load from 'load-json-file'; import Benchmark from 'benchmark'; -import pointToLineDistance from './index'; +import pointToLineDistance from './dist/js/index.js'; const directory = path.join(__dirname, 'test', 'in') + path.sep; diff --git a/packages/turf-point-to-line-distance/index.d.ts b/packages/turf-point-to-line-distance/index.d.ts deleted file mode 100644 index b777529bab..0000000000 --- a/packages/turf-point-to-line-distance/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Coord, Feature, LineString, Units } from "@turf/helpers"; -/** - * Returns the minimum distance between a {@link Point} and a {@link LineString}, being the distance from a line the - * minimum distance between the point and any segment of the `LineString`. - * - * @name pointToLineDistance - * @param {Feature|Array} pt Feature or Geometry - * @param {Feature} line GeoJSON Feature or Geometry - * @param {Object} [options={}] Optional parameters - * @param {string} [options.units="kilometers"] can be anything supported by turf/convertLength - * (ex: degrees, radians, miles, or kilometers) - * @param {string} [options.method="geodesic"] wether to calculate the distance based on geodesic (spheroid) or - * planar (flat) method. Valid options are 'geodesic' or 'planar'. - * @returns {number} distance between point and line - * @example - * var pt = turf.point([0, 0]); - * var line = turf.lineString([[1, 1],[-1, 1]]); - * - * var distance = turf.pointToLineDistance(pt, line, {units: 'miles'}); - * //=69.11854715938406 - */ -declare function pointToLineDistance(pt: Coord, line: Feature | LineString, options?: { - units?: Units; - method?: "geodesic" | "planar"; -}): number; -export default pointToLineDistance; diff --git a/packages/turf-point-to-line-distance/package.json b/packages/turf-point-to-line-distance/package.json index 0834955ac2..d772c17664 100644 --- a/packages/turf-point-to-line-distance/package.json +++ b/packages/turf-point-to-line-distance/package.json @@ -2,18 +2,20 @@ "name": "@turf/point-to-line-distance", "version": "6.0.0", "description": "turf point-to-line-distance module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-point-to-line-distance/test.js b/packages/turf-point-to-line-distance/test.js index 057105784c..dfc403d549 100644 --- a/packages/turf-point-to-line-distance/test.js +++ b/packages/turf-point-to-line-distance/test.js @@ -5,7 +5,7 @@ const load = require('load-json-file'); const write = require('write-json-file'); const circle = require('@turf/circle').default; const { point, lineString, round } = require('@turf/helpers'); -const pointToLineDistance = require('.').default; +const pointToLineDistance = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-point-to-line-distance/tsconfig.json b/packages/turf-point-to-line-distance/tsconfig.json index 91cffcbf55..c3f78e4c94 100644 --- a/packages/turf-point-to-line-distance/tsconfig.json +++ b/packages/turf-point-to-line-distance/tsconfig.json @@ -1,17 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - }, - "files": [ - "index.ts" - ] -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-point-to-line-distance/types.ts b/packages/turf-point-to-line-distance/types.ts index 5843eb56d6..6e85a32702 100644 --- a/packages/turf-point-to-line-distance/types.ts +++ b/packages/turf-point-to-line-distance/types.ts @@ -1,5 +1,5 @@ import { point, lineString } from '@turf/helpers' -import pointToLineDistance from './' +import pointToLineDistance from './dist/js/index' const pt = point([0, 0]) const line = lineString([[1, 1],[-1, 1]]) diff --git a/packages/turf-points-within-polygon/package.json b/packages/turf-points-within-polygon/package.json index 37f8513074..f49d75683f 100644 --- a/packages/turf-points-within-polygon/package.json +++ b/packages/turf-points-within-polygon/package.json @@ -13,7 +13,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-polygon-smooth/package.json b/packages/turf-polygon-smooth/package.json index ccb3648976..7719d66080 100644 --- a/packages/turf-polygon-smooth/package.json +++ b/packages/turf-polygon-smooth/package.json @@ -13,7 +13,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-polygon-tangents/package.json b/packages/turf-polygon-tangents/package.json index fc82675289..c156f63fa8 100644 --- a/packages/turf-polygon-tangents/package.json +++ b/packages/turf-polygon-tangents/package.json @@ -13,7 +13,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-polygon-to-line/.gitignore b/packages/turf-polygon-to-line/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-polygon-to-line/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-polygon-to-line/bench.js b/packages/turf-polygon-to-line/bench.js index 65866cb9e1..666741a245 100644 --- a/packages/turf-polygon-to-line/bench.js +++ b/packages/turf-polygon-to-line/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const polygonToLine = require('./'); +const polygonToLine = require('./dist/js/index.js'); const directory = path.join(__dirname, 'test', 'in') + path.sep; const fixtures = fs.readdirSync(directory).map(filename => { diff --git a/packages/turf-polygon-to-line/index.d.ts b/packages/turf-polygon-to-line/index.d.ts deleted file mode 100644 index 039ede7ec0..0000000000 --- a/packages/turf-polygon-to-line/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Feature, FeatureCollection, LineString, MultiLineString, MultiPolygon, Polygon, Properties } from "@turf/helpers"; -/** - * Converts a {@link Polygon} to {@link LineString|(Multi)LineString} or {@link MultiPolygon} to a - * {@link FeatureCollection} of {@link LineString|(Multi)LineString}. - * - * @name polygonToLine - * @param {Feature} poly Feature to convert - * @param {Object} [options={}] Optional parameters - * @param {Object} [options.properties={}] translates GeoJSON properties to Feature - * @returns {FeatureCollection|Feature} converted (Multi)Polygon to (Multi)LineString - * @example - * var poly = turf.polygon([[[125, -30], [145, -30], [145, -20], [125, -20], [125, -30]]]); - * - * var line = turf.polygonToLine(poly); - * - * //addToMap - * var addToMap = [line]; - */ -export default function (poly: Feature | G, options?: { - properties?: any; -}): Feature | FeatureCollection; -/** - * @private - */ -export declare function polygonToLine(poly: Feature | G, options?: { - properties?: any; -}): Feature; -/** - * @private - */ -export declare function multiPolygonToLine(multiPoly: Feature | G, options?: { - properties?: P; -}): FeatureCollection; -/** - * @private - */ -export declare function coordsToLine

(coords: number[][][], properties: P): Feature; diff --git a/packages/turf-polygon-to-line/package.json b/packages/turf-polygon-to-line/package.json index aa01d6da74..0e38c1826e 100644 --- a/packages/turf-polygon-to-line/package.json +++ b/packages/turf-polygon-to-line/package.json @@ -2,18 +2,18 @@ "name": "@turf/polygon-to-line", "version": "6.0.3", "description": "turf polygon-to-line module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-polygon-to-line/test.js b/packages/turf-polygon-to-line/test.js index 023937a475..24dba9e530 100644 --- a/packages/turf-polygon-to-line/test.js +++ b/packages/turf-polygon-to-line/test.js @@ -5,7 +5,7 @@ const load = require('load-json-file'); const write = require('write-json-file'); const { point } = require('@turf/helpers'); const { polygon } = require('@turf/helpers'); -const polygonToLine = require('./').default; +const polygonToLine = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-polygon-to-line/tsconfig.json b/packages/turf-polygon-to-line/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-polygon-to-line/tsconfig.json +++ b/packages/turf-polygon-to-line/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-polygonize/package.json b/packages/turf-polygonize/package.json index efc47a4b42..0f74c3c92f 100644 --- a/packages/turf-polygonize/package.json +++ b/packages/turf-polygonize/package.json @@ -14,7 +14,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-projection/.gitignore b/packages/turf-projection/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-projection/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-projection/bench.js b/packages/turf-projection/bench.js index 18e3aee147..292be7e661 100644 --- a/packages/turf-projection/bench.js +++ b/packages/turf-projection/bench.js @@ -2,7 +2,7 @@ import path from 'path'; import glob from 'glob'; import load from 'load-json-file'; import Benchmark from 'benchmark'; -import { toMercator, toWgs84 } from './'; +import { toMercator, toWgs84 } from './dist/js/index.js'; const suite = new Benchmark.Suite('turf-projection'); diff --git a/packages/turf-projection/package.json b/packages/turf-projection/package.json index c8f2952a9a..9c154b2745 100644 --- a/packages/turf-projection/package.json +++ b/packages/turf-projection/package.json @@ -2,18 +2,20 @@ "name": "@turf/projection", "version": "6.0.1", "description": "turf projection module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-projection/test.js b/packages/turf-projection/test.js index cfcaad0c9d..ac44032d55 100644 --- a/packages/turf-projection/test.js +++ b/packages/turf-projection/test.js @@ -8,7 +8,7 @@ const clone = require('@turf/clone').default; const { point } = require('@turf/helpers'); const truncate = require('@turf/truncate').default; const { coordEach } = require('@turf/meta'); -const { toMercator, toWgs84 } = require('.'); +const { toMercator, toWgs84 } = require('./dist/js/index.js'); const directories = { mercator: path.join(__dirname, 'test', 'mercator') + path.sep, diff --git a/packages/turf-projection/tsconfig.json b/packages/turf-projection/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-projection/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-projection/types.ts b/packages/turf-projection/types.ts index fcfaa5e950..e49c06d4df 100644 --- a/packages/turf-projection/types.ts +++ b/packages/turf-projection/types.ts @@ -1,5 +1,5 @@ -import * as projection from './' -import { toMercator, toWgs84 } from './' +import * as projection from './dist/js/index' +import { toMercator, toWgs84 } from './dist/js/index' import { point } from '@turf/helpers' // Types test diff --git a/packages/turf-quadrat-analysis/.gitignore b/packages/turf-quadrat-analysis/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-quadrat-analysis/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-quadrat-analysis/bench.js b/packages/turf-quadrat-analysis/bench.js index 06034fe56f..edf4b6054d 100644 --- a/packages/turf-quadrat-analysis/bench.js +++ b/packages/turf-quadrat-analysis/bench.js @@ -5,7 +5,7 @@ const Benchmark = require('benchmark'); const { randomPoint } = require('@turf/random'); const bbox = require('@turf/bbox').default; const nearestNeighborAnalysis = require('@turf/nearest-neighbor-analysis').default; -const quadratAnalysis = require('.').default; +const quadratAnalysis = require('./dist/js/index.js').default; /** * Benchmark Results diff --git a/packages/turf-quadrat-analysis/index.d.ts b/packages/turf-quadrat-analysis/index.d.ts deleted file mode 100644 index 1f756f0a6b..0000000000 --- a/packages/turf-quadrat-analysis/index.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { FeatureCollection, Point } from "@turf/helpers"; -export interface QuadratAnalysisResult { - criticalValue: number; - maxAbsoluteDifference: number; - isRandom: boolean; - observedDistribution: number[]; -} -/** - * Quadrat analysis lays a set of equal-size areas(quadrat) over the study area and counts - * the number of features in each quadrat and creates a frequency table. - * The table lists the number of quadrats containing no features, - * the number containing one feature, two features, and so on, - * all the way up to the quadrat containing the most features. - * The method then creates the frequency table for the random distribution, usually based on a Poisson distribution. - * The method uses the distribution to calculate the probability for 0 feature occuring, - * 1 feature occuring, 2 features, and so on, - * and lists these probabilities in the frequency table. - * By comparing the two frequency tables, you can see whether the features create a pattern. - * If the table for the observed distribution has more quadrats containing many features than the - * table for the random distribution dose, then the features create a clustered pattern. - * - * It is hard to judge the frequency tables are similar or different just by looking at them. - * So, we can use serval statistical tests to find out how much the frequency tables differ. - * We use Kolmogorov-Smirnov test.This method calculates cumulative probabilities for both distributions, - * and then compares the cumulative probabilities at each class level and selects the largest absolute difference D. - * Then, the test compares D to the critical value for a confidence level you specify. - * If D is greater than the critical value, the difference between the observed distribution and - * the random distribution is significant. The greater the value the bigger the difference. - * - * Traditionally, squares are used for the shape of the quadrats, in a regular grid(square-grid). - * Some researchers suggest that the quadrat size equal twice the size of mean area per feature, - * which is simply the area of the study area divided by the number of features. - * - * - * @name quadratAnalysis - * @param {FeatureCollection} pointFeatureSet point set to study - * @param {Object} [options={}] optional parameters - * @param {bbox} [options.studyBbox] bbox representing the study area - * @param {number} [options.confidenceLevel=20] a confidence level. - * The unit is percentage . 5 means 95%, value must be in {@link K_TABLE} - * @returns {Object} result {@link QuadratAnalysisResult} - * @example - * - * var bbox = [-65, 40, -63, 42]; - * var dataset = turf.randomPoint(100, { bbox: bbox }); - * var result = turf.quadratAnalysis(dataset); - * - */ -export default function quadratAnalysis(pointFeatureSet: FeatureCollection, options: { - studyBbox?: [number, number, number, number]; - confidenceLevel?: 20 | 15 | 10 | 5 | 2 | 1; -}): QuadratAnalysisResult; diff --git a/packages/turf-quadrat-analysis/package.json b/packages/turf-quadrat-analysis/package.json index 4b8904c034..136c452949 100644 --- a/packages/turf-quadrat-analysis/package.json +++ b/packages/turf-quadrat-analysis/package.json @@ -2,18 +2,18 @@ "name": "@turf/quadrat-analysis", "version": "6.0.1", "description": "turf quadrat-analysis module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-quadrat-analysis/test.js b/packages/turf-quadrat-analysis/test.js index 21e681dc28..3c4cd21585 100644 --- a/packages/turf-quadrat-analysis/test.js +++ b/packages/turf-quadrat-analysis/test.js @@ -9,7 +9,7 @@ const squareGrid = require('@turf/square-grid').default; const bboxPolygon = require('@turf/bbox-polygon').default; const { randomPoint } = require('@turf/random'); const { featureCollection } = require('@turf/helpers'); -const quadratAnalysis = require('./').default; +const quadratAnalysis = require('./dist/js/index.js').default; test('turf-quadrat-analysis geojson file', t => { const futianBboxPath = path.join(__dirname, 'test', 'in', 'futian_bbox.json'); diff --git a/packages/turf-quadrat-analysis/tsconfig.json b/packages/turf-quadrat-analysis/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-quadrat-analysis/tsconfig.json +++ b/packages/turf-quadrat-analysis/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-random/.gitignore b/packages/turf-random/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-random/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-random/bench.js b/packages/turf-random/bench.js index aa0149c5c9..22becfc63b 100644 --- a/packages/turf-random/bench.js +++ b/packages/turf-random/bench.js @@ -1,4 +1,4 @@ -const random = require('./'); +const random = require('./dist/js/index.js'); const Benchmark = require('benchmark'); var suite = new Benchmark.Suite('turf-random'); diff --git a/packages/turf-random/index.d.ts b/packages/turf-random/index.d.ts deleted file mode 100644 index ed052ab98b..0000000000 --- a/packages/turf-random/index.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { BBox, FeatureCollection, LineString, Point, Polygon, Position } from "@turf/helpers"; -/** - * Returns a random position within a {@link bounding box}. - * - * @name randomPosition - * @param {Array} [bbox=[-180, -90, 180, 90]] a bounding box inside of which positions are placed. - * @returns {Array} Position [longitude, latitude] - * @example - * var position = turf.randomPosition([-180, -90, 180, 90]) - * // => position - */ -export declare function randomPosition(bbox?: BBox | { - bbox: BBox; -}): Position; -/** - * Returns a random {@link point}. - * - * @name randomPoint - * @param {number} [count=1] how many geometries will be generated - * @param {Object} [options={}] Optional parameters - * @param {Array} [options.bbox=[-180, -90, 180, 90]] a bounding box inside of which geometries are placed. - * @returns {FeatureCollection} GeoJSON FeatureCollection of points - * @example - * var points = turf.randomPoint(25, {bbox: [-180, -90, 180, 90]}) - * // => points - */ -export declare function randomPoint(count?: number, options?: { - bbox?: BBox; -}): FeatureCollection; -/** - * Returns a random {@link polygon}. - * - * @name randomPolygon - * @param {number} [count=1] how many geometries will be generated - * @param {Object} [options={}] Optional parameters - * @param {Array} [options.bbox=[-180, -90, 180, 90]] a bounding box inside of which geometries are placed. - * @param {number} [options.num_vertices=10] is how many coordinates each LineString will contain. - * @param {number} [options.max_radial_length=10] is the maximum number of decimal degrees latitude or longitude that a - * vertex can reach out of the center of the Polygon. - * @returns {FeatureCollection} GeoJSON FeatureCollection of polygons - * @example - * var polygons = turf.randomPolygon(25, {bbox: [-180, -90, 180, 90]}) - * // => polygons - */ -export declare function randomPolygon(count?: number, options?: { - bbox?: BBox; - num_vertices?: number; - max_radial_length?: number; -}): FeatureCollection; -/** - * Returns a random {@link linestring}. - * - * @name randomLineString - * @param {number} [count=1] how many geometries will be generated - * @param {Object} [options={}] Optional parameters - * @param {Array} [options.bbox=[-180, -90, 180, 90]] a bounding box inside of which geometries are placed. - * @param {number} [options.num_vertices=10] is how many coordinates each LineString will contain. - * @param {number} [options.max_length=0.0001] is the maximum number of decimal degrees that a - * vertex can be from its predecessor - * @param {number} [options.max_rotation=Math.PI / 8] is the maximum number of radians that a - * line segment can turn from the previous segment. - * @returns {FeatureCollection} GeoJSON FeatureCollection of linestrings - * @example - * var lineStrings = turf.randomLineString(25, {bbox: [-180, -90, 180, 90]}) - * // => lineStrings - */ -export declare function randomLineString(count?: number, options?: { - bbox?: BBox; - num_vertices?: number; - max_length?: number; - max_rotation?: number; -}): FeatureCollection; diff --git a/packages/turf-random/package.json b/packages/turf-random/package.json index 08cb4b17f8..76a219af1b 100644 --- a/packages/turf-random/package.json +++ b/packages/turf-random/package.json @@ -2,18 +2,18 @@ "name": "@turf/random", "version": "6.0.2", "description": "turf random module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-random/test.js b/packages/turf-random/test.js index ed420c4428..59f8616b59 100644 --- a/packages/turf-random/test.js +++ b/packages/turf-random/test.js @@ -4,7 +4,7 @@ const { randomLineString, randomPolygon, randomPosition -} = require('./'); +} = require('./dist/js/index.js'); test('random(points)', t => { var points = randomPoint(); diff --git a/packages/turf-random/tsconfig.json b/packages/turf-random/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-random/tsconfig.json +++ b/packages/turf-random/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-rectangle-grid/bench.js b/packages/turf-rectangle-grid/bench.js index 4fb4055436..58765291ca 100644 --- a/packages/turf-rectangle-grid/bench.js +++ b/packages/turf-rectangle-grid/bench.js @@ -1,6 +1,6 @@ const Benchmark = require('benchmark'); -const rectangleGrid = require('./').default; +const rectangleGrid = require('./dist/js/index.js').default; var bbox = [-95, 30, -85, 40]; diff --git a/packages/turf-rectangle-grid/index.d.ts b/packages/turf-rectangle-grid/index.d.ts deleted file mode 100644 index aa82fd9494..0000000000 --- a/packages/turf-rectangle-grid/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { BBox, Feature, FeatureCollection, MultiPolygon, Polygon, Properties, Units } from "@turf/helpers"; - -/** - * http://turfjs.org/docs/#rectanglegrid - */ - -export default function rectangleGrid

(bbox: BBox, cellWidth: number, cellHeight: number, options?: { - units?: Units; - properties?: P; - mask?: Feature | Polygon | MultiPolygon; -}): FeatureCollection; diff --git a/packages/turf-rectangle-grid/index.js b/packages/turf-rectangle-grid/index.js deleted file mode 100644 index 5498445234..0000000000 --- a/packages/turf-rectangle-grid/index.js +++ /dev/null @@ -1,77 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var boolean_intersects_1 = require("@turf/boolean-intersects"); -var distance_1 = require("@turf/distance"); -var helpers_1 = require("@turf/helpers"); -/** - * Creates a grid of rectangles from a bounding box, {@link Feature} or {@link FeatureCollection}. - * - * @name rectangleGrid - * @param {Array} bbox extent in [minX, minY, maxX, maxY] order - * @param {number} cellWidth of each cell, in units - * @param {number} cellHeight of each cell, in units - * @param {Object} [options={}] Optional parameters - * @param {string} [options.units='kilometers'] units ("degrees", "radians", "miles", "kilometers") that the given cellWidth - * and cellHeight are expressed in. Converted at the southern border. - * @param {Feature} [options.mask] if passed a Polygon or MultiPolygon, - * the grid Points will be created only inside it - * @param {Object} [options.properties={}] passed to each point of the grid - * @returns {FeatureCollection} a grid of polygons - * @example - * var bbox = [-95, 30 ,-85, 40]; - * var cellWidth = 50; - * var cellHeight = 20; - * var options = {units: 'miles'}; - * - * var rectangleGrid = turf.rectangleGrid(bbox, cellWidth, cellHeight, options); - * - * //addToMap - * var addToMap = [rectangleGrid] - */ -function rectangleGrid(bbox, cellWidth, cellHeight, options) { - if (options === void 0) { options = {}; } - // Containers - var results = []; - var west = bbox[0]; - var south = bbox[1]; - var east = bbox[2]; - var north = bbox[3]; - var xFraction = cellWidth / (distance_1.default([west, south], [east, south], options)); - var cellWidthDeg = xFraction * (east - west); - var yFraction = cellHeight / (distance_1.default([west, south], [west, north], options)); - var cellHeightDeg = yFraction * (north - south); - // rows & columns - var bboxWidth = (east - west); - var bboxHeight = (north - south); - var columns = Math.floor(bboxWidth / cellWidthDeg); - var rows = Math.floor(bboxHeight / cellHeightDeg); - // if the grid does not fill the bbox perfectly, center it. - var deltaX = (bboxWidth - columns * cellWidthDeg) / 2; - var deltaY = (bboxHeight - rows * cellHeightDeg) / 2; - // iterate over columns & rows - var currentX = west + deltaX; - for (var column = 0; column < columns; column++) { - var currentY = south + deltaY; - for (var row = 0; row < rows; row++) { - var cellPoly = helpers_1.polygon([[ - [currentX, currentY], - [currentX, currentY + cellHeightDeg], - [currentX + cellWidthDeg, currentY + cellHeightDeg], - [currentX + cellWidthDeg, currentY], - [currentX, currentY], - ]], options.properties); - if (options.mask) { - if (boolean_intersects_1.default(options.mask, cellPoly)) { - results.push(cellPoly); - } - } - else { - results.push(cellPoly); - } - currentY += cellHeightDeg; - } - currentX += cellWidthDeg; - } - return helpers_1.featureCollection(results); -} -exports.default = rectangleGrid; diff --git a/packages/turf-rectangle-grid/package.json b/packages/turf-rectangle-grid/package.json index ac474ca8da..8d95450d56 100644 --- a/packages/turf-rectangle-grid/package.json +++ b/packages/turf-rectangle-grid/package.json @@ -2,18 +2,18 @@ "name": "@turf/rectangle-grid", "version": "6.0.2", "description": "turf rectangle-grid module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-rectangle-grid/test.js b/packages/turf-rectangle-grid/test.js index 53871707aa..839871c87f 100644 --- a/packages/turf-rectangle-grid/test.js +++ b/packages/turf-rectangle-grid/test.js @@ -6,7 +6,7 @@ const load = require('load-json-file'); const write = require('write-json-file'); const bboxPoly = require('@turf/bbox-polygon').default; const truncate = require('@turf/truncate').default; -const rectangleGrid = require('./').default; +const rectangleGrid = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-rectangle-grid/tsconfig.json b/packages/turf-rectangle-grid/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-rectangle-grid/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-rewind/package.json b/packages/turf-rewind/package.json index 34719a8c40..97938ecbf7 100644 --- a/packages/turf-rewind/package.json +++ b/packages/turf-rewind/package.json @@ -13,7 +13,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-rhumb-bearing/.gitignore b/packages/turf-rhumb-bearing/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-rhumb-bearing/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-rhumb-bearing/bench.js b/packages/turf-rhumb-bearing/bench.js index 256b7990e7..220cedb255 100644 --- a/packages/turf-rhumb-bearing/bench.js +++ b/packages/turf-rhumb-bearing/bench.js @@ -1,6 +1,6 @@ const { point } = require('@turf/helpers'); const Benchmark = require('benchmark'); -const rhumbBearing = require('./').default; +const rhumbBearing = require('./dist/js/index.js').default; var start = point([-75.4, 39.4]); var end = point([-75.534, 39.123]); diff --git a/packages/turf-rhumb-bearing/index.d.ts b/packages/turf-rhumb-bearing/index.d.ts deleted file mode 100644 index ae44400c62..0000000000 --- a/packages/turf-rhumb-bearing/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Coord } from "@turf/helpers"; -/** - * Takes two {@link Point|points} and finds the bearing angle between them along a Rhumb line - * i.e. the angle measured in degrees start the north line (0 degrees) - * - * @name rhumbBearing - * @param {Coord} start starting Point - * @param {Coord} end ending Point - * @param {Object} [options] Optional parameters - * @param {boolean} [options.final=false] calculates the final bearing if true - * @returns {number} bearing from north in decimal degrees, between -180 and 180 degrees (positive clockwise) - * @example - * var point1 = turf.point([-75.343, 39.984], {"marker-color": "#F00"}); - * var point2 = turf.point([-75.534, 39.123], {"marker-color": "#00F"}); - * - * var bearing = turf.rhumbBearing(point1, point2); - * - * //addToMap - * var addToMap = [point1, point2]; - * point1.properties.bearing = bearing; - * point2.properties.bearing = bearing; - */ -declare function rhumbBearing(start: Coord, end: Coord, options?: { - final?: boolean; -}): number; -export default rhumbBearing; diff --git a/packages/turf-rhumb-bearing/package.json b/packages/turf-rhumb-bearing/package.json index 05d4dab2b5..88b622a6b6 100644 --- a/packages/turf-rhumb-bearing/package.json +++ b/packages/turf-rhumb-bearing/package.json @@ -2,18 +2,18 @@ "name": "@turf/rhumb-bearing", "version": "6.0.1", "description": "turf rhumb-bearing module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-rhumb-bearing/test.js b/packages/turf-rhumb-bearing/test.js index 35672c2a43..828c158561 100644 --- a/packages/turf-rhumb-bearing/test.js +++ b/packages/turf-rhumb-bearing/test.js @@ -4,7 +4,7 @@ const test = require('tape'); const load = require('load-json-file'); const write = require('write-json-file'); const { point } = require('@turf/helpers'); -const rhumbBearing = require('.').default; +const rhumbBearing = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-rhumb-bearing/tsconfig.json b/packages/turf-rhumb-bearing/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-rhumb-bearing/tsconfig.json +++ b/packages/turf-rhumb-bearing/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-rhumb-destination/.gitignore b/packages/turf-rhumb-destination/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-rhumb-destination/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-rhumb-destination/bench.js b/packages/turf-rhumb-destination/bench.js index cab3c0259e..776762c3f6 100644 --- a/packages/turf-rhumb-destination/bench.js +++ b/packages/turf-rhumb-destination/bench.js @@ -1,6 +1,6 @@ import { point } from '@turf/helpers'; import Benchmark from 'benchmark'; -import destination from './'; +import destination from './dist/js/index.js'; const pt1 = point([-75.0, 39.0]); const distance = 100; diff --git a/packages/turf-rhumb-destination/index.d.ts b/packages/turf-rhumb-destination/index.d.ts deleted file mode 100644 index 437adf7f5b..0000000000 --- a/packages/turf-rhumb-destination/index.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Coord, Feature, Point, Properties, Units } from "@turf/helpers"; -/** - * Returns the destination {@link Point} having travelled the given distance along a Rhumb line from the - * origin Point with the (varant) given bearing. - * - * @name rhumbDestination - * @param {Coord} origin starting point - * @param {number} distance distance from the starting point - * @param {number} bearing varant bearing angle ranging from -180 to 180 degrees from north - * @param {Object} [options={}] Optional parameters - * @param {string} [options.units='kilometers'] can be degrees, radians, miles, or kilometers - * @param {Object} [options.properties={}] translate properties to destination point - * @returns {Feature} Destination point. - * @example - * var pt = turf.point([-75.343, 39.984], {"marker-color": "F00"}); - * var distance = 50; - * var bearing = 90; - * var options = {units: 'miles'}; - * - * var destination = turf.rhumbDestination(pt, distance, bearing, options); - * - * //addToMap - * var addToMap = [pt, destination] - * destination.properties['marker-color'] = '#00F'; - */ -declare function rhumbDestination

(origin: Coord, distance: number, bearing: number, options?: { - units?: Units; - properties?: P; -}): Feature; -export default rhumbDestination; diff --git a/packages/turf-rhumb-destination/package.json b/packages/turf-rhumb-destination/package.json index 655f6d4845..d651935dfc 100644 --- a/packages/turf-rhumb-destination/package.json +++ b/packages/turf-rhumb-destination/package.json @@ -2,18 +2,18 @@ "name": "@turf/rhumb-destination", "version": "6.0.3", "description": "turf rhumb-destination module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-rhumb-destination/test.js b/packages/turf-rhumb-destination/test.js index 1ccf97ce50..74037994fb 100644 --- a/packages/turf-rhumb-destination/test.js +++ b/packages/turf-rhumb-destination/test.js @@ -6,7 +6,7 @@ const load = require('load-json-file'); const truncate = require('@turf/truncate').default; const { getCoords } = require('@turf/invariant'); const { featureCollection, lineString, point } = require('@turf/helpers'); -const rhumbDestination = require('./').default; +const rhumbDestination = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-rhumb-destination/tsconfig.json b/packages/turf-rhumb-destination/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-rhumb-destination/tsconfig.json +++ b/packages/turf-rhumb-destination/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-rhumb-distance/.gitignore b/packages/turf-rhumb-distance/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-rhumb-distance/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-rhumb-distance/bench.js b/packages/turf-rhumb-distance/bench.js index 0945f18be0..a51611a5f9 100644 --- a/packages/turf-rhumb-distance/bench.js +++ b/packages/turf-rhumb-distance/bench.js @@ -1,6 +1,6 @@ const { point } = require('@turf/helpers'); const Benchmark = require('benchmark'); -const distance = require('./').default; +const distance = require('./dist/js/index.js').default; const pt1 = point([-75.4, 39.4]); const pt2 = point([-75.534, 39.123]); diff --git a/packages/turf-rhumb-distance/index.d.ts b/packages/turf-rhumb-distance/index.d.ts deleted file mode 100644 index 2395a8b9aa..0000000000 --- a/packages/turf-rhumb-distance/index.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Coord, Units } from "@turf/helpers"; -/** - * Calculates the distance along a rhumb line between two {@link Point|points} in degrees, radians, - * miles, or kilometers. - * - * @name rhumbDistance - * @param {Coord} from origin point - * @param {Coord} to destination point - * @param {Object} [options] Optional parameters - * @param {string} [options.units="kilometers"] can be degrees, radians, miles, or kilometers - * @returns {number} distance between the two points - * @example - * var from = turf.point([-75.343, 39.984]); - * var to = turf.point([-75.534, 39.123]); - * var options = {units: 'miles'}; - * - * var distance = turf.rhumbDistance(from, to, options); - * - * //addToMap - * var addToMap = [from, to]; - * from.properties.distance = distance; - * to.properties.distance = distance; - */ -declare function rhumbDistance(from: Coord, to: Coord, options?: { - units?: Units; -}): number; -export default rhumbDistance; diff --git a/packages/turf-rhumb-distance/package.json b/packages/turf-rhumb-distance/package.json index 3c442c323f..15c3865924 100644 --- a/packages/turf-rhumb-distance/package.json +++ b/packages/turf-rhumb-distance/package.json @@ -2,18 +2,18 @@ "name": "@turf/rhumb-distance", "version": "6.0.1", "description": "turf rhumb-distance module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-rhumb-distance/test.js b/packages/turf-rhumb-distance/test.js index e485b6c344..06900a22aa 100644 --- a/packages/turf-rhumb-distance/test.js +++ b/packages/turf-rhumb-distance/test.js @@ -5,7 +5,7 @@ const load = require('load-json-file'); const write = require('write-json-file'); const distance = require('@turf/distance').default; const { point, round } = require('@turf/helpers'); -const rhumbDistance = require('./').default; +const rhumbDistance = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-rhumb-distance/tsconfig.json b/packages/turf-rhumb-distance/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-rhumb-distance/tsconfig.json +++ b/packages/turf-rhumb-distance/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-sector/package.json b/packages/turf-sector/package.json index 0c5cc0ca5c..5ea6d55b97 100644 --- a/packages/turf-sector/package.json +++ b/packages/turf-sector/package.json @@ -13,7 +13,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-shortest-path/package.json b/packages/turf-shortest-path/package.json index 6cbe6ab8a9..41b13affd6 100644 --- a/packages/turf-shortest-path/package.json +++ b/packages/turf-shortest-path/package.json @@ -14,7 +14,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-simplify/package.json b/packages/turf-simplify/package.json index 8d320d8a93..001461d2c4 100644 --- a/packages/turf-simplify/package.json +++ b/packages/turf-simplify/package.json @@ -14,7 +14,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-square-grid/.gitignore b/packages/turf-square-grid/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-square-grid/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-square-grid/bench.js b/packages/turf-square-grid/bench.js index 8fcf6e7e1c..0399c96a0f 100644 --- a/packages/turf-square-grid/bench.js +++ b/packages/turf-square-grid/bench.js @@ -1,5 +1,5 @@ const Benchmark = require('benchmark'); -const squareGrid = require('./').default; +const squareGrid = require('./dist/js/index.js').default; var bbox = [-95, 30, -85, 40]; diff --git a/packages/turf-square-grid/index.d.ts b/packages/turf-square-grid/index.d.ts deleted file mode 100644 index 6df84574e3..0000000000 --- a/packages/turf-square-grid/index.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { FeatureCollection, Polygon, BBox, Units, Feature, MultiPolygon, Properties } from "@turf/helpers"; -/** - * Creates a square grid from a bounding box, {@link Feature} or {@link FeatureCollection}. - * - * @name squareGrid - * @param {Array} bbox extent in [minX, minY, maxX, maxY] order - * @param {number} cellSide of each cell, in units - * @param {Object} [options={}] Optional parameters - * @param {string} [options.units='kilometers'] used in calculating cellSide, can be degrees, - * radians, miles, or kilometers - * @param {Feature} [options.mask] if passed a Polygon or MultiPolygon, - * the grid Points will be created only inside it - * @param {Object} [options.properties={}] passed to each point of the grid - * @returns {FeatureCollection} grid a grid of polygons - * @example - * var bbox = [-95, 30 ,-85, 40]; - * var cellSide = 50; - * var options = {units: 'miles'}; - * - * var squareGrid = turf.squareGrid(bbox, cellSide, options); - * - * //addToMap - * var addToMap = [squareGrid] - */ -export default function squareGrid

(bbox: BBox, cellSide: number, options?: { - units?: Units; - properties?: P; - mask?: Feature | Polygon | MultiPolygon; -}): FeatureCollection; diff --git a/packages/turf-square-grid/package.json b/packages/turf-square-grid/package.json index 3d4098c82b..4d207796a5 100644 --- a/packages/turf-square-grid/package.json +++ b/packages/turf-square-grid/package.json @@ -2,18 +2,18 @@ "name": "@turf/square-grid", "version": "6.0.2", "description": "turf square-grid module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-square-grid/test.js b/packages/turf-square-grid/test.js index eedd63e2ed..6530061e2b 100644 --- a/packages/turf-square-grid/test.js +++ b/packages/turf-square-grid/test.js @@ -5,7 +5,7 @@ const load = require('load-json-file'); const write = require('write-json-file'); const bboxPoly = require('@turf/bbox-polygon').default; const truncate = require('@turf/truncate').default; -const squareGrid = require('./').default; +const squareGrid = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-square-grid/tsconfig.json b/packages/turf-square-grid/tsconfig.json index 230fe2dd4f..c3f78e4c94 100644 --- a/packages/turf-square-grid/tsconfig.json +++ b/packages/turf-square-grid/tsconfig.json @@ -1,14 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-standard-deviational-ellipse/package.json b/packages/turf-standard-deviational-ellipse/package.json index 0493d72c08..793c31459f 100644 --- a/packages/turf-standard-deviational-ellipse/package.json +++ b/packages/turf-standard-deviational-ellipse/package.json @@ -13,7 +13,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-tin/.gitignore b/packages/turf-tin/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-tin/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-tin/bench.js b/packages/turf-tin/bench.js index 4cf02d4b29..bc25c6f984 100644 --- a/packages/turf-tin/bench.js +++ b/packages/turf-tin/bench.js @@ -1,7 +1,7 @@ const fs = require('fs'); const path = require('path'); const Benchmark = require('benchmark'); -const tin = require('./').default; +const tin = require('./dist/js/index.js').default; const points = JSON.parse(fs.readFileSync(path.join(__dirname, 'test', 'Points.json'))); diff --git a/packages/turf-tin/index.d.ts b/packages/turf-tin/index.d.ts deleted file mode 100644 index 8f450f75dc..0000000000 --- a/packages/turf-tin/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { FeatureCollection, Point, Polygon } from "@turf/helpers"; -export interface Pt { - x: number; - y: number; - z?: number; - __sentinel?: boolean; -} -export interface Vertice { - x: number; - y: number; -} -/** - * Takes a set of {@link Point|points} and creates a - * [Triangulated Irregular Network](http://en.wikipedia.org/wiki/Triangulated_irregular_network), - * or a TIN for short, returned as a collection of Polygons. These are often used - * for developing elevation contour maps or stepped heat visualizations. - * - * If an optional z-value property is provided then it is added as properties called `a`, `b`, - * and `c` representing its value at each of the points that represent the corners of the - * triangle. - * - * @name tin - * @param {FeatureCollection} points input points - * @param {String} [z] name of the property from which to pull z values - * This is optional: if not given, then there will be no extra data added to the derived triangles. - * @returns {FeatureCollection} TIN output - * @example - * // generate some random point data - * var points = turf.randomPoint(30, {bbox: [50, 30, 70, 50]}); - * - * // add a random property to each point between 0 and 9 - * for (var i = 0; i < points.features.length; i++) { - * points.features[i].properties.z = ~~(Math.random() * 9); - * } - * var tin = turf.tin(points, 'z'); - * - * //addToMap - * var addToMap = [tin, points] - * for (var i = 0; i < tin.features.length; i++) { - * var properties = tin.features[i].properties; - * properties.fill = '#' + properties.a + properties.b + properties.c; - * } - */ -export default function tin(points: FeatureCollection, z?: string): FeatureCollection; diff --git a/packages/turf-tin/package.json b/packages/turf-tin/package.json index d0711e451c..de05babe2d 100644 --- a/packages/turf-tin/package.json +++ b/packages/turf-tin/package.json @@ -2,18 +2,20 @@ "name": "@turf/tin", "version": "6.0.2", "description": "turf tin module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-tin/test.js b/packages/turf-tin/test.js index 049dd8126f..ff3401106f 100644 --- a/packages/turf-tin/test.js +++ b/packages/turf-tin/test.js @@ -1,7 +1,7 @@ const fs = require('fs'); const path = require('path'); const test = require('tape'); -const tin = require('./').default; +const tin = require('./dist/js/index.js').default; const points = require(path.join(__dirname, 'test', 'Points.json')); diff --git a/packages/turf-tin/tsconfig.json b/packages/turf-tin/tsconfig.json index 91cffcbf55..c3f78e4c94 100644 --- a/packages/turf-tin/tsconfig.json +++ b/packages/turf-tin/tsconfig.json @@ -1,17 +1,7 @@ { - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Module Resolution Options */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - }, - "files": [ - "index.ts" - ] -} \ No newline at end of file + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-tin/types.ts b/packages/turf-tin/types.ts index 85f4144740..52a62d4be4 100644 --- a/packages/turf-tin/types.ts +++ b/packages/turf-tin/types.ts @@ -1,5 +1,5 @@ import {featureCollection, point} from "@turf/helpers"; -import tin from "./"; +import tin from "./dist/js/index"; const points = featureCollection([ point([0, 0], {elevation: 20}), diff --git a/packages/turf-transform-rotate/package.json b/packages/turf-transform-rotate/package.json index 5d46924480..e0af1fac49 100644 --- a/packages/turf-transform-rotate/package.json +++ b/packages/turf-transform-rotate/package.json @@ -13,7 +13,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-transform-scale/package.json b/packages/turf-transform-scale/package.json index 5f94651f1e..0f2f293cf1 100644 --- a/packages/turf-transform-scale/package.json +++ b/packages/turf-transform-scale/package.json @@ -13,7 +13,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-transform-translate/package.json b/packages/turf-transform-translate/package.json index 5750d5d7f6..2272781c7c 100644 --- a/packages/turf-transform-translate/package.json +++ b/packages/turf-transform-translate/package.json @@ -13,7 +13,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf-triangle-grid/.gitignore b/packages/turf-triangle-grid/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-triangle-grid/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-triangle-grid/bench.js b/packages/turf-triangle-grid/bench.js index 01bee3a0b0..a709516f32 100644 --- a/packages/turf-triangle-grid/bench.js +++ b/packages/turf-triangle-grid/bench.js @@ -1,6 +1,6 @@ import fs from 'fs'; import Benchmark from 'benchmark'; -import grid from './'; +import grid from './dist/js/index.js'; var bbox1 = [ -96.6357421875, diff --git a/packages/turf-triangle-grid/package.json b/packages/turf-triangle-grid/package.json index 916f8cacb7..9d1ffbf8c4 100644 --- a/packages/turf-triangle-grid/package.json +++ b/packages/turf-triangle-grid/package.json @@ -2,18 +2,20 @@ "name": "@turf/triangle-grid", "version": "6.0.1", "description": "turf triangle-grid module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-triangle-grid/test.js b/packages/turf-triangle-grid/test.js index 7939e0d68c..7ae8547546 100644 --- a/packages/turf-triangle-grid/test.js +++ b/packages/turf-triangle-grid/test.js @@ -5,7 +5,7 @@ const load = require('load-json-file'); const write = require('write-json-file'); const bboxPoly = require('@turf/bbox-polygon').default; const truncate = require('@turf/truncate').default; -const triangleGrid = require('./').default; +const triangleGrid = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-triangle-grid/tsconfig.json b/packages/turf-triangle-grid/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-triangle-grid/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-triangle-grid/types.ts b/packages/turf-triangle-grid/types.ts index 44918de465..4c1f8fb74a 100644 --- a/packages/turf-triangle-grid/types.ts +++ b/packages/turf-triangle-grid/types.ts @@ -1,5 +1,5 @@ import { BBox, Polygon, FeatureCollection } from '@turf/helpers' -import triangleGrid from './' +import triangleGrid from './dist/js/index' const bbox: BBox = [ -96.6357421875, diff --git a/packages/turf-truncate/.gitignore b/packages/turf-truncate/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-truncate/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-truncate/bench.js b/packages/turf-truncate/bench.js index c5c33d5212..47ad551ae8 100644 --- a/packages/turf-truncate/bench.js +++ b/packages/turf-truncate/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const truncate = require('./').default; +const truncate = require('./dist/js/index.js').default; const directory = path.join(__dirname, 'test', 'in') + path.sep; let fixtures = fs.readdirSync(directory).map(filename => { diff --git a/packages/turf-truncate/package.json b/packages/turf-truncate/package.json index 01426f11fe..ad41eab14a 100644 --- a/packages/turf-truncate/package.json +++ b/packages/turf-truncate/package.json @@ -2,18 +2,20 @@ "name": "@turf/truncate", "version": "6.0.1", "description": "turf truncate module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-truncate/test.js b/packages/turf-truncate/test.js index c33dfeb29a..4496645df7 100644 --- a/packages/turf-truncate/test.js +++ b/packages/turf-truncate/test.js @@ -4,7 +4,7 @@ const path = require('path'); const load = require('load-json-file'); const write = require('write-json-file'); const { point } = require('@turf/helpers'); -const truncate = require('./').default; +const truncate = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-truncate/tsconfig.json b/packages/turf-truncate/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-truncate/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-truncate/types.ts b/packages/turf-truncate/types.ts index 02982c84e9..80d890cb48 100644 --- a/packages/turf-truncate/types.ts +++ b/packages/turf-truncate/types.ts @@ -1,5 +1,5 @@ import { featureCollection, point, lineString, geometryCollection } from '@turf/helpers' -import truncate from './' +import truncate from './dist/js/index' const pt = point([120.1234567, 40.1234567]) const ptGeom = pt.geometry diff --git a/packages/turf-union/.gitignore b/packages/turf-union/.gitignore deleted file mode 100644 index 945ce43a90..0000000000 --- a/packages/turf-union/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.js \ No newline at end of file diff --git a/packages/turf-union/bench.js b/packages/turf-union/bench.js index 805b71aea5..88e084f086 100644 --- a/packages/turf-union/bench.js +++ b/packages/turf-union/bench.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const load = require('load-json-file'); const Benchmark = require('benchmark'); -const union = require('./').default; +const union = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-union/package.json b/packages/turf-union/package.json index c1cf8cdd58..86f99f4b21 100644 --- a/packages/turf-union/package.json +++ b/packages/turf-union/package.json @@ -2,18 +2,20 @@ "name": "@turf/union", "version": "6.0.2", "description": "turf union module", - "main": "index", - "types": "index.d.ts", + "main": "dist/js/index.js", + "types": "dist/js/index.d.ts", "files": [ - "index.js", - "index.d.ts" + "dist" ], "scripts": { "prepare": "tsc", "pretest": "tsc", - "test": "node test.js", - "bench": "node bench.js", - "docs": "node ../../scripts/generate-readmes" + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", + "bench": "npm-run-all prepare bench:run", + "docs": "node ../../scripts/generate-readmes", + "bench:run": "node bench.js" }, "repository": { "type": "git", diff --git a/packages/turf-union/test.js b/packages/turf-union/test.js index 4413dcd87a..7bb8609150 100644 --- a/packages/turf-union/test.js +++ b/packages/turf-union/test.js @@ -4,7 +4,7 @@ const test = require('tape'); const load = require('load-json-file'); const write = require('write-json-file'); const combine = require('@turf/combine').default; -const union = require('./').default; +const union = require('./dist/js/index.js').default; const directories = { in: path.join(__dirname, 'test', 'in') + path.sep, diff --git a/packages/turf-union/tsconfig.json b/packages/turf-union/tsconfig.json new file mode 100644 index 0000000000..c3f78e4c94 --- /dev/null +++ b/packages/turf-union/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "outDir": "dist/js" + }, + "files": ["index.ts"] +} diff --git a/packages/turf-union/types.ts b/packages/turf-union/types.ts index dd52154de7..b3a9b06945 100644 --- a/packages/turf-union/types.ts +++ b/packages/turf-union/types.ts @@ -1,5 +1,5 @@ import { polygon } from '@turf/helpers'; -import union from './'; +import union from './dist/js/index'; const poly1 = polygon([[[0, 0], [10, 10], [20, 20], [0, 0]]]); const poly2 = polygon([[[20, 30], [10, 10], [20, 20], [20, 30]]]); diff --git a/packages/turf-unkink-polygon/package.json b/packages/turf-unkink-polygon/package.json index 26bd46ee49..2fd8fbc175 100644 --- a/packages/turf-unkink-polygon/package.json +++ b/packages/turf-unkink-polygon/package.json @@ -14,7 +14,9 @@ ], "scripts": { "pretest": "rollup -c ../../rollup.config.js", - "test": "node -r esm test.js", + "test": "npm-run-all test:tape test:types", + "test:tape": "node -r esm test.js", + "test:types": "tsc --noEmit types.ts", "posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", "bench": "node -r esm bench.js", "docs": "node ../../scripts/generate-readmes" diff --git a/packages/turf/package.json b/packages/turf/package.json index 8e80959c8d..73ea3c2aa0 100644 --- a/packages/turf/package.json +++ b/packages/turf/package.json @@ -2,7 +2,7 @@ "name": "@turf/turf", "version": "6.0.0", "description": "a JavaScript library for performing geospatial operations with GeoJSON", - "main": "turf", + "main": "index.js", "module": "turf.mjs", "browser": "turf.min.js", "types": "index.d.ts", @@ -17,8 +17,10 @@ "scripts": { "prepare": "rollup -c rollup.config.js", "pretest": "rollup -f cjs -o index.js index.mjs", - "test": "node test.js", - "posttest": "node test.example.js" + "test": "echo '@turf/turf tests run in the last-checks step'", + "last-checks": "npm-run-all last-checks:testjs last-checks:example", + "last-checks:testjs": "node test.js", + "last-checks:example": "node test.example.js" }, "repository": { "type": "git", diff --git a/packages/turf/test.js b/packages/turf/test.js index b1eb6e97a9..e6445015b3 100644 --- a/packages/turf/test.js +++ b/packages/turf/test.js @@ -12,11 +12,18 @@ let modules = []; for (const name of fs.readdirSync(directory)) { if (!name.includes('turf')) continue; const pckgPath = path.join(directory, name, 'package.json'); - const index = fs.readFileSync(path.join(directory, name, 'index.js'), 'utf8'); - const test = fs.readFileSync(path.join(directory, name, 'index.js'), 'utf8'); if (!fs.existsSync(pckgPath)) continue; const pckg = JSON.parse(fs.readFileSync(pckgPath)); + + let mainFile = path.join(directory, name, pckg.main); + if (!fs.existsSync(mainFile)) { + mainFile += ".js"; + } + + const index = fs.readFileSync(mainFile, 'utf8'); + const test = fs.readFileSync(path.join(directory, name, 'test.js'), 'utf8'); + modules.push({ name, pckg, @@ -159,9 +166,7 @@ test('turf -- pre-defined attributes in package.json', t => { }); test('turf -- parsing dependencies from index.js', t => { - for (const {name, dir, dependencies} of modules) { - const index = fs.readFileSync(path.join(dir, 'index.js'), 'utf8'); - + for (const {name, dependencies, index} of modules) { // Read Depedencies from index.js const dependenciesUsed = new Set(); for (const dependency of index.match(/(require\(|from )'[@/a-z-\d]+'/gi) || []) { diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index f6a750b58a..0000000000 --- a/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es5", - "moduleResolution": "node", - }, - "exclude": [ - "node_modules", - "packages/*/node_modules", - "packages/turf-convex/index.ts", - "packages/turf-nearest-point-to-line/index.ts" - ] -} diff --git a/tsconfig.shared.json b/tsconfig.shared.json new file mode 100644 index 0000000000..2b631d7a33 --- /dev/null +++ b/tsconfig.shared.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "declaration": true, + "esModuleInterop": true, + "strict": false + } +} diff --git a/yarn.lock b/yarn.lock index f2d090323a..54887e6e88 100644 --- a/yarn.lock +++ b/yarn.lock @@ -82,13 +82,6 @@ "@turf/destination" "^5.1.5" "@turf/helpers" "^5.1.5" -"@turf/clean-coords@6.0.0": - version "6.0.0" - resolved "https://registry.yarnpkg.com/@turf/clean-coords/-/clean-coords-6.0.0.tgz#edac2b00dcbfd61c42dd035bfd5f21075c887565" - dependencies: - "@turf/helpers" "6.x" - "@turf/invariant" "6.x" - "@turf/clean-coords@^5.1.5": version "5.1.5" resolved "https://registry.yarnpkg.com/@turf/clean-coords/-/clean-coords-5.1.5.tgz#12800a98a78c9a452a72ec428493c43acf2ada1f" @@ -409,6 +402,13 @@ ansi-styles@^3.2.0: dependencies: color-convert "^1.9.0" +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0= + dependencies: + color-convert "^1.9.0" + ansi-styles@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-1.0.0.tgz#cb102df1c56f5123eab8b67cd7b98027a0279178" @@ -1477,6 +1477,15 @@ chalk@^2.0.0, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1: escape-string-regexp "^1.0.5" supports-color "^5.2.0" +chalk@^2.4.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha1-zUJUFnelQzPPVBpJEIwUMrRMlCQ= + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + chalk@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-0.4.0.tgz#5199a3ddcd0c1efe23bc08c1b027b06176e0c64f" @@ -1910,6 +1919,17 @@ cross-spawn@^5.0.1, cross-spawn@^5.1.0: shebang-command "^1.2.0" which "^1.2.9" +cross-spawn@^6.0.5: + version "6.0.5" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + integrity sha1-Sl7Hxk364iw6FBJNus3uhG2Ay8Q= + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + cryptiles@2.x.x: version "2.0.5" resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" @@ -2021,6 +2041,13 @@ define-properties@^1.1.2: foreach "^2.0.5" object-keys "^1.0.8" +define-properties@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + integrity sha1-z4jabL7ib+bbcJT2HYcMvYTO6fE= + dependencies: + object-keys "^1.0.12" + define-property@^0.2.5: version "0.2.5" resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" @@ -2241,6 +2268,23 @@ error@^7.0.0: string-template "~0.2.1" xtend "~4.0.0" +es-abstract@^1.17.0-next.1: + version "1.17.4" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.4.tgz#e3aedf19706b20e7c2594c35fc0d57605a79e184" + integrity sha1-467fGXBrIOfCWUw1/A1XYFp54YQ= + dependencies: + es-to-primitive "^1.2.1" + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.1" + is-callable "^1.1.5" + is-regex "^1.0.5" + object-inspect "^1.7.0" + object-keys "^1.1.1" + object.assign "^4.1.0" + string.prototype.trimleft "^2.1.1" + string.prototype.trimright "^2.1.1" + es-abstract@^1.5.0: version "1.10.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.10.0.tgz#1ecb36c197842a00d8ee4c2dfd8646bb97d60864" @@ -2259,6 +2303,15 @@ es-to-primitive@^1.1.1: is-date-object "^1.0.1" is-symbol "^1.0.1" +es-to-primitive@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" + integrity sha1-5VzUyc3BiLzvsDs2bHNjI/xciYo= + dependencies: + is-callable "^1.1.4" + is-date-object "^1.0.1" + is-symbol "^1.0.2" + escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -2938,6 +2991,11 @@ has-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" +has-symbols@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" + integrity sha1-n1IUdYpEGWxAbZvXbOv4HsLdMeg= + has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" @@ -2975,6 +3033,13 @@ has@^1.0.1, has@~1.0.1: dependencies: function-bind "^1.0.2" +has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha1-ci18v8H2qoJB8W3YFOAR4fQeh5Y= + dependencies: + function-bind "^1.1.1" + hast-util-is-element@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/hast-util-is-element/-/hast-util-is-element-1.0.0.tgz#3f7216978b2ae14d98749878782675f33be3ce00" @@ -3199,6 +3264,11 @@ is-callable@^1.1.1, is-callable@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2" +is-callable@^1.1.4, is-callable@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.5.tgz#f7e46b596890456db74e7f6e976cb3273d06faab" + integrity sha1-9+RrWWiQRW23Tn9ul2yzJz0G+qs= + is-ci@^1.0.10: version "1.1.0" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.1.0.tgz#247e4162e7860cebbdaf30b774d6b0ac7dcfe7a5" @@ -3389,6 +3459,13 @@ is-regex@^1.0.4: dependencies: has "^1.0.1" +is-regex@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.5.tgz#39d589a358bf18967f726967120b8fc1aed74eae" + integrity sha1-OdWJo1i/GJZ/cmlnEguPwa7XTq4= + dependencies: + has "^1.0.3" + is-relative@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-relative/-/is-relative-1.0.0.tgz#a1bb6935ce8c5dba1e8b9754b9b2dcc020e2260d" @@ -3421,6 +3498,13 @@ is-symbol@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572" +is-symbol@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" + integrity sha1-OOEBS55jKb4N6dJKQU/XRB7GGTc= + dependencies: + has-symbols "^1.0.1" + is-text-path@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-text-path/-/is-text-path-1.0.1.tgz#4e1aa0fb51bfbcb3e92688001397202c1775b66e" @@ -3892,6 +3976,11 @@ mem@^1.1.0: dependencies: mimic-fn "^1.0.0" +memorystream@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" + integrity sha1-htcJCzDORV1j+64S3aUaR93K+bI= + meow@*: version "4.0.0" resolved "https://registry.yarnpkg.com/meow/-/meow-4.0.0.tgz#fd5855dd008db5b92c552082db1c307cba20b29d" @@ -4090,6 +4179,11 @@ natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha1-ozeKdpbOfSI+iPybdkvX7xCJ42Y= + node-fetch@1.6.3: version "1.6.3" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.6.3.tgz#dc234edd6489982d58e8f0db4f695029abcd8c04" @@ -4148,6 +4242,21 @@ now-and-later@^2.0.0: dependencies: once "^1.3.2" +npm-run-all@^4.1.5: + version "4.1.5" + resolved "https://registry.yarnpkg.com/npm-run-all/-/npm-run-all-4.1.5.tgz#04476202a15ee0e2e214080861bff12a51d98fba" + integrity sha1-BEdiAqFe4OLiFAgIYb/xKlHZj7o= + dependencies: + ansi-styles "^3.2.1" + chalk "^2.4.1" + cross-spawn "^6.0.5" + memorystream "^0.3.1" + minimatch "^3.0.4" + pidtree "^0.3.0" + read-pkg "^3.0.0" + shell-quote "^1.6.1" + string.prototype.padend "^3.0.0" + npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" @@ -4183,6 +4292,11 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" +object-inspect@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67" + integrity sha1-9Pa9GBrXfwBrXs5gvQtvOY/3Smc= + object-inspect@~1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.3.0.tgz#5b1eb8e6742e2ee83342a637034d844928ba2f6d" @@ -4191,13 +4305,18 @@ object-keys@^1.0.11, object-keys@^1.0.8: version "1.0.11" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d" +object-keys@^1.0.12, object-keys@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha1-HEfyct8nfzsdrwYWd9nILiMixg4= + object-visit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" dependencies: isobject "^3.0.0" -object.assign@^4.0.4: +object.assign@^4.0.4, object.assign@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" dependencies: @@ -4415,7 +4534,7 @@ path-is-inside@^1.0.1, path-is-inside@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" -path-key@^2.0.0: +path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" @@ -4461,6 +4580,11 @@ performance-now@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" +pidtree@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.3.0.tgz#f6fada10fccc9f99bf50e90d0b23d72c9ebc2e6b" + integrity sha1-9vraEPzMn5m/UOkNCyPXLJ68Lms= + pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -5139,6 +5263,11 @@ safe-json-parse@~1.0.1: version "5.5.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" +semver@^5.5.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha1-qVT5Ma66UI0we78Gnv8MAclhFvc= + set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -5181,6 +5310,11 @@ shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" +shell-quote@^1.6.1: + version "1.7.2" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2" + integrity sha1-Z6fQLHbJ2iT5nSCAj8re0ODgS+I= + shelljs@^0.8.1: version "0.8.1" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.1.tgz#729e038c413a2254c4078b95ed46e0397154a9f1" @@ -5387,6 +5521,14 @@ string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" +string.prototype.padend@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string.prototype.padend/-/string.prototype.padend-3.1.0.tgz#dc08f57a8010dc5c153550318f67e13adbb72ac3" + integrity sha1-3Aj1eoAQ3FwVNVAxj2fhOtu3KsM= + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.0-next.1" + string.prototype.trim@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea" @@ -5395,6 +5537,22 @@ string.prototype.trim@~1.1.2: es-abstract "^1.5.0" function-bind "^1.0.2" +string.prototype.trimleft@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz#9bdb8ac6abd6d602b17a4ed321870d2f8dcefc74" + integrity sha1-m9uKxqvW1gKxek7TIYcNL43O/HQ= + dependencies: + define-properties "^1.1.3" + function-bind "^1.1.1" + +string.prototype.trimright@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.1.tgz#440314b15996c866ce8a0341894d45186200c5d9" + integrity sha1-RAMUsVmWyGbOigNBiU1FGGIAxdk= + dependencies: + define-properties "^1.1.3" + function-bind "^1.1.1" + string_decoder@0.10, string_decoder@~0.10.x: version "0.10.31" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" @@ -5494,6 +5652,13 @@ supports-color@^5.2.0: dependencies: has-flag "^3.0.0" +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha1-4uaaRKyHcveKHsCzW2id9lMO/I8= + dependencies: + has-flag "^3.0.0" + table@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36"