summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2024-09-09 16:44:44 -0700
committerDeterminant <[email protected]>2024-09-09 16:44:44 -0700
commit4bcbb39b955f1125120f1675ad73492a5e5442ce (patch)
tree9871de9fed247756b1186beba83e493797943c6d
parent7b6c61d1c2daa9de9121a09af900c9ea1ec969df (diff)
group the current version charts with a folder
-rwxr-xr-xapp.mjs8
1 files changed, 6 insertions, 2 deletions
diff --git a/app.mjs b/app.mjs
index f590ffc..fa7ace7 100755
--- a/app.mjs
+++ b/app.mjs
@@ -238,7 +238,11 @@ for (let r of res) {
continue;
}
const date = cur.date.format("YYYY-MM-DD");
- const file = `${cur.unzip ? zip_path : chart_path}/${r.prefix}-${region.toLowerCase()}-${date}.${cur.unzip ? "zip" : "pdf"}`;
+ const dir = `${cur.unzip ? zip_path : chart_path}/${date}`;
+ try {
+ await fs.mkdir(dir);
+ } catch (_) {}
+ const file = `${dir}/${r.prefix}-${region.toLowerCase()}.${cur.unzip ? "zip" : "pdf"}`;
const fileExists = (path) =>
fs.stat(path).then(
() => true,
@@ -257,7 +261,7 @@ for (let r of res) {
await decompress(file, "./", {
filter: (f) => cur.unzip[f.path] != null,
map: (f) => {
- f.path = `${chart_path}/${r.prefix}-${region.toLowerCase()}-${date}${cur.unzip[f.path]}`;
+ f.path = `${chart_path}/${date}/${r.prefix}-${region.toLowerCase()}${cur.unzip[f.path]}`;
return f;
},
});