"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeDevDependencies = void 0;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const common_1 = require("../../common");
const removeDevDependencies = (projectPath) => {
    // remove `next-transpile-modules` dependency
    const packagePath = path_1.default.join(projectPath, 'package.json');
    const pkg = (0, common_1.openJsonFile)(packagePath);
    if (pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies['next-transpile-modules']) {
        delete pkg.devDependencies['next-transpile-modules'];
        (0, common_1.writeJsonFile)(pkg, packagePath);
    }
    // remove monorepo next.config.js plugin
    const monorepoPlugin = path_1.default.join(projectPath, 'src/lib/next-config/plugins/monorepo.js');
    if (fs_1.default.existsSync(monorepoPlugin)) {
        fs_1.default.unlinkSync(monorepoPlugin);
    }
};
exports.removeDevDependencies = removeDevDependencies;
