dependency-cruiser-fork
Version:
Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.
28 lines (23 loc) • 812 B
JavaScript
const Handlebars = require("handlebars/runtime");
const { folderNameArrayToRE } = require("./environment-helpers");
/* eslint import/no-unassigned-import: 0 */
require("./config.js.template");
/**
* Creates a .dependency-cruiser config with a set of basic validations
* to the current directory.
*
* @returns {void} Nothing
* @param {any} pNormalizedInitOptions Options that influence the shape of
* the configuration
*/
module.exports = function buildConfig(pNormalizedInitOptions) {
return Handlebars.templates["config.js.template.hbs"]({
...pNormalizedInitOptions,
...{
sourceLocationRE: folderNameArrayToRE(
pNormalizedInitOptions.sourceLocation
),
testLocationRE: folderNameArrayToRE(pNormalizedInitOptions.testLocation),
},
});
};