How to use the @storybook/postinstall.getFrameworks function in @storybook/postinstall

To help you get started, we’ve selected a few @storybook/postinstall examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github storybookjs / storybook / addons / docs / postinstall / presets.js View on Github external
export default function transformer(file, api) {
  const packageJson = JSON.parse(fs.readFileSync('./package.json'));
  const frameworks = getFrameworks(packageJson);

  let err = null;
  let framework = null;
  let presetOptions = null;
  if (frameworks.length !== 1) {
    err = `${frameworks.length === 0 ? 'No' : 'Multiple'} frameworks found: ${frameworks}`;
    logger.error(`${err}, please configure '@storybook/addon-docs' manually.`);
    return file.source;
  }

  // eslint-disable-next-line prefer-destructuring
  framework = frameworks[0];

  const { dependencies, devDependencies } = packageJson;
  if (
    framework === 'react' &&

@storybook/postinstall

Storybook addons postinstall utilities

MIT
Latest version published 9 months ago

Package Health Score

91 / 100
Full package analysis