Skip to content

Commit

Permalink
Switch to ESM entry point, modernize dependencies for v4 (#51)
Browse files Browse the repository at this point in the history
* switch to ESM entry point, modernize deps

* remove leftover deps
  • Loading branch information
mourner authored Jun 26, 2024
1 parent c34d08b commit 941396c
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ coverage
.nyc_output
*.log
cheap-ruler.js
cheap-ruler.min.js
test/types.js
pnpm-lock.yaml
File renamed without changes.
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict'; /* @flow */

const factors = {
kilometers: 1,
Expand Down
47 changes: 21 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,33 @@
"name": "cheap-ruler",
"version": "3.0.2",
"description": "A collection of fast approximations to common geographic measurements.",
"author": "Vladimir Agafonkin",
"license": "ISC",
"type": "module",
"main": "cheap-ruler.js",
"module": "index.js",
"jsdelivr": "cheap-ruler.min.js",
"unpkg": "cheap-ruler.min.js",
"types": "cheap-ruler.d.ts",
"dependencies": {},
"devDependencies": {
"@rollup/plugin-buble": "^0.21.3",
"@turf/turf": "^6.5.0",
"@types/node": "^17.0.23",
"benchmark": "^2.1.4",
"eslint": "^8.2.0",
"c8": "^7.11.0",
"eslint": "^8.12.0",
"eslint-config-mourner": "^3.0.0",
"esm": "^3.2.25",
"node-vincenty": "0.0.6",
"nyc": "^15.1.0",
"rollup": "^2.60.0",
"rollup-plugin-terser": "^7.0.2",
"tape": "^5.3.2",
"ts-node": "^10.4.0",
"typescript": "^4.4.4"
"rollup": "^2.70.1",
"tape": "^5.5.2",
"ts-node": "^10.7.0",
"typescript": "^4.6.3"
},
"scripts": {
"pretest": "eslint index.js bench test/*.js",
"test": "tape -r esm test/test.js",
"posttest": "npm run build && npm run types",
"types": "ts-node test/types.ts",
"build": "rollup -c",
"prepublishOnly": "npm test",
"cov": "nyc tape test/test.js"
"test": "tape test/test.js",
"posttest": "npm run types",
"types": "ts-node --esm test/types.ts",
"build": "rollup index.js -o cheap-ruler.js -n CheapRuler -f umd",
"prepublishOnly": "npm test && npm run build",
"cov": "c8 tape test/test.js"
},
"files": [
"index.js",
Expand All @@ -39,7 +37,10 @@
"cheap-ruler.d.ts"
],
"eslintConfig": {
"extends": "mourner"
"extends": "mourner",
"parserOptions": {
"ecmaVersion": 2020
}
},
"repository": {
"type": "git",
Expand All @@ -50,11 +51,5 @@
"measurement",
"approximation",
"distance"
],
"author": "Vladimir Agafonkin",
"license": "ISC",
"bugs": {
"url": "https://github.com/mapbox/cheap-ruler/issues"
},
"homepage": "https://github.com/mapbox/cheap-ruler#readme"
]
}
18 changes: 0 additions & 18 deletions rollup.config.js

This file was deleted.

4 changes: 3 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {test} from 'tape';
import CheapRuler from '../index.js';
import * as turf from '@turf/turf';
import lines from './fixtures/lines.json';
import {readFileSync} from 'fs';

const lines = JSON.parse(readFileSync(new URL('fixtures/lines.json', import.meta.url)));

const points = Array.prototype.concat.apply([], lines);

Expand Down
2 changes: 1 addition & 1 deletion test/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CheapRuler, { Point, Line, Polygon } from '../cheap-ruler.js'
import CheapRuler, { Point, Line, Polygon } from '../index.js'

/**
* Declare variables
Expand Down
17 changes: 5 additions & 12 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
{
"compilerOptions": {
/* Basic Options */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */

/* 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'. */

/* Advanced Options */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
"target": "es5",
"module": "es6",
"strict": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true
}
}

0 comments on commit 941396c

Please sign in to comment.