"use strict";
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 = __importDefault(require("path"));
const FileUtils_1 = __importDefault(require("../utils/FileUtils"));
const PackageScript_1 = require("./PackageScript");
function PackageWeb(projectDir, key, isolate = false) {
    console.log(`-----------------------------------------------------Handle package [${key}] start-----------------------------------------------------`);
    const outputDir = path_1.default.join(projectDir, 'build', 'subgame', 'web-mobile', key);
    FileUtils_1.default.rm(outputDir);
    FileUtils_1.default.mkdir(path_1.default.dirname(outputDir));
    console.log(`Make package [${key}] output dir: ${outputDir}`);
    const buildDir = path_1.default.join(projectDir, 'build', 'web-mobile');
    const bundleDir = path_1.default.join(buildDir, 'assets', key);
    (0, PackageScript_1.PackageScript)(key, buildDir, isolate);
    fs_1.default.renameSync(bundleDir, outputDir);
    console.log(`-----------------------------------------------------Handle package [${key}] end-------------------------------------------------------\n\n`);
}
exports.default = PackageWeb;
