charlierudolph / dependency-lint

Lints NPM dependencies and devDependencies
MIT License
14 stars 6 forks source link

Follow symlinks #29

Closed kevgo closed 8 years ago

kevgo commented 8 years ago

There are newer package managers for Node out there that use symlinks, for example https://github.com/alexanderGugel/ied or https://github.com/rstacruz/pnpm. Dependency-lint is producing false errors for them. I think this is because it doesn't follow the symlink structure that they create in node_modules.

charlierudolph commented 8 years ago

What exactly are the false errors that are being produced?

kevgo commented 8 years ago

When running dependency-lint on https://github.com/Originate/nitroglycerin with dependencies installed via ied, I get the error: mocha (unused)

Mocha is used in bin/tests, which looks like this:

#!/usr/bin/env bash
set -e

if [ "$#" == "0" ]; then
  mocha --compilers ls:livescript spec
else
  mocha --compilers ls:livescript "$@"
fi

A traditional install using NPM3 works correctly without dependency-lint errors.

IED changes the structure of the node_modules folder to contain symlinks to folders in the .cas directory. I assume dependency-lint is unable to follow these symlinks, hence it doesn't see the mocha binary in node_modules/.cas/161be5bdeb496771eb9b35745050b622b5aefc58/package/bin, and thinks mocha is unused.

Here is the structure of my node_modules folder for reference:

drwxr-xr-x   23 kevin  staff   782B Jul 11 12:04 .
drwxr-xr-x   18 kevin  staff   612B Jul 11 12:04 ..
drwxr-xr-x   15 kevin  staff   510B Jul 11 12:04 .bin
drwxr-xr-x  374 kevin  staff    12K Jul 11 12:04 .cas
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 chai -> .cas/4d02637b067fe958bdbfdd3a40ec56fef7373247/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 coveralls -> .cas/f9ff01a1adbf22a129e35a8d62345a52a781b395/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 dependency-lint -> .cas/83a1ec93a1b9d7427b68075a57029e3a0bb735da/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 gulp -> .cas/571ce45928dd40af6514fc4011866016c13845b4/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 gulp-concat -> .cas/585cfb115411f348773131140566b6a81c69cb91/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 gulp-exit -> .cas/082313548683ad0ab05d430d7a563330d4e61370/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 gulp-header -> .cas/e456f9390e5c86102d8f9b1fc49ca8f2b8902e0c/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 gulp-livescript -> .cas/d2d7e068c22921c1a573d6683946018a65f9cdb0/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 gulp-livescript-istanbul -> .cas/c50106ea1d8207519e44df66cc6edd23a0eca56f/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 gulp-mocha -> .cas/1ce5eba4b94b40c7436afec3c4982c8eea894192/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 gulp-uglify -> .cas/524788d87666d09f9d0c21fb2177f90039a658c9/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 gulp-util -> .cas/78925c4b8f8b49005ac01a011c557e6218941cbb/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 livescript -> .cas/4fe7121c41217e4608e334eb9cbe1762e63e5566/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 mocha -> .cas/161be5bdeb496771eb9b35745050b622b5aefc58/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 mocha-circleci-reporter -> .cas/9751273e919e8ea7c9e2d2128e18c374b0f4a817/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 o-tools -> .cas/3cd428e19d88718f403e7f0925c7b4be74495215/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 o-tools-livescript -> .cas/e07e67de0554a343e3f6f5c8953cefd3ee7d06ff/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 sinon -> .cas/4e4ff4d84b20adee13138f36acb132ca1cd72c83/package
lrwxr-xr-x    1 kevin  staff    53B Jul 11 12:04 sinon-chai -> .cas/432a9bbfd51a6fc00798f4d2526a829c060687ac/package

Running mocha itself works as expected.

Thanks!

charlierudolph commented 8 years ago

Alright, based on a short discussion with you I believe we need to update how we connect the executables with what module exposes them. Currently it is looking at the symlinks in the node_modules/.bin. Instead should probably just read the bin section of the each module's package.json.