-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget-gallery-names.js
23 lines (23 loc) · 2.21 KB
/
get-gallery-names.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const io_1 = __importDefault(require("../lib/io"));
const utils_1 = require("../lib/utils");
const LOG_DIR = `${io_1.default.projectDir}/log/category-files`;
const galleryNames = new Set();
(async function () {
var files = fs_1.default.readdirSync(LOG_DIR);
await Promise.all(fs_1.default.readdirSync(LOG_DIR).map(async (file) => {
for (const [, match] of utils_1.matchAll(/^(.+?)\|/gm, await io_1.default.readFile(`${LOG_DIR}/${file}`))) {
galleryNames.add(match);
}
}));
console.log(JSON.stringify({
dates: files.map(file => file.replace(/^(\d{4})(\d{2})(\d{2})\.log$/, "$1-$2-$3")).sort(),
galleries: Array.from(galleryNames).sort(utils_1.sortCaseInsensitive)
}));
}());
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LWdhbGxlcnktbmFtZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJnZXQtZ2FsbGVyeS1uYW1lcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLDRDQUFvQjtBQUNwQixtREFBMkI7QUFDM0Isd0NBQTJEO0FBRTNELE1BQU0sT0FBTyxHQUFHLEdBQUcsWUFBRSxDQUFDLFVBQVUscUJBQXFCLENBQUM7QUFDdEQsTUFBTSxZQUFZLEdBQUcsSUFBSSxHQUFHLEVBQVUsQ0FBQztBQUN2QyxDQUFDLEtBQUs7SUFDRixJQUFJLEtBQUssR0FBRyxZQUFFLENBQUMsV0FBVyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0lBQ3BDLE1BQU0sT0FBTyxD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