charlierudolph / dependency-lint

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

Windows support #43

Closed nfriedly closed 7 years ago

nfriedly commented 7 years ago

Dependency Lint appears to run some bash scripts that don't work on windows, is this reasonably easy to resolve?

C:\WORK\2017Q1\wdc-node-sdk\node_modules\.bin\dependency-lint:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^
SyntaxError: missing ) after argument list
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:513:28)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\WORK\2017Q1\wdc-node-sdk\test\dependency-lint.js:4:3)
    at Module._compile (module.js:541:32)

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "lint"
npm ERR! node v6.3.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! watson-developer-cloud@2.18.0 lint: `npm run compat-check && eslint . && node test/dependency-lint.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the watson-developer-cloud@2.18.0 lint script 'npm run compat-check && eslint . && node test/dependency-lint.js

See https://github.com/watson-developer-cloud/node-sdk/pull/394#issuecomment-280238326 for context

nfriedly commented 7 years ago

Actually, I'm not sure where that code is coming from. This might be a problem on my side...

charlierudolph commented 7 years ago

I don't believe that code appears anywhere in this codebase.

Based on the stacktrace, it appears the error may be coming from:

C:\WORK\2017Q1\wdc-node-sdk\test\dependency-lint.js:4:3

Whats the content of that file? Also what version of dependency lint are you using?

boazdavid commented 7 years ago

my package.json requires:

"devDependencies": {
    ....
    "dependency-lint": "^4.2.0",

the content of: C:\WORK\2017Q1\wdc-node-sdk\test\dependency-lint.js:4:3:

'use strict';
const node_version = parseInt(process.versions.node, 10);
if (node_version >= 4) {
  require('../node_modules/.bin/dependency-lint');
} else {
  // eslint-disable-next-line no-console
  console.log('skipping dependency lint for older versions of Node.js');
}
nfriedly commented 7 years ago

Yea, that file isn't necessary any more and, although I don't understand why, when I delete it and have the npm script just run dependency-lint directly, it starts working correctly on windows. So I still don't understand the issue, but I don't think it's in this repo. Sorry for wasting your time with this.