Skip to content
Snippets Groups Projects
Commit c15cfb64 authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

fix: refactor package file detection to not modify deep state (#923)

parent 19949f26
No related branches found
No related tags found
No related merge requests found
......@@ -570,7 +570,7 @@ const options = [
description: 'Configuration object for npm package.json renovation',
stage: 'repository',
type: 'json',
default: {},
default: { enabled: true },
mergeable: true,
},
{
......
......@@ -235,12 +235,12 @@ async function mergeRenovateJson(config, branchName) {
return returnConfig;
}
async function detectPackageFiles(input) {
async function detectPackageFiles(input, detectAllLanguages = false) {
const config = { ...input };
const { logger } = config;
logger.debug({ config }, 'detectPackageFiles');
config.types = {};
if (config.npm.enabled !== false) {
if (detectAllLanguages || config.npm.enabled) {
config.packageFiles = await config.api.findFilePaths('package.json');
logger.debug(
{ packageFiles: config.packageFiles },
......@@ -290,7 +290,7 @@ async function detectPackageFiles(input) {
config.types.npm = true;
}
}
if (config.meteor.enabled) {
if (detectAllLanguages || config.meteor.enabled) {
logger.debug('Detecting meteor package.js files');
const meteorPackageFiles = await config.api.findFilePaths(
'package.js',
......@@ -305,7 +305,7 @@ async function detectPackageFiles(input) {
config.packageFiles = config.packageFiles.concat(meteorPackageFiles);
}
}
if (config.docker.enabled) {
if (detectAllLanguages || config.docker.enabled) {
logger.debug('Detecting Dockerfiles');
const dockerFiles = await config.api.findFilePaths('Dockerfile');
if (dockerFiles.length) {
......
......@@ -25,9 +25,9 @@ async function isRepoPrivate(config) {
async function createOnboardingBranch(inputConfig) {
let config = { ...inputConfig };
const { logger } = config;
config.meteor.enabled = true;
config.docker.enabled = true;
config = await apis.detectPackageFiles(config);
logger.debug('Creating onboarding branch');
const detectAllLanguages = true;
config = await apis.detectPackageFiles(config, detectAllLanguages);
if (config.packageFiles.length === 0) {
throw new Error('no package files');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment