Skip to content

Commit

Permalink
Add defineConfig helper for main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Jan 13, 2025
1 parent 861625a commit e280ec0
Show file tree
Hide file tree
Showing 21 changed files with 101 additions and 0 deletions.
5 changes: 5 additions & 0 deletions code/core/src/common/defineConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { StorybookConfig } from '../types/modules/core-common';

export function defineConfig<TConfig extends StorybookConfig>(config: TConfig): TConfig {
return config;
}
1 change: 1 addition & 0 deletions code/core/src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export * from './utils/formatter';
export * from './utils/get-story-id';
export * from './utils/posix';
export * from './js-package-manager';
export * from './defineConfig';

export { versions };

Expand Down
5 changes: 5 additions & 0 deletions code/frameworks/angular/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import { CompatibleString } from 'storybook/internal/types';

import {
Expand Down Expand Up @@ -48,3 +49,7 @@ export interface AngularOptions {
enableIvy?: boolean;
enableNgcc?: boolean;
}

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/ember/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type { CompatibleString } from 'storybook/internal/types';

import type {
Expand Down Expand Up @@ -48,3 +49,7 @@ declare global {
// eslint-disable-next-line no-underscore-dangle, @typescript-eslint/naming-convention, no-var
var __EMBER_GENERATED_DOC_JSON__: any;
}

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/experimental-nextjs-vite/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type { CompatibleString } from 'storybook/internal/types';

import type { BuilderOptions } from '@storybook/builder-vite';
Expand Down Expand Up @@ -32,3 +33,7 @@ type StorybookConfigFramework = {
/** The interface for Storybook configuration in `main.ts` files. */
export type StorybookConfig = Omit<StorybookConfigReactVite, keyof StorybookConfigFramework> &
StorybookConfigFramework;

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/html-vite/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type {
CompatibleString,
StorybookConfig as StorybookConfigBase,
Expand Down Expand Up @@ -36,3 +37,7 @@ export type StorybookConfig = Omit<
> &
StorybookConfigVite &
StorybookConfigFramework;

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/html-webpack5/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type { CompatibleString } from 'storybook/internal/types';

import type {
Expand Down Expand Up @@ -43,3 +44,7 @@ export type StorybookConfig = Omit<
> &
StorybookConfigWebpack &
StorybookConfigFramework;

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/nextjs/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type { CompatibleString } from 'storybook/internal/types';

import type {
Expand Down Expand Up @@ -48,3 +49,7 @@ export type StorybookConfig = Omit<
> &
StorybookConfigWebpack &
StorybookConfigFramework;

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/preact-vite/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type {
CompatibleString,
StorybookConfig as StorybookConfigBase,
Expand Down Expand Up @@ -36,3 +37,7 @@ export type StorybookConfig = Omit<
> &
StorybookConfigVite &
StorybookConfigFramework;

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/preact-webpack5/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type { CompatibleString } from 'storybook/internal/types';

import type {
Expand Down Expand Up @@ -43,3 +44,7 @@ export type StorybookConfig = Omit<
> &
StorybookConfigWebpack &
StorybookConfigFramework;

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/react-native-web-vite/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type { CompatibleString } from 'storybook/internal/types';

import type {
Expand Down Expand Up @@ -30,3 +31,7 @@ export type StorybookConfig = Omit<StorybookConfigBase, 'framework'> & {
options: FrameworkOptions;
};
};

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/react-vite/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type {
CompatibleString,
StorybookConfig as StorybookConfigBase,
Expand Down Expand Up @@ -63,3 +64,7 @@ export type StorybookConfig = Omit<
StorybookConfigFramework & {
typescript?: Partial<TypescriptOptions>;
};

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/react-webpack5/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type { CompatibleString } from 'storybook/internal/types';

import type {
Expand Down Expand Up @@ -44,3 +45,7 @@ export type StorybookConfig = Omit<
> &
StorybookConfigWebpack &
StorybookConfigFramework;

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/server-webpack5/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type { CompatibleString } from 'storybook/internal/types';

import type {
Expand Down Expand Up @@ -43,3 +44,7 @@ export type StorybookConfig = Omit<
> &
StorybookConfigWebpack &
StorybookConfigFramework;

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/svelte-vite/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type {
CompatibleString,
StorybookConfig as StorybookConfigBase,
Expand Down Expand Up @@ -36,3 +37,7 @@ export type StorybookConfig = Omit<
> &
StorybookConfigVite &
StorybookConfigFramework;

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/svelte-webpack5/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type { CompatibleString } from 'storybook/internal/types';

import type {
Expand Down Expand Up @@ -44,3 +45,7 @@ export type StorybookConfig = Omit<
> &
StorybookConfigWebpack &
StorybookConfigFramework;

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/sveltekit/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type {
CompatibleString,
StorybookConfig as StorybookConfigBase,
Expand Down Expand Up @@ -63,3 +64,7 @@ export type SvelteKitParameters = Partial<{
enhance: typeof enhance;
};
}>;

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/vue3-vite/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type {
CompatibleString,
StorybookConfig as StorybookConfigBase,
Expand Down Expand Up @@ -99,3 +100,7 @@ export type VueDocgenInfoEntry<
? VueDocgenInfo<'vue-component-meta'>[Exclude<TKey, 'expose'>]
: VueDocgenInfo<'vue-docgen-api'>[Exclude<TKey, 'exposed'>]
>;

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/vue3-webpack5/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type { CompatibleString } from 'storybook/internal/types';

import type {
Expand Down Expand Up @@ -43,3 +44,7 @@ export type StorybookConfig = Omit<
> &
StorybookConfigWebpack &
StorybookConfigFramework;

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/web-components-vite/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type {
CompatibleString,
StorybookConfig as StorybookConfigBase,
Expand Down Expand Up @@ -36,3 +37,7 @@ export type StorybookConfig = Omit<
> &
StorybookConfigVite &
StorybookConfigFramework;

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}
5 changes: 5 additions & 0 deletions code/frameworks/web-components-webpack5/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defineConfig as commonDefineConfig } from 'storybook/internal/common';
import type {
CompatibleString,
StorybookConfig as StorybookConfigBase,
Expand Down Expand Up @@ -43,3 +44,7 @@ export type StorybookConfig = Omit<
> &
StorybookConfigWebpack &
StorybookConfigFramework;

export function defineConfig(config: StorybookConfig) {
return commonDefineConfig<StorybookConfig>(config);
}

0 comments on commit e280ec0

Please sign in to comment.