Skip to content

Commit

Permalink
chore: update dependencies (#231)
Browse files Browse the repository at this point in the history
* chore: updated all dependencies of mapbox-gl-export and maplibre-gl-export (particularly for eslint v9)

* chore: updated depenedencies for demo website
  • Loading branch information
JinIgarashi authored Aug 25, 2024
1 parent 6739184 commit 5a45f61
Show file tree
Hide file tree
Showing 22 changed files with 834 additions and 833 deletions.
6 changes: 6 additions & 0 deletions .changeset/thin-brooms-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@watergis/maplibre-gl-export": patch
"@watergis/mapbox-gl-export": patch
---

chore: updated all dependencies of mapbox-gl-export and maplibre-gl-export (particularly for eslint v9)
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
},
"homepage": "https://github.com/watergis/maplibre-gl-export#readme",
"devDependencies": {
"@changesets/cli": "^2.27.1",
"lefthook": "^1.6.5"
"@changesets/cli": "^2.27.7",
"lefthook": "^1.7.14"
},
"packageManager": "pnpm@9.7.1",
"packageManager": "pnpm@9.8.0",
"engines": {
"pnpm": "^9.0.0"
},
Expand Down
14 changes: 0 additions & 14 deletions packages/mapbox-gl-export/.eslintignore

This file was deleted.

16 changes: 0 additions & 16 deletions packages/mapbox-gl-export/.eslintrc.cjs

This file was deleted.

22 changes: 22 additions & 0 deletions packages/mapbox-gl-export/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import js from '@eslint/js';
import ts from 'typescript-eslint';
import prettier from 'eslint-config-prettier';
import globals from 'globals';

/** @type {import('eslint').Linter.Config[]} */
export default [
js.configs.recommended,
...ts.configs.recommended,
prettier,
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
ignores: ['build/', 'dist/']
}
];
5 changes: 3 additions & 2 deletions packages/mapbox-gl-export/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import mapboxgl from 'mapbox-gl';
import { MapboxExportControl, Size, PageOrientation, Format, DPI } from './src/lib/index';
import './src/scss/mapbox-gl-export.scss';
import { IControl } from 'mapbox-gl';

mapboxgl.accessToken = import.meta.env.VITE_MAPBOX_ACCESSTOKEN;
const map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/streets-v11',
style: 'mapbox://styles/mapbox/standard',
// style: 'https://narwassco.github.io/mapbox-stylefiles/unvt/style.json',
center: [35.87063, -1.08551],
zoom: 12,
Expand All @@ -20,7 +21,7 @@ map.addControl(
Crosshair: true,
PrintableArea: true,
Local: 'en'
}),
}) as unknown as IControl,
'top-right'
);

