Socket
Socket
Sign inDemoInstall

dependency-cruiser

Package Overview
Dependencies
Maintainers
1
Versions
533
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dependency-cruiser - npm Package Compare versions

Comparing version 1.5.1 to 1.5.2

7

package.json
{
"name": "dependency-cruiser",
"version": "1.5.1",
"description": "Visualize and validate javascript dependencies. With your rules. ES6, CommonJS, AMD",
"version": "1.5.2",
"description": "Validate and visualize javascript dependencies. With your rules. ES6, CommonJS, AMD",
"bin": {

@@ -32,3 +32,3 @@ "dependency-cruiser": "bin/dependency-cruise",

"chai": "3.5.0",
"eslint": "3.11.0",
"eslint": "3.11.1",
"eslint-plugin-security": "1.2.0",

@@ -56,2 +56,3 @@ "intercept-stdout": "0.1.2",

"lodash": "4.17.2",
"log-symbols": "1.0.2",
"resolve": "1.1.7",

@@ -58,0 +59,0 @@ "safe-regex": "1.1.0",

@@ -41,11 +41,2 @@ "use strict";

function calculateExitCode(pDependencyList, pOutputType) {
const ERROR_CHROME_OFFSET = 5;
if (pOutputType !== "err") {
return 0;
}
return pDependencyList.split('\n').length - ERROR_CHROME_OFFSET;
}
module.exports = (pDirOrFile, pOptions) => {

@@ -60,7 +51,7 @@ try {

);
let lExitCode = calculateExitCode(lDependencyList, pOptions.outputType);
let lExitCode = lDependencyList.meta ? lDependencyList.meta.error : 0;
write(
pOptions.outputTo,
lDependencyList
lDependencyList.content
);

@@ -67,0 +58,0 @@

@@ -9,7 +9,9 @@ "use strict";

function render(pInput) {
return Handlebars.templates['csv.template.hbs']({
"things" : dependencyToIncidenceTransformer.transform(pInput)
});
return {
content: Handlebars.templates['csv.template.hbs']({
"things" : dependencyToIncidenceTransformer.transform(pInput)
})
};
}
module.exports = render;

@@ -39,4 +39,4 @@ "use strict";

{
incidences: pFromList.map(pFromListEntry => {
return Object.assign(
incidences: pFromList.map(pFromListEntry =>
Object.assign(
{

@@ -46,4 +46,4 @@ to: pFromListEntry.source

determineIncidenceType(pFromListEntry)(pDependency)
);
})
)
)
}

@@ -61,3 +61,1 @@ );

exports.transform = transform;
/* eslint arrow-body-style: 0 */

@@ -70,7 +70,9 @@ "use strict";

function render(pInput) {
return Handlebars.templates['dot.template.hbs']({
"things" : pInput.sort(compareOnSource).map(folderify).map(colorize)
});
return {
content: Handlebars.templates['dot.template.hbs']({
"things" : pInput.sort(compareOnSource).map(folderify).map(colorize)
})
};
}
module.exports = render;
"use strict";
const chalk = require('chalk');
const chalk = require('chalk');
const logSymbols = require('log-symbols');
const SEVERITY2CHALK = {
'error' : chalk.red,
'warn' : chalk.yellow,
'info' : chalk.cyan
'error' : chalk.red,
'warn' : chalk.yellow,
'info' : chalk.cyan
};

@@ -16,2 +17,6 @@

function formatMeta(pMeta) {
return `${pMeta.error} errors, ${pMeta.warn} warnings`;
}
function cutNonTransgressions(pSourceEntry) {

@@ -39,13 +44,31 @@ return {

if (lViolations.length === 0){
return "";
return {
content: ""
};
}
return lViolations.reduce(
(pAll, pThis) => `${pAll} ${formatError(pThis)}\n`,
"\n"
).concat(
chalk.red(`\n ${lViolations.length} violations found\n\n`)
let lMeta = lViolations.reduce(
(pAll, pThis) => {
pAll[pThis.rule.severity] += 1;
return pAll;
}
, {
error : 0,
warn : 0,
info : 0
}
);
return {
content: lViolations.reduce(
(pAll, pThis) => `${pAll} ${formatError(pThis)}\n`,
"\n"
).concat(
chalk.red(`\n${logSymbols.error} ${lViolations.length} violations (${formatMeta(lMeta)}) \n\n`)
),
meta: lMeta
};
}
module.exports = render;

@@ -12,4 +12,4 @@ "use strict";

{
incidences: pDependencyEntry.incidences.map(pIncidence => {
return Object.assign(
incidences: pDependencyEntry.incidences.map(pIncidence =>
Object.assign(
pIncidence,

@@ -19,4 +19,4 @@ {

}
);
})
)
)
}

@@ -27,9 +27,9 @@ );

function render(pInput) {
return Handlebars.templates['html.template.hbs']({
"things" : dependencyToIncidenceTransformer.transform(pInput).map(addShowTitle)
});
return {
content: Handlebars.templates['html.template.hbs']({
"things" : dependencyToIncidenceTransformer.transform(pInput).map(addShowTitle)
})
};
}
module.exports = render;
/* eslint arrow-body-style: 0 */
"use strict";
module.exports = pInput => JSON.stringify(pInput, null, " ");
module.exports = pInput => ({
content: JSON.stringify(pInput, null, " ")
});

@@ -59,3 +59,3 @@ "use strict";

it("renders a dot - modules in the root don't come in a cluster", () => {
expect(render(deps)).to.deep.equal(elFixture);
expect(render(deps).content).to.deep.equal(elFixture);
// console.log(render(deps));

@@ -62,0 +62,0 @@ // expect(1).to.equal(1);

@@ -10,4 +10,4 @@ "use strict";

it("renders a bunch of errors", () => {
expect(render(deps).split('\n').length).to.equal(NUMBER_OF_INVALID_DEPS_IN_FIXTURE);
expect(render(deps).content.split('\n').length).to.equal(NUMBER_OF_INVALID_DEPS_IN_FIXTURE);
});
});

@@ -273,3 +273,3 @@ "use strict";

it("renders html - modules in the root don't come in a cluster; and one module could not be resolved", () => {
expect(render(deps)).to.deep.equal(elFixture);
expect(render(deps).content).to.deep.equal(elFixture);
// console.log(render(deps));

@@ -276,0 +276,0 @@ // expect(1).to.equal(1);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc