"use strict";
/**
 * Migration: Remove outdated @unisphere+runtime-js patch file
 *
 * Removes any patches/@unisphere+runtime-js+{version}.patch file if it exists.
 * Migration succeeds whether file exists or not.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = update;
const devkit_1 = require("@nx/devkit");
async function update(tree) {
    devkit_1.logger.info('🔄 Removing outdated @unisphere+runtime-js patch file...');
    const patchesDir = 'patches';
    if (tree.exists(patchesDir)) {
        const patchFiles = tree.children(patchesDir);
        const runtimeJsPatch = patchFiles.find(file => file.startsWith('@unisphere+runtime-js+'));
        if (runtimeJsPatch) {
            const patchPath = `${patchesDir}/${runtimeJsPatch}`;
            tree.delete(patchPath);
            devkit_1.logger.info(`✅ Removed ${patchPath}`);
        }
        else {
            devkit_1.logger.info('ℹ️ Patch file not found (already removed or never existed)');
        }
    }
    else {
        devkit_1.logger.info('ℹ️ Patches directory not found');
    }
}
