21 lines
846 B
JavaScript
21 lines
846 B
JavaScript
|
// SPDX-FileCopyrightText: 2021 Johannes Loher
|
||
|
//
|
||
|
// SPDX-License-Identifier: MIT
|
||
|
|
||
|
import promises from "node:fs/promises";
|
||
|
import path from "node:path";
|
||
|
|
||
|
import { distDirectory, sourceDirectory } from "./const.js";
|
||
|
import { convertPackFileToJSONFile } from "./json-pack-tools.js";
|
||
|
|
||
|
const packsDistDirectory = path.join(distDirectory, "packs");
|
||
|
const packsSourceDirectory = path.join(sourceDirectory, "packs");
|
||
|
|
||
|
console.log(`Converting pack files in ${packsDistDirectory} to json files in ${packsSourceDirectory}:`);
|
||
|
|
||
|
const conversionPromises = (await promises.readdir(packsDistDirectory, { withFileTypes: true }))
|
||
|
.filter((dirent) => dirent.isFile() && path.extname(dirent.name))
|
||
|
.map(async (dirent) => convertPackFileToJSONFile(path.join(packsDistDirectory, dirent.name), packsSourceDirectory));
|
||
|
|
||
|
await Promise.all(conversionPromises);
|