snyk-php-plugin
Version:
Snyk CLI PHP plugin
20 lines • 959 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const childProcess = require("child_process");
exports.composerCmd = { command: 'composer', args: ['--version'] };
exports.composerShowCmd = { command: 'composer', args: ['show', '-p'] };
exports.pharCmd = { command: `php`, args: [`${path.resolve(path.resolve() + '/composer.phar')}`, 'show', '-p', '--format=json']
};
function cmdReturnsOk(cmd, args = []) {
const spawnOptions = { shell: false };
return cmd && childProcess.spawnSync(cmd, args, spawnOptions).status === 0;
}
exports.cmdReturnsOk = cmdReturnsOk;
// run a cmd in a specific folder and it's result should be there
function execWithResult(cmd, basePath, args = []) {
const spawnOptions = { cwd: basePath, shell: false };
return childProcess.spawnSync(cmd, args, spawnOptions).toString();
}
exports.execWithResult = execWithResult;
//# sourceMappingURL=composer-cmds.js.map
;