Skip to content

Commit ae5cb7c

Browse files
authored
Merge pull request #66 from sigmacomputing/ashna/fix-clustering-map
[Vite] Migrate clustering-map plugin to ESM
2 parents 2587ca9 + 03b7047 commit ae5cb7c

File tree

13 files changed

+4783
-2016
lines changed

13 files changed

+4783
-2016
lines changed

clustering-map/.eslintrc.cjs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
root: true,
3+
env: { browser: true, es2020: true },
4+
extends: [
5+
'eslint:recommended',
6+
'plugin:@typescript-eslint/recommended',
7+
'plugin:react-hooks/recommended',
8+
],
9+
ignorePatterns: ['dist', '.eslintrc.cjs'],
10+
parser: '@typescript-eslint/parser',
11+
parserOptions: {
12+
ecmaFeatures: {
13+
jsx: true,
14+
},
15+
},
16+
plugins: ['react-refresh'],
17+
rules: {
18+
'react-refresh/only-export-components': [
19+
'warn',
20+
{ allowConstantExport: true },
21+
],
22+
},
23+
}

clustering-map/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# dependencies
44
/node_modules
5+
/dist
56
/.pnp
67
.pnp.js
78

@@ -21,3 +22,6 @@
2122
npm-debug.log*
2223
yarn-debug.log*
2324
yarn-error.log*
25+
yarn.lock
26+
.yarn/install-state.gz
27+
.yarnrc.yml

clustering-map/index.html

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,13 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
4-
<meta charset="utf-8" />
5-
<link rel="icon" href="/favicon.ico" />
6-
<meta name="viewport" content="width=device-width, initial-scale=1" />
7-
<meta name="theme-color" content="#000000" />
8-
<meta
9-
name="description"
10-
content="Web site created using create-react-app"
11-
/>
12-
<link rel="apple-touch-icon" href="/logo192.png" />
13-
<!--
14-
manifest.json provides metadata used when your web app is installed on a
15-
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16-
-->
17-
<link rel="manifest" href="/manifest.json" />
18-
<!--
19-
Notice the use of %PUBLIC_URL% in the tags above.
20-
It will be replaced with the URL of the `public` folder during the build.
21-
Only files inside the `public` folder can be referenced from the HTML.
22-
23-
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24-
work correctly both with client-side routing and a non-root public URL.
25-
Learn how to configure a non-root public URL by running `npm run build`.
26-
-->
27-
<title>React App</title>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + React + JS</title>
288
</head>
299
<body>
30-
<noscript>You need to enable JavaScript to run this app.</noscript>
3110
<div id="root"></div>
32-
<!--
33-
This HTML file is a template.
34-
If you open it directly in the browser, you will see an empty page.
35-
36-
You can add webfonts, meta tags, or analytics to this file.
37-
The build step will place the bundled scripts into the <body> tag.
38-
39-
To begin the development, run `npm start` or `yarn start`.
40-
To create a production bundle, use `npm run build` or `yarn build`.
41-
-->
11+
<script type="module" src="/src/index.jsx"></script>
4212
</body>
4313
</html>

clustering-map/package.json

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,34 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite --force",
8-
"build": "tsc && vite build",
9-
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
8+
"build": "vite build",
9+
"lint": "eslint . --report-unused-disable-directives --max-warnings 0",
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13-
"@sigmacomputing/plugin": "^0.6.92",
13+
"@sigmacomputing/plugin": "^1.0.6",
1414
"copy-to-clipboard": "^3.3.1",
1515
"deck.gl": "8.3.11",
16+
"mapbox-gl": "^3.10.0",
1617
"react": "^17.0.2",
1718
"react-dom": "^17.0.2",
1819
"react-map-gl": "^6.1.1",
1920
"supercluster": "^7.1.4",
20-
"web-vitals": "^1.0.1",
21-
"worker-loader": "^3.0.8"
21+
"typescript": "^5.7.3",
22+
"web-vitals": "^1.0.1"
2223
},
2324
"devDependencies": {
2425
"@testing-library/jest-dom": "^5.11.4",
2526
"@testing-library/react": "^11.1.0",
2627
"@testing-library/user-event": "^12.1.10",
28+
"@typescript-eslint/eslint-plugin": "^8.24.0",
29+
"@typescript-eslint/parser": "^8.24.0",
2730
"@vitejs/plugin-react": "^4.3.4",
28-
"vite": "^6.0.11"
29-
},
30-
"eslintConfig": {
31-
"extends": [
32-
"react-app",
33-
"react-app/jest"
34-
]
31+
"eslint": "^8.57.0",
32+
"eslint-plugin-react-hooks": "^5.1.0",
33+
"eslint-plugin-react-refresh": "^0.4.19",
34+
"vite": "^6.0.11",
35+
"vite-plugin-svgr": "^4.3.0"
3536
},
3637
"browserslist": {
3738
"production": [
@@ -44,5 +45,6 @@
4445
"last 1 firefox version",
4546
"last 1 safari version"
4647
]
47-
}
48+
},
49+
"packageManager": "[email protected]"
4850
}
File renamed without changes.
File renamed without changes.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { StaticMap } from 'react-map-gl';
33
import DeckGL from '@deck.gl/react';
44
import { MapView } from '@deck.gl/core';
55

6-
import { ReactComponent as ZoomIn } from '../assets/add.svg';
7-
import { ReactComponent as ZoomOut } from '../assets/negative.svg';
8-
import { ReactComponent as Center } from '../assets/reticle.svg';
6+
import ZoomIn from '../assets/add.svg?react';
7+
import ZoomOut from '../assets/negative.svg?react';
8+
import Center from '../assets/reticle.svg?react';
99
import iconMapping from '../assets/location-icon-mapping.json'
1010
import iconAtlas from '../assets/location-icon-atlas.png'
1111
import { renderContextMenu } from './ContextMenu';

0 commit comments

Comments
 (0)