Expand Down
28 changes: 15 additions & 13 deletions packages/mapbox-gl-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@watergis/mapbox-gl-export",
"version": "3.5.2",
"description": "This module adds control which can export PDF and images.",
"type": "module",
"main": "dist/mapbox-gl-export.umd.js",
"types": "./dist/types/index.d.ts",
"module": "dist/mapbox-gl-export.es.js",
Expand Down Expand Up @@ -50,26 +51,27 @@
"homepage": "https://github.com/watergis/maplibre-gl-export#readme",
"devDependencies": {
"@types/geojson": "^7946.0.14",
"@types/mapbox-gl": "^3.1.0",
"@types/node": "^20.11.25",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"@types/mapbox-gl": "^3.4.0",
"@types/node": "^22.5.0",
"@typescript-eslint/eslint-plugin": "^8.2.0",
"@typescript-eslint/parser": "^8.2.0",
"@watergis/maplibre-gl-export": "workspace:^",
"autoprefixer": "^10.4.18",
"eslint": "^8.57.0",
"autoprefixer": "^10.4.20",
"eslint": "^9.9.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"globals": "^15.9.0",
"path": "^0.12.7",
"postcss": "^8.4.35",
"postcss": "^8.4.41",
"postcss-cli": "^11.0.0",
"prettier": "^3.2.5",
"sass": "^1.71.1",
"sass-loader": "^14.1.1",
"typescript": "^5.4.2",
"vite": "^5.1.5"
"prettier": "^3.3.3",
"sass": "^1.77.8",
"sass-loader": "^16.0.1",
"typescript": "^5.5.4",
"vite": "^5.4.2"
},
"dependencies": {
"js-loading-overlay": "^1.2.0",
"mapbox-gl": "^3.2.0"
"mapbox-gl": "^3.6.0"
}
}
6 changes: 4 additions & 2 deletions packages/mapbox-gl-export/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module.exports = {
plugins: [require('autoprefixer')]
import autoprefixer from 'autoprefixer';

export default {
plugins: [autoprefixer]
};
4 changes: 4 additions & 0 deletions packages/mapbox-gl-export/src/lib/export-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import MapGenerator from './map-generator';
* Mapbox GL Export Control.
* @param {Object} targets - Object of layer.id and title
*/
// eslint-disable-next-line
// @ts-ignore
export default class MapboxExportControl extends MaplibreExportControl implements IControl {
private accessToken: string | undefined;

Expand All @@ -23,6 +25,8 @@ export default class MapboxExportControl extends MaplibreExportControl implement
this.accessToken = options.accessToken;
}

// eslint-disable-next-line
// @ts-ignore
protected generateMap(
map: MapboxMap,
size: SizeType,
Expand Down
37 changes: 34 additions & 3 deletions packages/mapbox-gl-export/src/lib/map-generator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import mapboxgl, { accessToken, Map as MapboxMap } from 'mapbox-gl';
import mapboxgl, { Map as MapboxMap } from 'mapbox-gl';
import 'js-loading-overlay';
import {
defaultAttributionOptions,
Expand Down Expand Up @@ -39,6 +39,8 @@ export default class MapGenerator extends MapGeneratorBase {
accesstoken?: string
) {
super(
// eslint-disable-next-line
// @ts-ignore
map,
size,
dpi,
Expand All @@ -54,12 +56,41 @@ export default class MapGenerator extends MapGeneratorBase {
this.accesstoken = accesstoken;
}

/**
* This function is required to solve an error of Converting circular structure to JSON in mapbox
*/
private stringify(obj) {
let cache = [];
const str = JSON.stringify(obj, function (key, value) {
if (typeof value === 'object' && value !== null) {
// eslint-disable-next-line
// @ts-ignore
if (cache.indexOf(value) !== -1) {
// Circular reference found, discard key
return;
}
// Store value in our collection
// eslint-disable-next-line
// @ts-ignore
cache.push(value);
}
return value;
});
// eslint-disable-next-line
// @ts-ignore
cache = null; // reset the cache
return str;
}

// eslint-disable-next-line
// @ts-ignore
protected getRenderedMap(container: HTMLElement, style: mapboxgl.Style) {
const s = this.stringify(style);
// Render map
const renderMap = new MapboxMap({
accessToken: this.accesstoken || accessToken,
accessToken: this.accesstoken || mapboxgl.accessToken,
container,
style,
style: JSON.parse(s),
center: this.map.getCenter(),
zoom: this.map.getZoom(),
bearing: this.map.getBearing(),
Expand Down
14 changes: 0 additions & 14 deletions packages/maplibre-gl-export/.eslintignore

This file was deleted.

22 changes: 22 additions & 0 deletions packages/maplibre-gl-export/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import js from '@eslint/js';
import ts from 'typescript-eslint';
import prettier from 'eslint-config-prettier';
import globals from 'globals';

/** @type {import('eslint').Linter.Config[]} */
export default [
js.configs.recommended,
...ts.configs.recommended,
prettier,
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
ignores: ['build/', 'dist/']
}
];
2 changes: 1 addition & 1 deletion packages/maplibre-gl-export/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const map = new Map({
// center: [35.87063, -1.08551],
// zoom: 12,
// terrain testing with Bing aerial
style: 'https://unpkg.com/@undp-data/style@latest/dist/aerialstyle.json',
style: 'https://narwassco.github.io/mapbox-stylefiles/unvt/style-aerial.json',
center: [0, 0],
zoom: 1,
hash: true,
Expand Down
31 changes: 17 additions & 14 deletions packages/maplibre-gl-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@watergis/maplibre-gl-export",
"version": "3.8.2",
"description": "This module adds control which can export PDF and images.",
"type": "module",
"main": "dist/maplibre-gl-export.umd.js",
"types": "./dist/types/index.d.ts",
"module": "dist/maplibre-gl-export.es.js",
Expand Down Expand Up @@ -51,27 +52,29 @@
"homepage": "https://github.com/watergis/maplibre-gl-export/tree/main/packages/maplibre-gl-export#readme",
"devDependencies": {
"@types/geojson": "^7946.0.14",
"@types/mapbox-gl": "^3.1.0",
"@types/node": "^20.11.25",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"autoprefixer": "^10.4.18",
"eslint": "^8.57.0",
"@types/mapbox-gl": "^3.4.0",
"@types/node": "^22.5.0",
"@typescript-eslint/eslint-plugin": "^8.2.0",
"@typescript-eslint/parser": "^8.2.0",
"autoprefixer": "^10.4.20",
"eslint": "^9.9.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"globals": "^15.9.0",
"path": "^0.12.7",
"pmtiles": "^3.0.5",
"postcss": "^8.4.35",
"pmtiles": "^3.0.7",
"postcss": "^8.4.41",
"postcss-cli": "^11.0.0",
"prettier": "^3.2.5",
"sass": "^1.71.1",
"sass-loader": "^14.1.1",
"typescript": "^5.4.2",
"vite": "^5.1.5"
"prettier": "^3.3.3",
"sass": "^1.77.8",
"sass-loader": "^16.0.1",
"typescript": "^5.5.4",
"typescript-eslint": "^8.2.0",
"vite": "^5.4.2"
},
"dependencies": {
"js-loading-overlay": "^1.2.0",
"jspdf": "^2.5.1",
"maplibre-gl": "^4.1.0"
"maplibre-gl": "^4.6.0"
}
}
6 changes: 4 additions & 2 deletions packages/maplibre-gl-export/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module.exports = {
plugins: [require('autoprefixer')]
import autoprefixer from 'autoprefixer';

export default {
plugins: [autoprefixer]
};
Loading

0 comments on commit 5a45f61

Please sign in to comment.