Is there a Node API for the npm cli tools?
For example, if I want to do something like npm ls --json <package> in a Node program, do I need to use exec or is there a native node API I can use for this?
Ideal:
import { ls } from 'npm';
let dependencies = await ls('lodash');
non-ideal:
const util = require('node:util');
const exec = util.promisify(require('node:child_process').exec);
let dependencies = JSON.parse((await exec('npm ls --json lodash')).stdout)