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.13.0 to 1.14.0

src/cli/initRules.js

40

doc/rules.starter.json

@@ -10,12 +10,12 @@ {

"name": "not-to-spec",
"comment": "Don't allow dependencies to (typescript or javascript) spec files",
"comment": "Don't allow dependencies to (typescript/ javascript/ coffeescript) spec files",
"severity": "error",
"from": {},
"to": { "path": "\\.spec\\.[jt]s$" }
"to": { "path": "\\.spec\\.[js|ts|ls|coffee|litcoffee|coffee\\.md]$" }
},{
"name": "not-to-core-punycode",
"comment": "Warn about dependencies on the (deprecated) 'punycode' core module (use the userland punycode module instead).",
"name": "no-deprecated-core",
"comment": "Warn about dependencies on deprecated core modules.",
"severity": "warn",
"from": {},
"to": { "coreModule": true, "path": "^punycode$" }
"to": { "dependencyTypes": ["core"], "path": "^(punycode|domain)$" }
},{

@@ -27,3 +27,33 @@ "name": "not-to-unresolvable",

"to": { "couldNotResolve": true }
},{
"name": "not-to-dev-dep",
"severity": "error",
"comment": "Don't allow dependencies from src/app/lib to a development only package",
"from": { "path": "^(src|app|lib)" },
"to": { "dependencyTypes": ["npm-dev"] }
},{
"name": "no-non-package-json",
"severity": "error",
"comment": "Don't allow dependencies to packages not in package.json (except from within node_modules)",
"from": { "pathNot": "^node_modules"},
"to": { "dependencyTypes": ["unknown", "undetermined", "npm-no-pkg", "npm-unknown"] }
},{
"name": "optional-deps-used",
"severity": "info",
"comment": "nothing serious - but just check you have some serious try/ catches around the import/ requires of these",
"from": {},
"to": { "dependencyTypes": ["npm-optional"] }
},{
"name": "peer-deps-used",
"comment": "Warn about the use of a peer dependency (peer dependencies are deprecated with the advent of npm 3 - and probably gone with version 4).",
"severity": "warn",
"from": {},
"to": { "dependencyTypes": ["npm-peer"] }
},{
"name": "no-duplicate-dep-types",
"comment": "Warn if a dependency occurs in your package.json more than once (technically: has more than one dependency type)",
"severity": "warn",
"from": {},
"to": { "moreThanOneDependencyType": true }
}]
}

5

package.json
{
"name": "dependency-cruiser",
"version": "1.13.0",
"version": "1.14.0",
"description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",

@@ -29,3 +29,4 @@ "bin": {

"CommonJS",
"validation"
"validation",
"static analysis"
],

@@ -32,0 +33,0 @@ "author": "Sander Verweij",

@@ -28,8 +28,10 @@ "use strict";

.option("-T, --output-type <type>", `output type - html|dot|err|json
(default:json)`)
.option("-P --prefix <prefix>")
(default: json)`)
.option("-P, --prefix <prefix>", "prefix to use for links in the svg reporter")
.option("--init-rules", `write a .dependency-cruiser.json with basic
validations to the current folder.`)
.arguments("<files-or-directories>")
.parse(process.argv);
if (Boolean(program.args[0]) || program.info) {
if (Boolean(program.args[0]) || program.info || program.initRules) {
processCLI(

@@ -36,0 +38,0 @@ program.args,

@@ -6,2 +6,3 @@ "use strict";

const normalizeOptions = require("./normalizeOptions");
const initRules = require("./initRules");
const main = require("../main");

@@ -32,6 +33,9 @@ const readRuleSet = require('../validate/readRuleSet');

module.exports = (pFileDirArray, pOptions) => {
if (pOptions && pOptions.info === true) {
process.stdout.write(formatMetaInfo());
} else {
try {
try {
if (pOptions && pOptions.info === true) {
process.stdout.write(formatMetaInfo());
} else if (pOptions && pOptions.initRules === true){
initRules();
process.stdout.write(`\n Successfully created '.dependency-cruiser.json'\n\n`);
} else {
validateParameters(pFileDirArray, pOptions);

@@ -54,6 +58,5 @@ pOptions = normalizeOptions(pOptions);

}
} catch (e) {
process.stderr.write(`ERROR: ${e.message}`);
}
} catch (e) {
process.stderr.write(`\n ERROR: ${e.message}\n`);
}

@@ -60,0 +63,0 @@ };

@@ -31,5 +31,5 @@ "use strict";

If you need a currently-not-enabled transpiler (those with a '${chalk.red(figures.cross)}'), just
install it. E.g. 'npm install --save-dev livescript' will enable livescript
support.
If you need a supported, but not enabled transpiler ('${chalk.red(figures.cross)}' below), just install
it in the same folder dependency-cruiser is installed. E.g. 'npm i livescript'
will enable livescript support if it's installed in your project folder.

@@ -36,0 +36,0 @@ Transpilers:

@@ -24,3 +24,2 @@ "use strict";

/* eslint complexity: 0 */
function matchRule(pFrom, pTo) {

@@ -27,0 +26,0 @@ return pRule =>

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