()
| 23 | const walletNames = ["b3wallet"] |
| 24 | |
| 25 | const copy = async () => { |
| 26 | for await (const walletName of walletNames) { |
| 27 | const walletPath = path.join("wasm", walletName) |
| 28 | |
| 29 | const files = readdirSync(walletPath, { |
| 30 | withFileTypes: true |
| 31 | }) |
| 32 | |
| 33 | for await (const file of files) { |
| 34 | const src = path.join("wasm", walletName, file.name) |
| 35 | |
| 36 | await readVersion(walletName).then(async version => { |
| 37 | const destFolder = path.join( |
| 38 | frontendReleasesPath, |
| 39 | walletName, |
| 40 | version || "latest" |
| 41 | ) |
| 42 | |
| 43 | if (!existsSync(destFolder)) { |
| 44 | mkdirSync(destFolder, { recursive: true }) |
| 45 | } |
| 46 | |
| 47 | const dest = path.join(destFolder, file.name) |
| 48 | |
| 49 | await copyFile(src, dest) |
| 50 | }) |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | // Get the list of files |
| 55 | const existingWallets = readdirSync(frontendReleasesPath, { |
| 56 | withFileTypes: true |
| 57 | }) |
| 58 | .filter(dirent => dirent.isDirectory()) |
| 59 | .map(dirent => dirent.name) |
| 60 | |
| 61 | // Build the JSON object |
| 62 | const releases: Release[] = [] |
| 63 | |
| 64 | // get folder name inside frontendReleasesPath |
| 65 | for await (const name of existingWallets) { |
| 66 | const walletPath = path.join(frontendReleasesPath, name) |
| 67 | |
| 68 | const walletVersion = readdirSync(walletPath, { withFileTypes: true }) |
| 69 | .filter(dirent => dirent.isDirectory()) |
| 70 | .map(dirent => dirent.name) |
| 71 | |
| 72 | for await (const version of walletVersion) { |
| 73 | const versionPath = path.join(walletPath, version) |
| 74 | const wasmFiles = readdirSync(versionPath).filter( |
| 75 | file => path.extname(file) === ".wasm" |
| 76 | ) |
| 77 | |
| 78 | for (const wasmFile of wasmFiles) { |
| 79 | const wasmFilePath = path.join(versionPath, wasmFile) |
| 80 | const size = statSync(wasmFilePath).size |
| 81 | |
| 82 | const sizeInMb = (size / 1000000.0).toFixed(2) |
no test coverage detected