UNPKG

@codegame.dev/wallet-cli

Version:

A CLI tool for managing wallets across multiple blockchains, supporting operations like wallet creation, balance checking, transfers, and fee estimation.

24 lines (19 loc) 752 B
import fs from "fs" import path from "path" function appendJsExtension(dir) { const files = fs.readdirSync(dir) files.forEach((file) => { const filePath = path.join(dir, file) const stat = fs.lstatSync(filePath) if (stat.isDirectory()) { appendJsExtension(filePath) // Recursively process directories } else if (file.endsWith(".js")) { let content = fs.readFileSync(filePath, "utf8") // Regular expression to match import paths, but exclude ones that already have a .js or other extensions content = content.replace(/(import\s.*?['"])(\..*?)(?<!\.js)(['"])/g, "$1$2.js$3") fs.writeFileSync(filePath, content, "utf8") } }) } // Process the 'dist' directory (or your compiled output directory) appendJsExtension("./dist")