@jungvonmatt/sb-migrate
Version:
CLI tool for managing Storyblok schema and content migrations
30 lines (29 loc) • 1.36 kB
TypeScript
/**
* Generates TypeScript type definitions from Storyblok components schema.
*
* This function performs the following steps:
* 1. Loads the Storyblok configuration to get the space ID
* 2. Locates the components schema file (components.{spaceId}.json)
* 3. Creates the output directory if it doesn't exist
* 4. Generates TypeScript types using storyblok-generate-ts
* 5. Enhances the generated types by:
* - Adding SbBlokData extension to component interfaces
* - Adding custom type parsers for special fields (colorpicker, seo-metatags)
* - Adding proper imports and documentation
*
* @throws {Error} If any of the following conditions are met:
* - No Storyblok Space ID is found in the configuration
* - Components schema file is not found
* - Type generation fails
*
* @requires storyblok-generate-ts - For generating TypeScript types from Storyblok components
* @requires config - A valid configuration with a Space ID must exist
* @requires components.{spaceId}.json - The Storyblok components schema file
*
* @remarks
* - Generated types will be saved to 'storyblok/types/storyblok.gen.d.ts'
* - Generated types include custom parsers for:
* - Color picker fields (storyblok-colorpicker, native-color-picker)
* - SEO meta tags fields (seo-metatags)
*/
export declare function generateTypes(): Promise<void>;