Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deedee

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deedee - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

coverage/coverage.json

11

lib/deedee-cli.js

@@ -18,8 +18,15 @@ #!/usr/bin/env node

var argv = _yargs2.default.usage('Detects your project\'s dependencies.\n\nUsage: $0 [path-to-project]').version('v', _package2.default.version).alias('v', 'version').help('h').alias('help', 'h').argv;
var cli = _yargs2.default.usage('Detects project dependencies.\nUsage: deedee [path-to-project] [options]').example('deedee ~/npm/yargs -r').help('help').alias('h', 'help').boolean('r').alias('r', 'recursive').describe('r', 'Detects dependencies in nested projects').version('v', _package2.default.version).alias('v', 'version');
if (require.main === module) {
cli.demand(1);
}
var argv = cli.argv;
var options = {
path: argv._[0]
path: argv._[0],
recursive: argv.recursive
};
(0, _deedee2.default)(options);

98

lib/deedee.js

@@ -8,44 +8,34 @@ 'use strict';

exports.default = function (options) {
var packageJsonPath = options.path + '/package.json';
var bowerJsonPath = options.path + '/bower.json';
if (_fs2.default.existsSync(packageJsonPath)) {
console.log(_os2.default.EOL);
if (options.recursive) {
var packageJson = JSON.parse(_fs2.default.readFileSync(packageJsonPath));
var walker = _walk2.default.walk(options.path, {
followLinks: false,
filters: ['node_modules', 'bower_components']
});
detectNodeDependencies(packageJson);
walker.on('file', function (root, fstat, next) {
if (fstat.name == 'package.json') {
detectNode(root);
}
console.log(_os2.default.EOL);
if (fstat.name == 'bower.json') {
detectBower(root);
}
next();
});
} else {
var packageJsonPath = options.path + '/package.json';
var bowerJsonPath = options.path + '/bower.json';
detectNodeDevDependencies(packageJson);
}
if (_fs2.default.existsSync(packageJsonPath)) {
detectNode(options.path);
}
if (_fs2.default.existsSync(bowerJsonPath)) {
console.log(_os2.default.EOL);
var bowerJson = JSON.parse(_fs2.default.readFileSync(options.path + '/bower.json'));
detectBowerDependencies(bowerJson);
console.log(_os2.default.EOL);
detectBowerDevDependencies(bowerJson);
if (_fs2.default.existsSync(bowerJsonPath)) {
detectBower(options.path);
}
}
console.log(_os2.default.EOL);
if (_fs2.default.existsSync(bowerJsonPath)) {
console.log(_os2.default.EOL);
var _bowerJson = JSON.parse(_fs2.default.readFileSync(options.path + '/bower.json'));
detectBowerDependencies(_bowerJson);
console.log(_os2.default.EOL);
detectBowerDevDependencies(_bowerJson);
}
console.log(_os2.default.EOL);
};

@@ -61,2 +51,6 @@

var _path = require('path');
var _path2 = _interopRequireDefault(_path);
var _chalk = require('chalk');

@@ -70,6 +64,9 @@

var _walk = require('walk');
var _walk2 = _interopRequireDefault(_walk);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function detectNodeDependencies(json) {
console.log(_chalk2.default.bgBlue('Node.js: devDependencies'));
var out = [];

@@ -85,3 +82,2 @@ for (var dep in json.devDependencies) {

function detectNodeDevDependencies(json) {
console.log(_chalk2.default.bgGreen('Node.js: dependencies'));
var out = [];

@@ -97,3 +93,2 @@ for (var dep in json.dependencies) {

function detectBowerDependencies(json) {
console.log(_chalk2.default.bgRed("Bower: dependencies"));
var out = [];

@@ -109,3 +104,2 @@ for (var dep in json.dependencies) {

function detectBowerDevDependencies(json) {
console.log(_chalk2.default.bgMagenta("Bower: devDependencies"));
var out = [];

@@ -118,2 +112,32 @@ for (var dep in json.devDependencies) {

console.log((0, _textTable2.default)(out));
}
function detectNode(root) {
var configPath = _path2.default.join(root, 'package.json');
var packageJson = JSON.parse(_fs2.default.readFileSync(configPath));
var projectName = packageJson.name;
console.log(_os2.default.EOL);
console.log(_chalk2.default.bgBlue(projectName + ' - package.json (dependencies)'));
detectNodeDependencies(packageJson);
console.log(_os2.default.EOL);
console.log(_chalk2.default.bgGreen(projectName + ' - package.json (devDependencies)'));
detectNodeDevDependencies(packageJson);
}
function detectBower(root, filename) {
var configPath = _path2.default.join(root, 'bower.json');
var bowerJson = JSON.parse(_fs2.default.readFileSync(configPath));
var projectName = bowerJson.name;
console.log(_os2.default.EOL);
console.log(_chalk2.default.bgRed(projectName + ' - bower.json (dependencies)'));
detectBowerDependencies(bowerJson);
console.log(_os2.default.EOL);
console.log(_chalk2.default.bgMagenta(projectName + ' - bower.json (devDependencies)'));
detectBowerDevDependencies(bowerJson);
}
{
"name": "deedee",
"version": "1.0.2",
"version": "1.0.3",
"description": "A tool for detecting project dependencies.",

@@ -13,7 +13,8 @@ "license": "MIT",

"precoverage": "npm run build",
"coverage": "./node_modules/.bin/babel-node ./node_modules/.bin/babel-istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -R spec",
"coverage": "./node_modules/.bin/babel-node ./node_modules/babel-istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec",
"precoveralls": "npm run coverage",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"coveralls": "cat ./coverage/lcov.info | node ./node_modules/coveralls/bin/coveralls.js",
"prepublish": "npm run build",
"test": "npm run build && mocha --compilers js:babel-core/register"
"pretest": "npm run build",
"test": "mocha --compilers js:babel-core/register"
},

@@ -42,4 +43,5 @@ "devDependencies": {

"text-table": "^0.2.0",
"walk": "^2.3.9",
"yargs": "^4.3.1"
}
}

@@ -21,2 +21,6 @@ # deedee

## Features
- [x] Recursive/Nested Projects
## Installation

@@ -23,0 +27,0 @@

/* global describe, it */
import chai from 'chai';
import {
exec
} from 'child-process-promise';
import { exec } from 'child-process-promise';
import 'babel-polyfill';
import * as deedee from '../lib/deedee-cli.js';
import config from '../package.json';

@@ -27,2 +27,9 @@

});
it('should demand at least one non-option argument', () => {
exec('node ./lib/deedee-cli.js')
.then(proc => {
proc.stdout.should.match(/Not enough non-option arguments/);
});
});
});
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