Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
COR-48 Update packages + audit fix (#4296)
Browse files Browse the repository at this point in the history
* chore: update styled-components and friends

* chore: update typescript for app

* chore: update typescript for cli

* chore: update ts-node, sanity, typescript

* fix: fall back to variantName in json when not provided in sanity

* chore: audit fix

* restore data-structure

Co-authored-by: VWSCoronaDashboard24 <[email protected]>
  • Loading branch information
2 people authored and VWSCoronaDashboard25 committed Jun 23, 2022
1 parent 1c03e69 commit c86774c
Show file tree
Hide file tree
Showing 19 changed files with 450 additions and 442 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
},
"packageManager": "[email protected]",
"devDependencies": {
"ts-node": "^10.4.0"
"ts-node": "^10.8.1"
}
}
12 changes: 6 additions & 6 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"react-markdown": "^5.0.3",
"sanitize-filename": "^1.6.3",
"sharp": "^0.30.5",
"styled-components": "^5.3.3",
"styled-components": "^5.3.5",
"styled-system": "^5.1.5",
"svgo-loader": "^3.0.0",
"swr": "^1.1.0",
Expand Down Expand Up @@ -88,8 +88,8 @@
"@types/react-test-renderer": "^17.0.1",
"@types/sharp": "^0.29.4",
"@types/sinon": "^10.0.6",
"@types/styled-components": "^5.1.16",
"@types/styled-system": "^5.1.13",
"@types/styled-components": "^5.1.25",
"@types/styled-system": "^5.1.15",
"@types/styled-system__css": "^5.0.16",
"@types/styled-system__should-forward-prop": "^5.1.2",
"@types/unist": "^2.0.6",
Expand All @@ -101,7 +101,7 @@
"babel-plugin-date-fns": "^2.0.0",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-module-resolver": "^4.1.0",
"babel-plugin-styled-components": "^1.13.3",
"babel-plugin-styled-components": "^2.0.7",
"c8": "^7.10.0",
"chokidar-cli": "^3.0.0",
"cross-env": "^7.0.3",
Expand Down Expand Up @@ -130,9 +130,9 @@
"prettier": "^2.5.0",
"react-test-renderer": "^17.0.2",
"sinon": "^11.1.2",
"ts-node": "^10.4.0",
"ts-node": "^10.8.1",
"tsconfig-paths": "^3.12.0",
"typescript": "^4.5.5",
"typescript": "^4.7.3",
"uvu": "^0.5.2",
"walkjs": "^3.2.4",
"webpack": "^5.64.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export const ChoroplethMap: <T extends ChoroplethDataItem>(
<Box ref={containerRef} width="100%" height="100%">
{!isDefined(choroplethFeatures) ? (
<img
src={`/api/choropleth/${map}/${dataConfig.metricName}/${dataConfig.metricProperty}/${minHeight}`}
src={`/api/choropleth/${map}/${dataConfig.metricName.toString()}/${dataConfig.metricProperty.toString()}/${minHeight}`}
loading="lazy"
/>
) : (
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/components/choropleth/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ export const DynamicChoropleth = withLoadingProps((getLoadingProps) =>
} = getLoadingProps();
return (
<img
src={`/api/choropleth/${map}/${dataConfig.metricName}/${
dataConfig.metricProperty
src={`/api/choropleth/${map}/${dataConfig.metricName.toString()}/${
dataConfig.metricProperty.toString()
}/${minHeight}/${dataOptions.selectedCode ?? ''}`}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function useChoroplethTooltip<T extends ChoroplethDataItem>(
const threshold = thresholds[map][dataConfig.metricProperty as string];
assert(
isDefined(threshold),
`[${useChoroplethTooltip.name}] No threshold configured for map type ${map} and metric property ${dataConfig.metricProperty}`
`[${useChoroplethTooltip.name}] No threshold configured for map type ${map} and metric property ${dataConfig.metricProperty.toString()}`
);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function useFillColor<T extends ChoroplethDataItem>(
const threshold = thresholds[thresholdMap || map][metricProperty as string];
assert(
isDefined(threshold),
`[${useFillColor.name}] No threshold configured for map type ${map} and metric property ${metricProperty}`
`[${useFillColor.name}] No threshold configured for map type ${map} and metric property ${metricProperty.toString()}`
);

const colorScale = useMemo(() => createColorScale(threshold), [threshold]);
Expand All @@ -58,7 +58,7 @@ export function getFillColor<T extends ChoroplethDataItem>(
const threshold = thresholds[thresholdMap || map][metricProperty as string];
assert(
isDefined(threshold),
`[${getFillColor.name}] No threshold configured for map type ${map} and metric property ${metricProperty}`
`[${getFillColor.name}] No threshold configured for map type ${map} and metric property ${metricProperty.toString()}`
);
const colorScale = createColorScale(threshold);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ export function ChoroplethTooltip<T extends ChoroplethDataItem>(
)[data.map]?.[data.dataConfig.metricProperty as string]?.subject;
assert(
isDefined(subject),
`[${ChoroplethTooltip.name}] No tooltip subject found in siteText.choropleth_tooltip.${data.map}.${data.dataConfig.metricProperty}`
`[${ChoroplethTooltip.name}] No tooltip subject found in siteText.choropleth_tooltip.${data.map}.${data.dataConfig.metricProperty.toString()}`
);

const tooltipContent = (
text as unknown as Record<string, Record<string, Record<string, string>>>
)[data.map]?.[data.dataConfig.metricProperty as string]?.content;
assert(
isDefined(tooltipContent),
`[${ChoroplethTooltip.name}] No tooltip content found in siteText.choropleth_tooltip.${data.map}.${data.dataConfig.metricProperty}`
`[${ChoroplethTooltip.name}] No tooltip content found in siteText.choropleth_tooltip.${data.map}.${data.dataConfig.metricProperty.toString()}`
);

const tooltipVars = {
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/cms/logic/get-data-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ export function getDataUrl<

const suffix = qParams.length ? `?${qParams.join('&')}` : '';

return `/api/data/${type}/${code ?? area}/${metricName}${suffix}`;
return `/api/data/${type}/${code ?? area}/${metricName.toString()}${suffix}`;
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ function SeriesUnmemoized<T extends TimestampedValue>({
const config = seriesConfig[index];
const id =
config.type === 'range'
? `${chartId}_${config.metricPropertyLow}_${config.metricPropertyHigh}_${config.type}`
: `${chartId}_${config.metricProperty}_${config.type}`;
? `${chartId}_${String(config.metricPropertyLow)}_${String(config.metricPropertyHigh)}_${config.type}`
: `${chartId}_${String(config.metricProperty)}_${config.type}`;

switch (config.type) {
case 'gapped-line':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function getVaccineCoveragePercentageFormatter(
numFractionDigits: number
) {
return <T extends DataWithLabels<T>>(data: T, property: KeyWithLabel<T>) => {
const labelKey = `${property}_label` as keyof T;
const labelKey = `${property.toString()}_label` as keyof T;

if (
labelKey in data &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export function ChoroplethTooltip<T extends VaccineCoverageData>(
data.dataConfig
.metricProperty as unknown as KeyWithLabel<VaccineCoverageData>
) >= 0,
`[${ChoroplethTooltip.name}] The given metricProperty ${data.dataConfig.metricProperty} is not found in percentageProps`
`[${ChoroplethTooltip.name}] The given metricProperty ${data.dataConfig.metricProperty.toString()} is not found in percentageProps`
);

const { commonTexts } = useIntl();
Expand All @@ -236,7 +236,7 @@ export function ChoroplethTooltip<T extends VaccineCoverageData>(
)[data.map]?.[data.dataConfig.metricProperty as string]?.subject;
assert(
isDefined(subject),
`[${ChoroplethTooltip.name}] No tooltip subject found in siteText.choropleth_tooltip.${data.map}.${data.dataConfig.metricProperty}`
`[${ChoroplethTooltip.name}] No tooltip subject found in siteText.choropleth_tooltip.${data.map}.${data.dataConfig.metricProperty.toString()}`
);

const tooltipVars = {
Expand All @@ -256,7 +256,7 @@ export function ChoroplethTooltip<T extends VaccineCoverageData>(
)[data.map]?.[data.dataConfig.metricProperty as string]?.content;
assert(
isDefined(mainContent),
`[${ChoroplethTooltip.name}] No tooltip content found in siteText.choropleth_tooltip.${data.map}.${data.dataConfig.metricProperty}`
`[${ChoroplethTooltip.name}] No tooltip content found in siteText.choropleth_tooltip.${data.map}.${data.dataConfig.metricProperty.toString()}`
);

const secondaryContent = Object.entries(secondaryValues).map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ function useSeriesConfig(
type: 'gapped-stacked-area',
metricProperty: variantKey as keyof VariantChartValue,
color,
label: text.varianten[variantName].name,
label: text.varianten[variantName]?.name || variantName,
shape: 'square',
strokeWidth: 0,
fillOpacity: 1,
Expand Down
5 changes: 2 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"simple-git": "^2.48.0",
"topojson-client": "^3.1.0",
"ts-is-present": "^1.2.2",
"ts-node": "^10.4.0"
"ts-node": "^10.8.1"
},
"scripts": {
"prepare-release": "ts-node src/release/prepare-release.ts",
Expand Down Expand Up @@ -46,7 +46,6 @@
"@typescript-eslint/parser": "^5.5.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"ts-node": "^10.4.0",
"typescript": "^4.4.4"
"typescript": "^4.7.3"
}
}
20 changes: 10 additions & 10 deletions packages/cms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@
},
"dependencies": {
"@corona-dashboard/icons": "0.0.0",
"@sanity/base": "^2.29.3",
"@sanity/base": "^2.30.1",
"@sanity/cli": "^2.30.0",
"@sanity/components": "^2.14.0",
"@sanity/core": "^2.29.3",
"@sanity/dashboard": "^2.29.3",
"@sanity/default-layout": "^2.29.3",
"@sanity/default-login": "^2.29.3",
"@sanity/desk-tool": "^2.29.3",
"@sanity/form-builder": "^2.29.3",
"@sanity/core": "^2.30.1",
"@sanity/dashboard": "^2.30.1",
"@sanity/default-layout": "^2.30.1",
"@sanity/default-login": "^2.30.1",
"@sanity/desk-tool": "^2.30.1",
"@sanity/form-builder": "^2.30.1",
"@sanity/production-preview": "^2.29.3",
"@sanity/ui": "^0.36.15",
"@sanity/vision": "^2.29.3",
"@sanity/vision": "^2.30.1",
"braille": "^1.1.0",
"change-case": "^4.1.2",
"download": "^8.0.0",
Expand Down Expand Up @@ -83,8 +83,8 @@
"fast-csv": "^4.3.6",
"lint-staged": "^11.2.6",
"meow": "^9.0.0",
"ts-node": "^10.4.0",
"typescript": "^4.4.4"
"ts-node": "^10.8.1",
"typescript": "^4.7.3"
},
"lint-staged": {
"*.@(ts|tsx)": [
Expand Down
2 changes: 1 addition & 1 deletion packages/cms/src/data/data-structure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT MANUALLY CHANGE THE CONTENTS OF THIS FILE!
* This file is generated based on the JSON schema's by yarn generate-data-structures in the cli package.
*/
export const dataStructure = {
export const dataStructure = {
gm: {
deceased_rivm: ["covid_daily", "covid_daily_moving_average", "covid_total"],
hospital_nice: [
Expand Down
8 changes: 4 additions & 4 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"test:ci": "cross-env TS_NODE_PROJECT=tsconfig.test.json uvu -r ts-node/register --bail",
"dev": "tsc -w",
"build:watch": "chokidar \"./src/**/*.*\" -c \"yarn build\"",
"build": "tsc -b . && tscpaths -p tsconfig.json -s ./src -o ./dist",
"build": "tsc -b . && tsconfig-replace-paths -p tsconfig.json -s ./src -o ./dist",
"clean": "npx rimraf dist tsconfig.tsbuildinfo",
"nuke": "yarn clean && npx rimraf node_modules",
"typecheck": "tsc --pretty --noEmit",
Expand All @@ -38,10 +38,10 @@
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.27.1",
"prettier": "^2.5.0",
"ts-node": "^10.4.0",
"ts-node": "^10.8.1",
"tsconfig-paths": "^3.12.0",
"tscpaths": "^0.0.9",
"typescript": "^4.4.4",
"tsconfig-replace-paths": "^0.0.11",
"typescript": "^4.7.3",
"uvu": "^0.5.2"
}
}
2 changes: 1 addition & 1 deletion packages/common/src/data-sorting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function sortTimeSeriesInDataInPlace<T>(
}
}
} catch (e) {
console.error(`Error during processing ${propertyName}`);
console.error(`Error during processing ${propertyName.toString()}`);
throw e;
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"test:ci": "echo 'No tests available for @corona-dashboard/cli' && exit 0",
"typecheck": "exit 0",
"build": "npx rimraf tsconfig.tsbuildinfo dist src/icons && node bin/generate.js && yarn compile",
"compile": "tsc -b . && tscpaths -p tsconfig.json -s ./src -o ./dist",
"compile": "tsc -b . && tsconfig-replace-paths -p tsconfig.json -s ./src -o ./dist",
"rename-jsx": "node bin/rename.js",
"lint": "eslint ."
},
Expand Down Expand Up @@ -46,9 +46,9 @@
"rimraf": "^3.0.2",
"rollup": "^2.60.2",
"svgson": "^5.2.1",
"ts-node": "^10.4.0",
"tscpaths": "^0.0.9",
"typescript": "^4.4.4",
"ts-node": "^10.8.1",
"tsconfig-replace-paths": "^0.0.11",
"typescript": "^4.7.3",
"uppercamelcase": "^3.0.0"
},
"peerDependencies": {
Expand Down
Loading

0 comments on commit c86774c

Please sign in to comment.