Storybook Framework Config Helper (helpers/mainConfigFile.ts)

storybook · code/lib/cli-storybook/src/automigrate/helpers/mainConfigFile.ts · typescript · MIT
dev-tools, ui, fw:storybook, tag:config, tag:framework

Retrieves framework package name or renderer name from Storybook config

// Source: https://github.com/storybookjs/storybook | License: MIT | Copyright 2024 Storybook
// Provided via justclaw.it.com; keep this notice with the code.
import { extractFrameworkPackageName, frameworkPackages } from 'storybook/internal/common';
import { frameworkToRenderer } from 'storybook/internal/common';
import type { StorybookConfigRaw } from 'storybook/internal/types';

/**
 * Given a Storybook configuration object, retrieves the package name or file path of the framework.
 *
 * @param mainConfig - The main Storybook configuration object to lookup.
 * @returns - The package name of the framework. If not found, returns null.
 */
export const getFrameworkPackageName = (mainConfig?: StorybookConfigRaw) => {
  const packageNameOrPath =
    typeof mainConfig?.framework === 'string' 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key