MCPcopy Index your code
hub / github.com/commitizen/cz-cli / getNearestNodeModulesDirectory

Function getNearestNodeModulesDirectory

src/commitizen/adapter.js:87–100  ·  view source on GitHub ↗

* Gets the nearest npm_modules directory

(options)

Source from the content-addressed store, hash-verified

85 * Gets the nearest npm_modules directory
86 */
87function getNearestNodeModulesDirectory (options) {
88
89 // Get the nearest node_modules directories to the current working directory
90 let nodeModulesDirectories = findNodeModules(options);
91
92 // Make sure we find a node_modules folder
93
94 /* istanbul ignore else */
95 if (nodeModulesDirectories && nodeModulesDirectories.length > 0) {
96 return nodeModulesDirectories[0];
97 } else {
98 console.error(`Error: Could not locate node_modules in your project's root directory. Did you forget to npm init or npm install?`)
99 }
100}
101
102/**
103 * Gets the nearest project root directory

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected