From 910bf3dbc036eaeb6f4daf9bf3e3b26c4bc0e612 Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Mon, 7 Feb 2022 13:59:55 +0000 Subject: [PATCH] Update `envalid` imports --- src/scripts/2-sources/osm/tiles/fetch-images.ts | 2 +- .../rosreestr/6-fetch-object-infos-from-pkk-api.ts | 2 +- .../yandex/1-geocode-addresses-without-position.ts | 2 +- .../4-results/generate-geosemantica-layer-styles.ts | 2 +- src/scripts/4-results/generate-poster.ts | 2 +- src/scripts/format-data-files.ts | 2 +- src/shared/cleanEnv.ts | 2 +- src/shared/envalidDefaultReporter.ts | 8 +++++--- .../geocoding/debugAddressNormalizationIfEnabled.ts | 2 +- src/shared/results/getLocaleFromEnv.ts | 2 +- src/shared/sources/mkrf/helpersForPaths.ts | 2 +- .../rosreestr/pauseBetweenPkkApiRequestsToAvoid403.ts | 2 +- src/shared/territory.ts | 2 +- 13 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/scripts/2-sources/osm/tiles/fetch-images.ts b/src/scripts/2-sources/osm/tiles/fetch-images.ts index 18f5276..b25dbc8 100644 --- a/src/scripts/2-sources/osm/tiles/fetch-images.ts +++ b/src/scripts/2-sources/osm/tiles/fetch-images.ts @@ -1,6 +1,6 @@ import { AxiosInstance } from "axios"; import chalk from "chalk"; -import * as envalid from "envalid"; +import envalid from "envalid"; import fs from "fs-extra"; import path from "node:path"; import stream from "node:stream"; diff --git a/src/scripts/2-sources/rosreestr/6-fetch-object-infos-from-pkk-api.ts b/src/scripts/2-sources/rosreestr/6-fetch-object-infos-from-pkk-api.ts index 1cf15b2..e696fc2 100644 --- a/src/scripts/2-sources/rosreestr/6-fetch-object-infos-from-pkk-api.ts +++ b/src/scripts/2-sources/rosreestr/6-fetch-object-infos-from-pkk-api.ts @@ -1,6 +1,6 @@ import { AxiosResponse } from "axios"; import chalk from "chalk"; -import * as envalid from "envalid"; +import envalid from "envalid"; import sortKeys from "sort-keys"; import { cleanEnv } from "../../../shared/cleanEnv"; diff --git a/src/scripts/2-sources/yandex/1-geocode-addresses-without-position.ts b/src/scripts/2-sources/yandex/1-geocode-addresses-without-position.ts index 67ff9c6..a949849 100644 --- a/src/scripts/2-sources/yandex/1-geocode-addresses-without-position.ts +++ b/src/scripts/2-sources/yandex/1-geocode-addresses-without-position.ts @@ -2,7 +2,7 @@ import * as turf from "@turf/turf"; import axios, { AxiosError, AxiosInstance } from "axios"; import axiosRetry from "axios-retry"; import chalk from "chalk"; -import * as envalid from "envalid"; +import envalid from "envalid"; import fs from "fs-extra"; import http from "node:http"; import https from "node:https"; diff --git a/src/scripts/4-results/generate-geosemantica-layer-styles.ts b/src/scripts/4-results/generate-geosemantica-layer-styles.ts index 23b4697..0abeb09 100644 --- a/src/scripts/4-results/generate-geosemantica-layer-styles.ts +++ b/src/scripts/4-results/generate-geosemantica-layer-styles.ts @@ -1,7 +1,7 @@ import chalk from "chalk"; import clipboardy from "clipboardy"; import { color as d3Color } from "d3-color"; -import * as envalid from "envalid"; +import envalid from "envalid"; import fs from "fs-extra"; import _ from "lodash"; import path from "node:path"; diff --git a/src/scripts/4-results/generate-poster.ts b/src/scripts/4-results/generate-poster.ts index 13e5798..a59b00c 100644 --- a/src/scripts/4-results/generate-poster.ts +++ b/src/scripts/4-results/generate-poster.ts @@ -1,5 +1,5 @@ import chalk from "chalk"; -import * as envalid from "envalid"; +import envalid from "envalid"; import path from "node:path"; import puppeteer from "puppeteer"; diff --git a/src/scripts/format-data-files.ts b/src/scripts/format-data-files.ts index b9893f1..f1f9506 100644 --- a/src/scripts/format-data-files.ts +++ b/src/scripts/format-data-files.ts @@ -1,5 +1,5 @@ import chalk from "chalk"; -import * as envalid from "envalid"; +import envalid from "envalid"; import fs from "fs-extra"; import path from "node:path"; diff --git a/src/shared/cleanEnv.ts b/src/shared/cleanEnv.ts index b58cc06..73592cb 100644 --- a/src/shared/cleanEnv.ts +++ b/src/shared/cleanEnv.ts @@ -1,5 +1,5 @@ import { config } from "dotenv-flow"; -import * as envalid from "envalid"; +import envalid from "envalid"; import { defaultReporter } from "./envalidDefaultReporter"; diff --git a/src/shared/envalidDefaultReporter.ts b/src/shared/envalidDefaultReporter.ts index 26455bc..e9fc309 100644 --- a/src/shared/envalidDefaultReporter.ts +++ b/src/shared/envalidDefaultReporter.ts @@ -1,6 +1,6 @@ // Origin: https://github.com/af/envalid/blob/a694876d3fe5f8a8316d15ce4e26e895f41966f6/src/reporter.ts -import { EnvMissingError, ReporterOptions } from "envalid"; +import envalid from "envalid"; import { ScriptError } from "./helpersForScripts"; @@ -17,7 +17,9 @@ const colors = { const rule = colors.white("================================"); -export const defaultReporter = ({ errors = {} }: ReporterOptions) => { +export const defaultReporter = ({ + errors = {}, +}: envalid.ReporterOptions) => { if (Object.keys(errors).length === 0) { return; } @@ -25,7 +27,7 @@ export const defaultReporter = ({ errors = {} }: ReporterOptions) => { const missingVarsOutput: string[] = []; const invalidVarsOutput: string[] = []; for (const [key, error] of Object.entries(errors)) { - if (error instanceof EnvMissingError) { + if (error instanceof envalid.EnvMissingError) { missingVarsOutput.push( ` ${colors.blue(key)}: ${error.message || "(required)"}`, ); diff --git a/src/shared/geocoding/debugAddressNormalizationIfEnabled.ts b/src/shared/geocoding/debugAddressNormalizationIfEnabled.ts index bf30e44..2191407 100644 --- a/src/shared/geocoding/debugAddressNormalizationIfEnabled.ts +++ b/src/shared/geocoding/debugAddressNormalizationIfEnabled.ts @@ -1,5 +1,5 @@ import chalk from "chalk"; -import * as envalid from "envalid"; +import envalid from "envalid"; import { WriteStream } from "node:tty"; import { AddressNormalizationConfig, normalizeAddress } from "../addresses"; diff --git a/src/shared/results/getLocaleFromEnv.ts b/src/shared/results/getLocaleFromEnv.ts index d2024d6..6d037c2 100644 --- a/src/shared/results/getLocaleFromEnv.ts +++ b/src/shared/results/getLocaleFromEnv.ts @@ -1,4 +1,4 @@ -import * as envalid from "envalid"; +import envalid from "envalid"; import { cleanEnv } from "../cleanEnv"; diff --git a/src/shared/sources/mkrf/helpersForPaths.ts b/src/shared/sources/mkrf/helpersForPaths.ts index 8531b9d..36627be 100644 --- a/src/shared/sources/mkrf/helpersForPaths.ts +++ b/src/shared/sources/mkrf/helpersForPaths.ts @@ -1,4 +1,4 @@ -import * as envalid from "envalid"; +import envalid from "envalid"; import path from "node:path"; import { cleanEnv } from "../../cleanEnv"; diff --git a/src/shared/sources/rosreestr/pauseBetweenPkkApiRequestsToAvoid403.ts b/src/shared/sources/rosreestr/pauseBetweenPkkApiRequestsToAvoid403.ts index 9c8dcdb..8a2af5b 100644 --- a/src/shared/sources/rosreestr/pauseBetweenPkkApiRequestsToAvoid403.ts +++ b/src/shared/sources/rosreestr/pauseBetweenPkkApiRequestsToAvoid403.ts @@ -1,4 +1,4 @@ -import * as envalid from "envalid"; +import envalid from "envalid"; import _ from "lodash"; import sleep from "sleep-promise"; diff --git a/src/shared/territory.ts b/src/shared/territory.ts index be1dedc..780cda2 100644 --- a/src/shared/territory.ts +++ b/src/shared/territory.ts @@ -1,6 +1,6 @@ import * as turf from "@turf/turf"; import chalk from "chalk"; -import * as envalid from "envalid"; +import envalid from "envalid"; import fs from "fs-extra"; import { load } from "js-yaml"; import _ from "lodash";