deprecopilot
Version:
Automated dependency management with AI-powered codemods
27 lines (26 loc) • 701 B
JavaScript
import { promises as fs } from 'fs';
import { homedir } from 'os';
import { join } from 'path';
const CONFIG_NAME = '.deprecopilotrc';
function getConfigPath() {
return join(homedir(), CONFIG_NAME);
}
export async function getTelemetryConfig() {
try {
const raw = await fs.readFile(getConfigPath(), 'utf-8');
return JSON.parse(raw);
}
catch {
return { telemetryEnabled: false };
}
}
export async function setTelemetryConfig(enabled) {
const config = { telemetryEnabled: enabled };
try {
await fs.writeFile(getConfigPath(), JSON.stringify(config, null, 2), { flag: 'w' });
return true;
}
catch {
return false;
}
}