MCPcopy
hub / github.com/streamich/git-cz / findOverrides

Function findOverrides

lib/getConfig.js:14–45  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

12];
13
14const findOverrides = (root) => {
15 const dir = root || process.cwd();
16
17 for (const file of configFiles) {
18 const filename = path.resolve(dir, file);
19
20 if (fs.existsSync(filename) && fs.statSync(filename).isFile()) {
21 return require(filename);
22 }
23 }
24
25 const parent = path.resolve(dir, '..');
26
27 const pkgFilename = path.join(dir, 'package.json');
28
29 if (fs.existsSync(pkgFilename)) {
30 try {
31 const changelog = require(pkgFilename).config.commitizen.changelog;
32
33 if (changelog) {
34 return changelog;
35 }
36 // eslint-disable-next-line no-empty
37 } catch (error) {}
38 }
39
40 if (parent !== dir) {
41 return findOverrides(parent);
42 }
43
44 return {};
45};
46
47const getConfig = (root) => {
48 const overrides = findOverrides(root);

Callers 1

getConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…