const fs = require("fs");
["lib/esm", "lib/cjs"].forEach((buildPath) => {
  fs.copyFileSync(
    `src/core/bridge_bg.wasm`,
    `${buildPath}/core/bridge_bg.wasm`
  );
  fs.copyFileSync(
    `src/core-node/bridge_bg.wasm`,
    `${buildPath}/core-node/bridge_bg.wasm`
  );
  fs.copyFileSync(
    `src/core/bridge_bg.wasm.d.ts`,
    `${buildPath}/core/bridge_bg.wasm.d.ts`
  );
  fs.copyFileSync(
    `src/core-node/bridge_bg.wasm.d.ts`,
    `${buildPath}/core-node/bridge_bg.wasm.d.ts`
  );
  fs.copyFileSync(
    `src/nft/nft_bridge_bg.wasm`,
    `${buildPath}/nft/nft_bridge_bg.wasm`
  );
  fs.copyFileSync(
    `src/nft-node/nft_bridge_bg.wasm`,
    `${buildPath}/nft-node/nft_bridge_bg.wasm`
  );
  fs.copyFileSync(
    `src/nft/nft_bridge_bg.wasm.d.ts`,
    `${buildPath}/nft/nft_bridge_bg.wasm.d.ts`
  );
  fs.copyFileSync(
    `src/nft-node/nft_bridge_bg.wasm.d.ts`,
    `${buildPath}/nft-node/nft_bridge_bg.wasm.d.ts`
  );
  fs.copyFileSync(
    `src/token/token_bridge_bg.wasm`,
    `${buildPath}/token/token_bridge_bg.wasm`
  );
  fs.copyFileSync(
    `src/token-node/token_bridge_bg.wasm`,
    `${buildPath}/token-node/token_bridge_bg.wasm`
  );
  fs.copyFileSync(
    `src/token/token_bridge_bg.wasm.d.ts`,
    `${buildPath}/token/token_bridge_bg.wasm.d.ts`
  );
  fs.copyFileSync(
    `src/token-node/token_bridge_bg.wasm.d.ts`,
    `${buildPath}/token-node/token_bridge_bg.wasm.d.ts`
  );
  fs.copyFileSync(
    `src/migration/wormhole_migration_bg.wasm`,
    `${buildPath}/migration/wormhole_migration_bg.wasm`
  );
  fs.copyFileSync(
    `src/migration-node/wormhole_migration_bg.wasm`,
    `${buildPath}/migration-node/wormhole_migration_bg.wasm`
  );
  fs.copyFileSync(
    `src/migration/wormhole_migration_bg.wasm.d.ts`,
    `${buildPath}/migration/wormhole_migration_bg.wasm.d.ts`
  );
  fs.copyFileSync(
    `src/migration-node/wormhole_migration_bg.wasm.d.ts`,
    `${buildPath}/migration-node/wormhole_migration_bg.wasm.d.ts`
  );
});
