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;

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'));
  const storybookCustomManagerPath = getInterpretedFile(path.resolve(configDir, 'manager'));

  if (storybookCustomAddonsPath || storybookCustomManagerPath) {
    logger.info('=> Loading custom addons config.');
  }

  return [].concat(storybookCustomAddonsPath || []).concat(storybookCustomManagerPath || []);
}

export default loadCustomAddons;

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