From bdf40e26074150f58cc185bf910ac62375f4364b Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 1 Feb 2023 02:13:04 +0100 Subject: [PATCH] Small fixes to GenerateSeries-script --- scripts/GenerateSeries.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/GenerateSeries.ts b/scripts/GenerateSeries.ts index c1761f102..58fe0ede5 100644 --- a/scripts/GenerateSeries.ts +++ b/scripts/GenerateSeries.ts @@ -1,4 +1,4 @@ -import fs, { existsSync, readdirSync, readFileSync, unlinkSync, writeFileSync } from "fs" +import { existsSync, readdirSync, readFileSync, unlinkSync, writeFileSync } from "fs" import ScriptUtils from "./ScriptUtils" import { Utils } from "../Utils" import Script from "./Script" @@ -56,9 +56,9 @@ class StatsDownloader { }.day.json` writtenFiles.push(path) if (existsSync(path)) { - let features = JSON.parse(readFileSync(path, { encoding: "utf-8" })) - features = features?.features ?? features - features.push(...features.features) // day-stats are generally a list already, but in some ad-hoc cases might be a geojson-collection too + let loadedFeatures = JSON.parse(readFileSync(path, { encoding: "utf-8" })) + loadedFeatures = loadedFeatures?.features ?? loadedFeatures + features.push(...loadedFeatures) // day-stats are generally a list already, but in some ad-hoc cases might be a geojson-collection too console.log( "Loaded ", path, @@ -296,7 +296,7 @@ class GenerateSeries extends Script { features.forEach((f) => { delete f.bbox }) - fs.writeFileSync( + writeFileSync( path, JSON.stringify( {