If all else fails, you can write a Node.js script that does require('./package.json') and inspect the resulting object's dependencies, peerDependencies, and devDependencies values.
This won't tell you if they're actually installed yet or not, and it won't tell you about transitive dependencies.
npm offers ways to omit dev and peer dependencies from npm ls but not production dependencies, and I imagine that might be the issue you're running into. This is a clunky workaround for that.
Once you've done this to get a list of peer and dev dependencies, you can use child_process to run npm ls on each to see if they are actually installed.
This is not an elegant solution, but if nothing else is working, it should at least work.
> require('./package.json').devDependencies
{
'@semantic-release/changelog': '^6.0.0',
'@semantic-release/git': '^10.0.0',
chai: '^4.2.0',
karma: '^6.0.2',
'karma-chai': '^0.1.0',
'karma-chrome-launcher': '^3.1.0',
'karma-coverage': '^2.0.3',
'karma-firefox-launcher': '^2.0.0',
'karma-ie-launcher': '^1.0.0',
'karma-jasmine': '^4.0.0',
'karma-mocha': '^2.0.1',
mocha: '^9.0.0',
nyc: '^15.0.1',
requirejs: '^2.3.6',
'semantic-release': '^18.0.0',
standard: '^16.0.0'
}
> Object.keys(require('./package.json').devDependencies)
[
'@semantic-release/changelog',
'@semantic-release/git',
'chai',
'karma',
'karma-chai',
'karma-chrome-launcher',
'karma-coverage',
'karma-firefox-launcher',
'karma-ie-launcher',
'karma-jasmine',
'karma-mocha',
'mocha',
'nyc',
'requirejs',
'semantic-release',
'standard'
]
>