linterhub / registry

Registry provides an interface for obtaining information about packages from various package managers
MIT License
1 stars 3 forks source link

Improve npm dependencies parsing #26

Closed romanrostislavovich closed 6 years ago

romanrostislavovich commented 6 years ago

NPM Package dependencies have devDependencies and dependencies, e.g.:

 "dependencies": {
    "optimist": "*",
    "astw": "*",
    "esprima": "*",
    "jshint": "*"
},
"devDependencies": {
    "vows": "~0.7.0",
    "istanbul": "~0.1.10",
    "sinon": "*",
},

This is all dependencies for eslint v0.0.4. I suggest creating separate property dev for dependency package.

New property dev is false by default, but if package use only for development we set true.

Result by parsing for eslint 0.0.4 look like:

[
    { manager: 'npm', package: 'optimist', version: '*' },
    { manager: 'npm', package: 'astw', version: '*' },
    { manager: 'npm', package: 'esprima', version: '*' },
    { manager: 'npm', package: 'jshint', version: '*' },
    { manager: 'npm', package: 'vows', version: '~0.7.0', dev: true },
    { manager: 'npm', package: 'istanbul', version: '~0.1.10', dev: true },
    { manager: 'npm', package: 'sinon', version: '*', dev: true },
]
romanrostislavovich commented 6 years ago

This purpose with new property actual for gem and composer package managers too

romanrostislavovich commented 6 years ago

So, we need to return only dependencies, which needs for correct works of the app. Please, check the getDeps method for all managers

doroxz-zz commented 6 years ago

We don't need devDependencies. They are used for listing, building and testing. So, published npm package can be executed without them.