Skip to content

Commit

Permalink
Build Standardization (Turfjs#1860)
Browse files Browse the repository at this point in the history
- Enforce some TS configurations that we already standardized
- Standardize rollup builds to put artifacts under dist
- Standardize test scripts with tape and tsc testing
- Small bench/test fixes
- Standardize packages/turf builds
- Move turf-difference and turf-meta from index.mjs to index.js

Co-authored-by: Matt Fedderly <[email protected]>
  • Loading branch information
mfedderly and mfedderly authored Mar 17, 2020
1 parent 0239428 commit 878a1d3
Show file tree
Hide file tree
Showing 202 changed files with 505 additions and 470 deletions.
74 changes: 73 additions & 1 deletion .monorepolint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,78 @@ glob.sync(path.join(__dirname, "packages", "turf-*")).forEach(pk => {

module.exports = {
rules: {
":alphabetical-scripts": {}
":alphabetical-scripts": {},

":package-entry": [
{
options: {
entries: {
main: "dist/js/index.js",
types: "dist/js/index.d.ts",
files: ["dist"]
}
},
includePackages: TS_PACKAGES
},
{
options: {
entries: {
main: "dist/js/index.js",
module: "dist/es/index.js",
types: "index.d.ts",
files: ["dist", "index.d.ts"]
}
},
includePackages: JS_PACKAGES
}
],

":package-script": [
{
options: {
scripts: {
bench: "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
docs: "node ../../scripts/generate-readmes",
prepare: "tsc",
pretest: "tsc"
}
},
includePackages: TS_PACKAGES
},
{
options: {
scripts: {
pretest: "rollup -c ../../rollup.config.js",
posttest: "node -r esm ../../scripts/validate-es5-dependencies.js"
}
},
includePackages: JS_PACKAGES
},
{
options: {
scripts: {
"test:tape": "node -r esm test.js"
}
},
includePackages: TAPE_PACKAGES
},
{
options: {
scripts: {
"test:types": "tsc --noEmit types.ts"
}
},
includePackages: TYPES_PACKAGES
},
{
options: {
scripts: {
test: "npm-run-all test:*"
}
},
excludePackages: [MAIN_PACKAGE]
}
]
}
};
3 changes: 2 additions & 1 deletion packages/turf-along/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-angle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-area/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-bbox-clip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-bbox-polygon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-bbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-bearing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-bezier-spline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-boolean-clockwise/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-boolean-concave/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-boolean-contains/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-boolean-crosses/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-boolean-disjoint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-boolean-equal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-boolean-intersects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-boolean-overlap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-boolean-parallel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-boolean-point-in-polygon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-boolean-point-on-line/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-boolean-touches/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "npm-run-all test:tape test:types",
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js",
"test:types": "tsc --noEmit types.ts"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/turf-boolean-valid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
"main": "dist/js/index.js",
"types": "dist/js/index.d.ts",
"files": [
"dist/js/index.js",
"dist/js/index.d.ts"
"dist"
],
"scripts": {
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-boolean-within/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "npm-run-all test:tape test:types",
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js",
"test:types": "tsc --noEmit types.ts"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-buffer/bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs';
import path from 'path';
import load from 'load-json-file';
import Benchmark from 'benchmark';
import buffer from './';
import buffer from './dist/js/index.js';

const directory = path.join(__dirname, 'test', 'in') + path.sep;
const fixtures = fs.readdirSync(directory).map(filename => {
Expand Down
12 changes: 5 additions & 7 deletions packages/turf-buffer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@
"name": "@turf/buffer",
"version": "5.1.5",
"description": "turf buffer module",
"main": "main.js",
"module": "main.es.js",
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"types": "index.d.ts",
"files": [
"index.js",
"index.d.ts",
"main.js",
"main.es.js"
"dist",
"index.d.ts"
],
"scripts": {
"bench": "node -r esm bench.js",
"docs": "node ../../scripts/generate-readmes",
"posttest": "node -r esm ../../scripts/validate-es5-dependencies.js",
"pretest": "rollup -c ../../rollup.config.js",
"test": "npm-run-all test:tape test:types",
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js",
"test:types": "tsc --noEmit types.ts"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-buffer/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import write from 'write-json-file';
import truncate from '@turf/truncate';
import { featureEach } from '@turf/meta';
import { featureCollection, point, polygon, geometryCollection } from '@turf/helpers';
import buffer from '.';
import buffer from './dist/js/index.js';

const directories = {
in: path.join(__dirname, 'test', 'in') + path.sep,
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-center-mean/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "npm-run-all test:tape test:types",
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js",
"test:types": "tsc --noEmit types.ts"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-center-median/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-center-of-mass/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "npm-run-all test:tape test:types",
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js",
"test:types": "tsc --noEmit types.ts"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-center/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "npm-run-all test:tape test:types",
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js",
"test:types": "tsc --noEmit types.ts"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-centroid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "npm-run-all test:tape test:types",
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js",
"test:types": "tsc --noEmit types.ts"
},
Expand Down
Loading

0 comments on commit 878a1d3

Please sign in to comment.