mirror of
https://github.com/di-sukharev/opencommit.git
synced 2026-04-20 03:02:51 -04:00
26 lines
596 B
TypeScript
26 lines
596 B
TypeScript
import path from 'path';
|
|
|
|
const nodeModulesPath = path.join(
|
|
process.env.PWD || process.cwd(),
|
|
'node_modules',
|
|
'@commitlint',
|
|
'load'
|
|
);
|
|
|
|
/**
|
|
* This code is loading the configuration for the `@commitlint` package from the current working
|
|
* directory (`process.env.PWD`) by requiring the `load` module from the `@commitlint` package.
|
|
*
|
|
* @returns
|
|
*/
|
|
export const getCommitLintPWDConfig = async () => {
|
|
const load = require(nodeModulesPath).default;
|
|
|
|
if (load && typeof load === 'function') {
|
|
return await load();
|
|
}
|
|
|
|
// @commitlint/load is not a function
|
|
return null;
|
|
};
|