MCPcopy
hub / github.com/commitizen/cz-cli / getConfigContent

Function getConfigContent

src/configLoader/getContent.js:51–65  ·  view source on GitHub ↗

* Get content of the configuration file * @param {String} configPath - partial path to configuration file * @param {String} directory - directory path which will be joined with config argument * @return {Object}

(configPath, baseDirectory)

Source from the content-addressed store, hash-verified

49 * @return {Object}
50 */
51function getConfigContent (configPath, baseDirectory) {
52 if (!configPath) {
53 return;
54 }
55
56 const resolvedPath = path.resolve(baseDirectory, configPath);
57 const configBasename = path.basename(resolvedPath);
58
59 if (!fs.existsSync(resolvedPath)) {
60 return getNormalizedConfig(resolvedPath);
61 }
62
63 const content = readConfigContent(resolvedPath);
64 return getNormalizedConfig(configBasename, content);
65};
66
67/**
68 * Read proper content from config file.

Callers

nothing calls this directly

Calls 2

getNormalizedConfigFunction · 0.90
readConfigContentFunction · 0.85

Tested by

no test coverage detected