import path from 'path';
import { logger } from '@storybook/node-logger';

import { getInterpretedFile } from './interpret-files';

function loadCustomAddons({ configDir }) {
  const storybookCustomAddonsPath = getInterpretedFile(path.resolve(configDir, 'addons'));

  if (storybookCustomAddonsPath) {
    logger.info('=> Loading custom addons config.');
    return [storybookCustomAddonsPath];
  }

  return [];
}

export default loadCustomAddons;

@@ -258,16 +258,109 @@
 dons'));
+%0A  const storybookCustomManagerPath = getInterpretedFile(path.resolve(configDir, 'manager'));
 %0A%0A  if (
@@ -384,16 +384,46 @@
 donsPath
+ %7C%7C storybookCustomManagerPath
 ) %7B%0A    
@@ -473,16 +473,19 @@
 g.');%0A  
+%7D%0A%0A
   return
@@ -486,16 +486,25 @@
 return %5B
+%5D.concat(
 storyboo
@@ -524,27 +524,56 @@
 Path
-%5D;%0A  %7D%0A%0A  return
+ %7C%7C %5B%5D).concat(storybookCustomManagerPath %7C%7C
  %5B%5D
+)
 ;%0A%7D%0A

ADD support for manager.js as a replacement for addons.js