copyWasm.cjs 421 B

1234567891011121314151617
  1. const find = require("find");
  2. const fs = require("fs");
  3. const path = require("path");
  4. const SOURCE_ROOT = "src";
  5. const TARGET_ROOT = "lib";
  6. find.eachfile(/\.wasm(\..*)?/, SOURCE_ROOT, fname => {
  7. fname_copy = fname.replace(SOURCE_ROOT, TARGET_ROOT);
  8. console.log("copyWasm:", fname, "to", fname_copy);
  9. fs.mkdirSync(path.dirname(fname_copy), {recursive: true});
  10. fs.copyFileSync(fname, fname_copy);
  11. });