import fs from "fs" import path from "path" fs.readdirSync("dist").forEach(file => { const pif = JSON.parse( fs .readFileSync(path.join("dist", file), "utf-8") .toString() .replace(/\/\/.*/g, "") ) try { const release = parseInt(pif.RELEASE.split(".")[0]) if (isNaN(release)) { throw new Error("NaN") } const dir = path.join("dist", release.toString()) if (!fs.existsSync(dir)) { fs.mkdirSync(dir) } fs.copyFileSync(path.join("dist", file), path.join(dir, file)) } catch (e) { const dir = path.join("dist", "unkown") if (!fs.existsSync(dir)) { fs.mkdirSync(dir) } fs.copyFileSync(path.join("dist", file), path.join(dir, file)) } })