Skip to content

Commit

Permalink
Build using tsup
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinVdBroeck committed May 4, 2024
1 parent 5eda634 commit de5bb32
Show file tree
Hide file tree
Showing 121 changed files with 3,652 additions and 811 deletions.
65 changes: 18 additions & 47 deletions .monorepolint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,54 +75,37 @@ module.exports = {
// Example of a URL that will keep working: https://unpkg.com/@turf/turf
browser: "turf.min.js",
files: ["dist", "index.d.ts", "turf.min.js"],
exports: {
"./package.json": "./package.json",
".": {
import: "./dist/es/index.js",
require: "./dist/js/index.js",
},
},
},
},
includePackages: [MAIN_PACKAGE],
},
{
options: {
entries: {
main: "dist/js/index.js",
module: "dist/es/index.js",
type: "commonjs",
main: "dist/cjs/index.js",
module: "dist/esm/index.mjs",
types: "dist/cjs/index.d.ts",
sideEffects: false,
publishConfig: {
access: "public",
},
exports: {
"./package.json": "./package.json",
".": {
import: "./dist/es/index.js",
require: "./dist/js/index.js",
import: {
types: "./dist/esm/index.d.mts",
default: "./dist/esm/index.mjs",
},
require: {
types: "./dist/cjs/index.d.ts",
default: "./dist/cjs/index.js",
},
},
},
},
},
includePackages: [...TS_PACKAGES, ...JS_PACKAGES],
},
{
options: {
entries: {
types: "dist/js/index.d.ts",
files: ["dist"],
},
},
includePackages: TS_PACKAGES,
},
{
options: {
entries: {
types: "index.d.ts",
files: ["dist", "index.d.ts"],
},
},
includePackages: JS_PACKAGES,
includePackages: [MAIN_PACKAGE, ...TS_PACKAGES, ...JS_PACKAGES],
},
{
options: {
Expand All @@ -146,28 +129,16 @@ module.exports = {
{
options: {
scripts: {
build: "npm-run-all build:*",
"build:js": "tsc",
"build:es":
'tsc --outDir dist/es --module esnext --declaration false && echo \'{"type":"module"}\' > dist/es/package.json',
},
},
includePackages: TS_PACKAGES,
},
{
options: {
scripts: {
build:
'rollup -c ../../rollup.config.js && echo \'{"type":"module"}\' > dist/es/package.json',
build: "tsup --config ../../tsup.config.ts",
},
},
includePackages: JS_PACKAGES,
includePackages: [...JS_PACKAGES, ...TS_PACKAGES],
},
{
options: {
scripts: {
build:
'rollup -c rollup.config.js && echo \'{"type":"module"}\' > dist/es/package.json',
"tsup --config ../../tsup.config.ts && rollup -c ./rollup.config.js",
},
},
includePackages: [MAIN_PACKAGE],
Expand Down Expand Up @@ -209,10 +180,10 @@ module.exports = {
{
options: {
devDependencies: {
rollup: "*",
tsup: "^8.0.1",
},
},
includePackages: JS_PACKAGES,
includePackages: ALL_PACKAGES,
},
],
},
Expand Down
20 changes: 14 additions & 6 deletions packages/turf-along/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,21 @@
"turf",
"distance"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"types": "dist/js/index.d.ts",
"type": "commonjs",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
}
},
"sideEffects": false,
Expand All @@ -39,7 +46,7 @@
],
"scripts": {
"bench": "tsx bench.js",
"build": "npm-run-all build:*",
"build": "tsup --config ../../tsup.config.ts",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "node ../../scripts/generate-readmes",
Expand All @@ -54,6 +61,7 @@
"tape": "*",
"ts-node": "^10.9.2",
"tslint": "*",
"tsup": "^8.0.1",
"tsx": "^4.9.1",
"typescript": "~4.7.3"
},
Expand Down
20 changes: 14 additions & 6 deletions packages/turf-angle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,21 @@
"turf",
"angle"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"types": "dist/js/index.d.ts",
"type": "commonjs",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
}
},
"sideEffects": false,
Expand All @@ -39,7 +46,7 @@
],
"scripts": {
"bench": "tsx bench.js",
"build": "npm-run-all build:*",
"build": "tsup --config ../../tsup.config.ts",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "node ../../scripts/generate-readmes",
Expand All @@ -58,6 +65,7 @@
"tape": "*",
"ts-node": "^10.9.2",
"tslint": "*",
"tsup": "^8.0.1",
"tsx": "^4.9.1",
"typescript": "~4.7.3",
"write-json-file": "*"
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-angle/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require("path");
const glob = require("glob");
const load = require("load-json-file");
const write = require("write-json-file");
const sector = require("@turf/sector");
const sector = require("@turf/sector").default;
const bearing = require("@turf/bearing").default;
const truncate = require("@turf/truncate").default;
const distance = require("@turf/distance").default;
Expand Down
20 changes: 14 additions & 6 deletions packages/turf-area/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,21 @@
"polygon",
"multipolygon"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"types": "dist/js/index.d.ts",
"type": "commonjs",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
}
},
"sideEffects": false,
Expand All @@ -38,7 +45,7 @@
],
"scripts": {
"bench": "tsx bench.js",
"build": "npm-run-all build:*",
"build": "tsup --config ../../tsup.config.ts",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "node ../../scripts/generate-readmes",
Expand All @@ -53,6 +60,7 @@
"tape": "*",
"ts-node": "^10.9.2",
"tslint": "*",
"tsup": "^8.0.1",
"tsx": "^4.9.1",
"typescript": "~4.7.3",
"write-json-file": "*"
Expand Down
20 changes: 14 additions & 6 deletions packages/turf-bbox-clip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,21 @@
"bbox",
"clip"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"types": "dist/js/index.d.ts",
"type": "commonjs",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
}
},
"sideEffects": false,
Expand All @@ -44,7 +51,7 @@
],
"scripts": {
"bench": "tsx bench.js",
"build": "npm-run-all build:*",
"build": "tsup --config ../../tsup.config.ts",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "node ../../scripts/generate-readmes",
Expand All @@ -60,6 +67,7 @@
"tape": "*",
"ts-node": "^10.9.2",
"tslint": "*",
"tsup": "^8.0.1",
"tsx": "^4.9.1",
"typescript": "~4.7.3",
"write-json-file": "*"
Expand Down
20 changes: 14 additions & 6 deletions packages/turf-bbox-polygon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,21 @@
"extent",
"bbox"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"types": "dist/js/index.d.ts",
"type": "commonjs",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
}
},
"sideEffects": false,
Expand All @@ -39,7 +46,7 @@
],
"scripts": {
"bench": "tsx bench.js",
"build": "npm-run-all build:*",
"build": "tsup --config ../../tsup.config.ts",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "node ../../scripts/generate-readmes",
Expand All @@ -53,6 +60,7 @@
"tape": "*",
"ts-node": "^10.9.2",
"tslint": "*",
"tsup": "^8.0.1",
"tsx": "^4.9.1",
"typescript": "~4.7.3"
},
Expand Down
20 changes: 14 additions & 6 deletions packages/turf-bbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@
"featurecollection",
"geojson"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"types": "dist/js/index.d.ts",
"type": "commonjs",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.mjs",
"types": "dist/cjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
}
},
"sideEffects": false,
Expand All @@ -40,7 +47,7 @@
],
"scripts": {
"bench": "tsx bench.js",
"build": "npm-run-all build:*",
"build": "tsup --config ../../tsup.config.ts",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "node ../../scripts/generate-readmes",
Expand All @@ -54,6 +61,7 @@
"tape": "*",
"ts-node": "^10.9.2",
"tslint": "*",
"tsup": "^8.0.1",
"tsx": "^4.9.1",
"typescript": "~4.7.3"
},
Expand Down
Loading

0 comments on commit de5bb32

Please sign in to comment.