2020-11-17 05:20:35 +03:00
|
|
|
"use strict";
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
});
|
|
|
|
};
|
|
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
|
|
};
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const fs_1 = __importDefault(require("fs"));
|
|
|
|
const path_1 = require("../path");
|
|
|
|
const utils_1 = require("../utils");
|
|
|
|
function copy(src, dst, transform) {
|
2021-10-16 09:29:27 +03:00
|
|
|
let data = fs_1.default.readFileSync((0, path_1.resolve)(src));
|
2020-11-17 05:20:35 +03:00
|
|
|
if (transform) {
|
|
|
|
data = Buffer.from(transform(data.toString()));
|
|
|
|
}
|
|
|
|
fs_1.default.writeFileSync(dst, data);
|
|
|
|
}
|
|
|
|
(function () {
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
2021-10-16 09:29:27 +03:00
|
|
|
yield (0, utils_1.mkdir)((0, path_1.resolve)("output/karma"));
|
|
|
|
copy((0, path_1.resolve)("packages/ethers/dist/ethers.esm.js"), (0, path_1.resolve)("output/karma/ethers.esm.js"));
|
|
|
|
copy((0, path_1.resolve)("packages/tests/dist/tests.esm.js"), (0, path_1.resolve)("output/karma/tests.esm.js"), (data) => {
|
2020-11-17 05:20:35 +03:00
|
|
|
return data.replace(/^(import [^;]* from ')(ethers)(';)/, (all, prefix, id, suffix) => {
|
|
|
|
return prefix + "./ethers.esm.js" + suffix;
|
|
|
|
});
|
|
|
|
});
|
2021-10-16 09:29:27 +03:00
|
|
|
copy((0, path_1.resolve)("packages/ethers/dist/ethers.umd.js"), (0, path_1.resolve)("output/karma/ethers.umd.js"));
|
|
|
|
copy((0, path_1.resolve)("packages/tests/dist/tests.umd.js"), (0, path_1.resolve)("output/karma/tests.umd.js"));
|
2020-11-17 05:20:35 +03:00
|
|
|
});
|
|
|
|
})();
|