Skip to content

Commit

Permalink
Setup monorepolint (#1856)
Browse files Browse the repository at this point in the history
Configure monorepolint

- Monorepolint lets us easily manage all of our subpackages declaratively
- Husky installs commit hooks to prevent invalid commits from even merging
- lint-staged gives us rules for custom linting depending on what files changed
- Alphabetize the package.json scripts
- Change travis node version from 9->12 to get to a supported version
- Bump all of the typescript dependencies to the latest, fixes a build error with some types in our dependencies being 3.x dependent.

Co-authored-by: Matt Fedderly <[email protected]>
  • Loading branch information
mfedderly and mfedderly authored Mar 16, 2020
1 parent 7e95c2d commit 0239428
Show file tree
Hide file tree
Showing 117 changed files with 1,492 additions and 459 deletions.
37 changes: 37 additions & 0 deletions .monorepolint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const path = require("path");
const glob = require("glob");
const fs = require("fs");

const TS_PACKAGES = []; // projects that use typescript to build
const JS_PACKAGES = []; // projects that use javascript/rollup to build
const MAIN_PACKAGE = "@turf/turf";

const TAPE_PACKAGES = []; // projects that have tape tests
const TYPES_PACKAGES = []; // projects that have types tests

// iterate all the packages and figure out what buckets everything falls into
glob.sync(path.join(__dirname, "packages", "turf-*")).forEach(pk => {
const name = JSON.parse(
fs.readFileSync(path.join(pk, "package.json"), "utf8")
).name;

if (fs.existsSync(path.join(pk, "index.ts"))) {
TS_PACKAGES.push(name);
} else {
JS_PACKAGES.push(name);
}

if (fs.existsSync(path.join(pk, "test.js"))) {
TAPE_PACKAGES.push(name);
}

if (fs.existsSync(path.join(pk, "types.ts"))) {
TYPES_PACKAGES.push(name);
}
});

module.exports = {
rules: {
":alphabetical-scripts": {}
}
};
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
language: node_js
cache: yarn
node_js:
- 9
- 12
15 changes: 14 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@
"docs": "node ./scripts/generate-readmes",
"postinstall": "opencollective postinstall"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"**/package.json": [
"mrl check --paths"
]
},
"devDependencies": {
"@types/geojson": "*",
"@types/node": "*",
Expand All @@ -23,15 +33,18 @@
"eslint-config-mourner": "*",
"esm": "^3.2.25",
"fs-extra": "*",
"husky": "^4.2.3",
"lerna": "2.8.0",
"lint-staged": "^10.0.8",
"load-json-file": "*",
"meow": "*",
"monorepolint": "^0.5.0-alpha.17",
"npm-run-all": "^4.1.5",
"progress": "*",
"rollup": "*",
"rollup-plugin-typescript": "*",
"tape": "*",
"typescript": "*",
"typescript": "^3.8.3",
"yamljs": "*"
},
"dependencies": {
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-along/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes"
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-angle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes"
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-area/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes"
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-bbox-clip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes"
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-bbox-polygon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes"
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-bbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes"
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-bearing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes"
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-bezier-spline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes"
"docs": "node ../../scripts/generate-readmes",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-boolean-clockwise/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes",
"bench:run": "node bench.js"
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-boolean-concave/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes",
"bench:run": "node bench.js"
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-boolean-contains/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes",
"bench:run": "node bench.js"
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-boolean-crosses/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes",
"bench:run": "node bench.js"
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-boolean-disjoint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes",
"bench:run": "node bench.js"
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-boolean-equal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes",
"bench:run": "node bench.js"
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-boolean-intersects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes",
"bench:run": "node bench.js"
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-boolean-overlap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes",
"bench:run": "node bench.js"
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-boolean-parallel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes",
"bench:run": "node bench.js"
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-boolean-point-in-polygon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dist"
],
"scripts": {
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"docs": "node ../../scripts/generate-readmes",
"bench:run": "node bench.js"
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js"
},
"repository": {
"type": "git",
Expand Down
Loading

0 comments on commit 0239428

Please sign in to comment.