mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
47044a11e1
Renovate now uses an embedded yarn binary. This way, the version of yarn used can be known + there is no requirement for Renovate admins to install yarn separately.
25 lines
696 B
JavaScript
25 lines
696 B
JavaScript
const cp = require('child_process');
|
|
const tmp = require('tmp');
|
|
const root = require('root-require');
|
|
|
|
module.exports = {
|
|
detectVersions,
|
|
};
|
|
|
|
function detectVersions(config) {
|
|
config.logger.debug('Detecting versions');
|
|
const versions = {};
|
|
try {
|
|
versions.renovate = root('package.json').version;
|
|
const tmpDir = tmp.dirSync({ unsafeCleanup: true });
|
|
const result = cp.spawnSync('npm', ['--version'], {
|
|
cwd: tmpDir.name,
|
|
shell: true,
|
|
});
|
|
versions.npm = result.stdout.toString().split('\n')[0];
|
|
} catch (err) {
|
|
config.logger.error({ err }, 'Error detecting versions');
|
|
}
|
|
config.logger.debug({ versions }, 'Detected versions');
|
|
return versions;
|
|
}
|