"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const logger_1 = require("./logger");
const child_process_1 = require("child_process");
const logger = logger_1.log('npm');
exports.getRawTree = (cwd) => {
    const cmd = 'npm ls --prod=true --json=true --long=true --silent';
    logger.debug('Running cmd to get external dependencies', { cmd, cwd });
    const npmOutput = child_process_1.execSync(cmd, { cwd }).toString();
    logger.debug('Parsing command output');
    try {
        return JSON.parse(npmOutput);
    }
    catch (e) {
        logger.error('Error parsing NPM output !', e);
        throw e;
    }
};
//# sourceMappingURL=npm.js.map