2018-05-07 10:59:32 +00:00
|
|
|
const { writeUpdates } = require('./write');
|
|
|
|
const { sortBranches } = require('./sort');
|
2018-05-09 06:03:59 +00:00
|
|
|
const { fetchUpdates } = require('./fetch');
|
2018-07-05 12:23:28 +00:00
|
|
|
const { raiseDeprecationWarnings } = require('./deprecated');
|
2018-05-09 06:03:59 +00:00
|
|
|
const { branchifyUpgrades } = require('../updates/branchify');
|
|
|
|
const { extractAllDependencies } = require('../extract');
|
2018-05-07 10:59:32 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
extractAndUpdate,
|
|
|
|
};
|
|
|
|
|
2018-05-09 06:03:59 +00:00
|
|
|
async function extractAndUpdate(config) {
|
|
|
|
logger.debug('extractAndUpdate()');
|
|
|
|
const packageFiles = await extractAllDependencies(config);
|
2018-05-28 20:25:33 +00:00
|
|
|
logger.trace({ config: packageFiles }, 'packageFiles');
|
2018-05-09 06:03:59 +00:00
|
|
|
await fetchUpdates(config, packageFiles);
|
2018-05-14 05:56:17 +00:00
|
|
|
logger.debug({ config: packageFiles }, 'packageFiles with updates');
|
2018-07-05 12:23:28 +00:00
|
|
|
await raiseDeprecationWarnings(config, packageFiles);
|
2018-05-09 06:03:59 +00:00
|
|
|
const { branches, branchList } = branchifyUpgrades(config, packageFiles);
|
2018-05-07 10:59:32 +00:00
|
|
|
sortBranches(branches);
|
|
|
|
let res;
|
|
|
|
if (config.repoIsOnboarded) {
|
2018-05-09 06:03:59 +00:00
|
|
|
res = await writeUpdates(config, packageFiles, branches);
|
2018-05-07 10:59:32 +00:00
|
|
|
}
|
|
|
|
return { res, branches, branchList, packageFiles };
|
|
|
|
}
|