Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function pkgFromRegistry(npmClient: NpmClient, options: Partial): Promise {
const [ manager, ...managerArgs ] = await pkgManagerArgs(npmClient, { command: 'info', json: true, ...options });
const cmd = new Subprocess(manager, managerArgs);
const result = await cmd.output();
if (result) {
const json = JSON.parse(result);
return manager === 'yarn' ? json.data : json;
}
}
async createSubprocess(command: string, args: readonly string[] = [], options: SubprocessOptions = {}): Promise {
const cmdpath = await this.resolveCommandPath(command, options);
const proc = new Subprocess(cmdpath, args, options);
return proc;
}