debt-collector
Version:
a nodejs tool to identify, track and mesure technical debt
22 lines (21 loc) • 634 B
JavaScript
import path from 'path';
export const loadConfig = async (configPath) => {
const fullPath = path.resolve(process.cwd(), configPath);
try {
const configData = await import(`file:///` + fullPath);
return {
isSuccess: true,
config: configData.default,
error: null,
};
}
catch (error) {
return {
isSuccess: false,
config: null,
error: `Impossible to load a valid config file at ${fullPath}, create a config file or provide a path to a valid config using the "--config" flag
${error}
`,
};
}
};