Use profile-detection instead of rules-detection

This commit is contained in:
Joe Danziger
2025-05-26 22:16:14 -04:00
parent 36e8257d08
commit c02a324641
4 changed files with 17 additions and 17 deletions

View File

@@ -1,6 +1,6 @@
/**
* Rules Detection Utility
* Helper functions to detect existing rules profiles in a project
* Profile Detection Utility
* Helper functions to detect existing profiles in a project
*/
import fs from 'fs';
import path from 'path';
@@ -8,11 +8,11 @@ import { RULES_PROFILES } from '../constants/profiles.js';
import { getRulesProfile } from './rule-transformer.js';
/**
* Detect which rules profiles are currently installed in the project
* Detect which profiles are currently installed in the project
* @param {string} projectRoot - Project root directory
* @returns {string[]} Array of installed profile names
*/
export function getInstalledRulesProfiles(projectRoot) {
export function getInstalledProfiles(projectRoot) {
const installedProfiles = [];
for (const profileName of RULES_PROFILES) {
@@ -33,13 +33,13 @@ export function getInstalledRulesProfiles(projectRoot) {
}
/**
* Check if removing the specified profiles would result in no rules profiles remaining
* Check if removing the specified profiles would result in no profiles remaining
* @param {string} projectRoot - Project root directory
* @param {string[]} profilesToRemove - Array of profile names to remove
* @returns {boolean} True if removal would result in no profiles remaining
*/
export function wouldRemovalLeaveNoProfiles(projectRoot, profilesToRemove) {
const installedProfiles = getInstalledRulesProfiles(projectRoot);
const installedProfiles = getInstalledProfiles(projectRoot);
const remainingProfiles = installedProfiles.filter(
(profile) => !profilesToRemove.includes(profile)
);