Skip to content

Commit

Permalink
Merge pull request #15 from CartoDB/felix/publint
Browse files Browse the repository at this point in the history
ESM module support & publint fixes
  • Loading branch information
felixpalmer committed Jan 31, 2024
2 parents 6394f3c + f97652b commit d38c5e2
Show file tree
Hide file tree
Showing 6 changed files with 532 additions and 154 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/test.yml
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [16.x, 18.x, 20.x, 21.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand All @@ -26,7 +26,9 @@ jobs:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: yarn
run: |
yarn
yarn build
- name: Run tests
run: yarn test-fast
run: yarn test
25 changes: 15 additions & 10 deletions package.json
@@ -1,32 +1,37 @@
{
"name": "quadbin",
"version": "0.1.9",
"version": "0.2.0",
"description": "Utility functions for working with Quadbins",
"license": "MIT",
"main": "dist/cjs/index.js",
"type": "module",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.js",
"umd:main": "dist/umd/index.js",
"types": "dist/types/index.d.js",
"types": "dist/types/index.d.ts",
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"types": "./dist/types/index.d.ts"
"require": "./dist/cjs/index.cjs"
},
"./*": "./*"
},
"keywords": ["quadbin", "webgl", "visualization"],
"keywords": [
"quadbin",
"webgl",
"visualization"
],
"repository": {
"type": "git",
"url": "https://github.com/CartoDB/quadbin-js.git"
},
"scripts": {
"clean": "rm -r dist/*",
"clean": "rm -rf dist/*",
"build": "yarn clean && yarn build:cjs && yarn build:esm && yarn build:types && yarn build:umd",
"build:cjs": "tsc -p tsconfig/tsconfig.cjs.json",
"build:cjs": "tsc -p tsconfig/tsconfig.cjs.json && mv dist/cjs/index.js dist/cjs/index.cjs",
"build:esm": "tsc -p tsconfig/tsconfig.esm.json",
"build:types": "tsc -p tsconfig/tsconfig.types.json",
"build:umd": "webpack --config tsconfig/webpack.config.js",
"build:umd": "webpack --config tsconfig/webpack.config.cjs",
"lint": "npx prettier --check src",
"test": "yarn lint && yarn test-fast",
"test-fast": "npx ts-node node_modules/tape/bin/tape test/**/*.spec.js"
Expand All @@ -39,7 +44,7 @@
"babel-loader": "^8.0.0",
"babel-preset-minify": "^0.5.0",
"prettier": "^2.4.1",
"tape": "^4.11.0",
"tape": "^5.3.0",
"ts-loader": "^9.2.5",
"typescript": "^4.4.4",
"webpack": "^5.52.1",
Expand Down
19 changes: 10 additions & 9 deletions test/index.spec.js
Expand Up @@ -6,8 +6,9 @@ import {
geometryToCells,
getResolution,
hexToBigInt
} from '../src/index';
import {tileToQuadkey} from './quadkey-utils';
} from 'quadbin';

import {tileToQuadkey} from './quadkey-utils.js';

const TEST_TILES = [
{x: 0, y: 0, z: 0, q: 5192650370358181887n},
Expand Down Expand Up @@ -47,13 +48,13 @@ test('Quadbin getParent', async t => {
});

// Zoom:26 test not agreeing with Python
import PointGeometry from './data/PointGeometry.json';
import MultiPointGeometry from './data/MultiPointGeometry.json';
import LineStringGeometry from './data/LineStringGeometry.json';
import MultiLineStringGeometry from './data/MultiLineStringGeometry.json';
import PolygonGeometry from './data/PolygonGeometry.json';
import PolygonAntimeridianGeometry from './data/PolygonAntimeridianGeometry.json';
import MultiPolygonGeometry from './data/MultiPolygonGeometry.json';
import PointGeometry from './data/PointGeometry.json' assert {type: 'json'};
import MultiPointGeometry from './data/MultiPointGeometry.json' assert {type: 'json'};
import LineStringGeometry from './data/LineStringGeometry.json' assert {type: 'json'};
import MultiLineStringGeometry from './data/MultiLineStringGeometry.json' assert {type: 'json'};
import PolygonGeometry from './data/PolygonGeometry.json' assert {type: 'json'};
import PolygonAntimeridianGeometry from './data/PolygonAntimeridianGeometry.json' assert {type: 'json'};
import MultiPolygonGeometry from './data/MultiPolygonGeometry.json' assert {type: 'json'};
const testCases = [
PointGeometry,
MultiPointGeometry,
Expand Down
13 changes: 5 additions & 8 deletions tsconfig.json
@@ -1,7 +1,6 @@
{
"compilerOptions": {
"target": "es2020",
"jsx": "react",
"target": "es2022",
"strict": true,
"noImplicitAny": false,
"allowJs": true,
Expand All @@ -14,12 +13,10 @@
"skipLibCheck": true,
"baseUrl": ".",
"paths": {
"test": ["test"]
"test": ["test"],
"quadbin": ["src"]
}
},
"include": [
"src"
],
"exclude": [
]
"include": ["src"],
"exclude": []
}
File renamed without changes.

0 comments on commit d38c5e2

Please sign in to comment.