"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = update;
const devkit_1 = require("@nx/devkit");
async function update(tree) {
    devkit_1.logger.info('🔄 Updating .nvmrc to Node 24...');
    const nvmrcPath = '.nvmrc';
    const targetNodeVersion = '24';
    if (tree.exists(nvmrcPath)) {
        const currentContent = tree.read(nvmrcPath, 'utf-8');
        if (currentContent) {
            const currentVersion = currentContent.trim();
            if (currentVersion === targetNodeVersion) {
                devkit_1.logger.info('ℹ️ .nvmrc already set to Node 24.');
                return;
            }
            tree.write(nvmrcPath, targetNodeVersion);
            devkit_1.logger.info(`✅ Updated .nvmrc from ${currentVersion} to ${targetNodeVersion}`);
        }
    }
    else {
        tree.write(nvmrcPath, targetNodeVersion);
        devkit_1.logger.info(`✅ Created .nvmrc with Node ${targetNodeVersion}`);
    }
    await (0, devkit_1.formatFiles)(tree);
}
