Norbert de Langen 852d1263d3
fixes
2022-08-10 11:20:47 +02:00

28 lines
661 B
TypeScript

import { logger } from '@storybook/client-logger';
import { deletedDiff } from 'deep-object-diff';
import { dedent } from 'ts-dedent';
import light from './themes/light';
import type { ThemeVars, StorybookTheme } from './types';
import { convert } from './convert';
export const ensure = (input: ThemeVars): StorybookTheme => {
if (!input) {
return convert(light);
}
const missing = deletedDiff(light, input);
if (Object.keys(missing).length) {
logger.warn(
dedent`
Your theme is missing properties, you should update your theme!
theme-data missing:
`,
missing
);
}
return convert(input);
};