diff --git a/packages/cli/src/commands/package-dynamic-plugins/command.ts b/packages/cli/src/commands/package-dynamic-plugins/command.ts index c7183f24b6..fb062f47f1 100644 --- a/packages/cli/src/commands/package-dynamic-plugins/command.ts +++ b/packages/cli/src/commands/package-dynamic-plugins/command.ts @@ -293,21 +293,16 @@ function discoverPluginConfigurationFile( ): string | undefined { // Possible file names, the first match will be used const supportedFilenames = [ + 'app-config.dynamic.example.yaml', + 'app-config.dynamic.yaml', 'app-config.janus-idp.yaml', 'app-config.backstage-community.yaml', + 'app-config.example.yaml', 'app-config.yaml', ]; return supportedFilenames - .map((fileName: string) => { - const candidate = path.join(directory, fileName); - return fs.existsSync(candidate); - }) - .reduce((val, current, index) => { - if (typeof val === 'undefined' && current) { - return path.join(directory, supportedFilenames[index]); - } - return val; - }, undefined); + .map(fileName => path.join(directory, fileName)) + .find(candidate => fs.existsSync(candidate)); } /**