From c9f6cd0734a14355cdf93f9e919363090368bcc7 Mon Sep 17 00:00:00 2001 From: HO <93981322+VWSCoronaDashboard19@users.noreply.github.com> Date: Wed, 20 Jul 2022 10:31:10 +0200 Subject: [PATCH] Replace konva-node with konva and remove it (#4327) * feat: replace konva-node with konva en remove it * feat: backtick to regular conditional string --- packages/app/package.json | 1 - .../src/pages/api/choropleth/[...param].ts | 3 +- yarn.lock | 100 +++--------------- 3 files changed, 18 insertions(+), 86 deletions(-) diff --git a/packages/app/package.json b/packages/app/package.json index e2f304fee1..6f9b8c052b 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -43,7 +43,6 @@ "http-proxy-middleware": "^2.0.1", "intercept-stdout": "^0.1.2", "konva": "^7.2.5", - "konva-node": "^0.11.2", "lodash": "^4.17.21", "match-sorter": "^6.3.1", "next": "^12.0.4", diff --git a/packages/app/src/pages/api/choropleth/[...param].ts b/packages/app/src/pages/api/choropleth/[...param].ts index 53569ba2f6..65b5145937 100644 --- a/packages/app/src/pages/api/choropleth/[...param].ts +++ b/packages/app/src/pages/api/choropleth/[...param].ts @@ -2,7 +2,7 @@ import { assert, vrData } from '@corona-dashboard/common'; import { geoMercator } from 'd3-geo'; import fs from 'fs'; import hash from 'hash-sum'; -import Konva from 'konva-node'; +import Konva from 'konva'; import { NextApiRequest, NextApiResponse } from 'next/dist/shared/lib/utils'; import path from 'path'; import sanitize from 'sanitize-filename'; @@ -193,6 +193,7 @@ async function generateChoroplethImage( const featureProps = getFeatureProps(map, fColor, dataOptions, dataConfig); const stage = new Konva.Stage({ + container: selectedCode ? selectedCode : '', width, height, }); diff --git a/yarn.lock b/yarn.lock index 254b688592..394be9eb4e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2630,7 +2630,6 @@ __metadata: jsdom: ^18.1.1 jsdom-global: ^3.0.2 konva: ^7.2.5 - konva-node: ^0.11.2 lint-staged: ^11.2.6 lodash: ^4.17.21 lodash-webpack-plugin: ^0.11.6 @@ -3311,25 +3310,6 @@ __metadata: languageName: node linkType: hard -"@mapbox/node-pre-gyp@npm:^1.0.0": - version: 1.0.5 - resolution: "@mapbox/node-pre-gyp@npm:1.0.5" - dependencies: - detect-libc: ^1.0.3 - https-proxy-agent: ^5.0.0 - make-dir: ^3.1.0 - node-fetch: ^2.6.1 - nopt: ^5.0.0 - npmlog: ^4.1.2 - rimraf: ^3.0.2 - semver: ^7.3.4 - tar: ^6.1.0 - bin: - node-pre-gyp: bin/node-pre-gyp - checksum: c1f182a707f5782e47b77a76e9d6a073fb043999cf9ad965bc86732e88db27ad00926d1602918edb7105f05cde67871b84a178ee9844eb742319ade419636675 - languageName: node - linkType: hard - "@mdx-js/react@npm:^1.0.0": version: 1.6.22 resolution: "@mdx-js/react@npm:1.6.22" @@ -7423,6 +7403,15 @@ __metadata: languageName: node linkType: hard +"@types/react-reconciler@npm:~0.26.2": + version: 0.26.7 + resolution: "@types/react-reconciler@npm:0.26.7" + dependencies: + "@types/react": "*" + checksum: 4122d2b08580f775d0aeae9bd10b68248f894096ed14c0ebbc143ef712e21b159e89d0c628bd95dd3329947fc1ee94a0cb1d2d32b32b1d5d225e70030e91e58f + languageName: node + linkType: hard + "@types/react-test-renderer@npm:>=16.9.0, @types/react-test-renderer@npm:^17.0.1": version: 17.0.1 resolution: "@types/react-test-renderer@npm:17.0.1" @@ -10637,18 +10626,6 @@ __metadata: languageName: node linkType: hard -"canvas@npm:^2.5.0": - version: 2.8.0 - resolution: "canvas@npm:2.8.0" - dependencies: - "@mapbox/node-pre-gyp": ^1.0.0 - nan: ^2.14.0 - node-gyp: latest - simple-get: ^3.0.3 - checksum: 4cc909f63eaf88d22f9164601903745abcc6ccb7f70090b9389dc2cb68cbf139c220dbd75837e6d04602ff122b44a2eb17413bca850f9c6c602f74f1f0f1cc3f - languageName: node - linkType: hard - "capital-case@npm:^1.0.4": version: 1.0.4 resolution: "capital-case@npm:1.0.4" @@ -12487,15 +12464,6 @@ __metadata: languageName: node linkType: hard -"decompress-response@npm:^4.2.0": - version: 4.2.1 - resolution: "decompress-response@npm:4.2.1" - dependencies: - mimic-response: ^2.0.0 - checksum: 4e783ca4dfe9417354d61349750fe05236f565a4415a6ca20983a311be2371debaedd9104c0b0e7b36e5f167aeaae04f84f1a0b3f8be4162f1d7d15598b8fdba - languageName: node - linkType: hard - "decompress-response@npm:^6.0.0": version: 6.0.0 resolution: "decompress-response@npm:6.0.0" @@ -12727,15 +12695,6 @@ __metadata: languageName: node linkType: hard -"detect-libc@npm:^1.0.3": - version: 1.0.3 - resolution: "detect-libc@npm:1.0.3" - bin: - detect-libc: ./bin/detect-libc.js - checksum: daaaed925ffa7889bd91d56e9624e6c8033911bb60f3a50a74a87500680652969dbaab9526d1e200a4c94acf80fc862a22131841145a0a8482d60a99c24f4a3e - languageName: node - linkType: hard - "detect-libc@npm:^2.0.0, detect-libc@npm:^2.0.1": version: 2.0.1 resolution: "detect-libc@npm:2.0.1" @@ -17648,17 +17607,7 @@ __metadata: languageName: node linkType: hard -"konva-node@npm:^0.11.2": - version: 0.11.2 - resolution: "konva-node@npm:0.11.2" - dependencies: - canvas: ^2.5.0 - konva: ^7 - checksum: 11d99492c653d6e52c370af5831a4dce60b6cabbf81016806fa58c8563174272db39940b8d638fc29f83f949cf5934471ed7c1d3d1d6c3bad60152450f308fd2 - languageName: node - linkType: hard - -"konva@npm:^7, konva@npm:^7.2.5": +"konva@npm:^7.2.5": version: 7.2.5 resolution: "konva@npm:7.2.5" checksum: 795ab73af38307243f867be3dab122ec6a5c37bc7f44a20359baf2bf6e1d5cd8a9ce9d7e3b69b21dd6429615b8f96254858e346e8ccb4b5fff8be6c5b60cd12d @@ -18785,13 +18734,6 @@ __metadata: languageName: node linkType: hard -"mimic-response@npm:^2.0.0": - version: 2.1.0 - resolution: "mimic-response@npm:2.1.0" - checksum: 014fad6ab936657e5f2f48bd87af62a8e928ebe84472aaf9e14fec4fcb31257a5edff77324d8ac13ddc6685ba5135cf16e381efac324e5f174fb4ddbf902bf07 - languageName: node - linkType: hard - "mimic-response@npm:^3.1.0": version: 3.1.0 resolution: "mimic-response@npm:3.1.0" @@ -19034,7 +18976,7 @@ __metadata: languageName: node linkType: hard -"nan@npm:^2.12.1, nan@npm:^2.14.0": +"nan@npm:^2.12.1": version: 2.15.0 resolution: "nan@npm:2.15.0" dependencies: @@ -22704,16 +22646,17 @@ __metadata: linkType: hard "react-konva@npm:^17.0.2-5": - version: 17.0.2-5 - resolution: "react-konva@npm:17.0.2-5" + version: 17.0.2-6 + resolution: "react-konva@npm:17.0.2-6" dependencies: + "@types/react-reconciler": ~0.26.2 react-reconciler: ~0.26.2 scheduler: ^0.20.2 peerDependencies: konva: ^8.0.1 || ^7.2.5 react: ">=16.8.0" react-dom: ">=16.8.0" - checksum: 614522753fe95322fc022569cd95443eacfc1b9d2d84c0bb4ea40ce6cdce9b7c5843268e67ebef7cdb6d50ab08b8a5038ec760c3977a105e233bcceb8408de56 + checksum: 5e868f6941090243c998f2817fbc9f031f60c83e236dc3f6328c904114582cfe281a08df9b5146b3339f6e1ccf30f3707d03de85fd534fb42fbe0ee6c6531b0c languageName: node linkType: hard @@ -24439,17 +24382,6 @@ __metadata: languageName: node linkType: hard -"simple-get@npm:^3.0.3": - version: 3.1.1 - resolution: "simple-get@npm:3.1.1" - dependencies: - decompress-response: ^4.2.0 - once: ^1.3.1 - simple-concat: ^1.0.0 - checksum: 80195e70bf171486e75c31e28e5485468195cc42f85940f8b45c4a68472160144d223eb4d07bc82ef80cb974b7c401db021a540deb2d34ac4b3b8883da2d6401 - languageName: node - linkType: hard - "simple-get@npm:^4.0.0, simple-get@npm:^4.0.1": version: 4.0.1 resolution: "simple-get@npm:4.0.1" @@ -25610,7 +25542,7 @@ __metadata: languageName: node linkType: hard -"tar@npm:^6.0.2, tar@npm:^6.1.0, tar@npm:^6.1.2": +"tar@npm:^6.0.2, tar@npm:^6.1.2": version: 6.1.11 resolution: "tar@npm:6.1.11" dependencies: