{"id":18938841,"url":"https://github.com/forge-42/storyblok-generator","last_synced_at":"2025-04-15T19:30:32.989Z","repository":{"id":253961530,"uuid":"844939012","full_name":"forge-42/storyblok-generator","owner":"forge-42","description":"Generate Storyblok components out of your components.json file and get full type-safety and bundle splitting out of the box","archived":false,"fork":false,"pushed_at":"2024-08-23T15:23:13.000Z","size":98,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T06:35:44.660Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/forge-42.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.MD","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-20T09:09:10.000Z","updated_at":"2025-03-05T22:27:21.000Z","dependencies_parsed_at":"2024-08-23T17:18:25.224Z","dependency_job_id":null,"html_url":"https://github.com/forge-42/storyblok-generator","commit_stats":null,"previous_names":["forge42dev/storyblok-generator","forge-42/storyblok-generator"],"tags_count":6,"template":false,"template_full_name":"forge-42/open-source-stack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forge-42%2Fstoryblok-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forge-42%2Fstoryblok-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forge-42%2Fstoryblok-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forge-42%2Fstoryblok-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/forge-42","download_url":"https://codeload.github.com/forge-42/storyblok-generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249138545,"owners_count":21218905,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T12:15:36.565Z","updated_at":"2025-04-15T19:30:32.309Z","avatar_url":"https://github.com/forge-42.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Storyblok Generator\n\n![GitHub Repo stars](https://img.shields.io/github/stars/forge42dev/storyblok-generator?style=social)\n![npm](https://img.shields.io/npm/v/storyblok-generator?style=plastic)\n![GitHub](https://img.shields.io/github/license/forge42dev/storyblok-generator?style=plastic)\n![npm](https://img.shields.io/npm/dy/storyblok-generator?style=plastic)\n![npm](https://img.shields.io/npm/dw/storyblok-generator?style=plastic)\n![GitHub top language](https://img.shields.io/github/languages/top/forge42dev/storyblok-generator?style=plastic)\n\nStoryblok React component generator for Vite Storyblok apps (React/Remix.run).\n\n- Pulls in your components from Storyblok and generates the types for you.\n- Generates the components in either a file or folder structure.\n- Makes all components editable via the bridge by default.\n- Adds per component bundle splitting for better performance.\n- Adds full typesafety to your components.\n- Supports both kebab-case and camel-case file names.\n- Adds shortcuts to regenerate the components and types.\n\n## Setup\n\nTo get up and running quickly, you first install the vite plugin as a dev dependency in your project.\n\n```bash\nnpm install -D storyblok-generator\n```\n\nThen, in your `vite.config.ts` file, add the following:\n\n```typescript\nimport { storyblokPlugin } from \"storyblok-generator\"\n\nexport default defineConfig({\n\tplugins: [\n\t\tstoryblokPlugin({\n\t\t\tspaceId: \"\u003cyour space id\u003e\",\n\t\t\tcomponentsDir: \"./storyblok/components\",\n\t\t}),\n\t],\n})\n```\n\n## Usage\n\nOnce the plugin is installed and configured, it will generate the components and types for you. You can then import the components in your code and use them as you normally would.\n\n```typescript\nimport { components } from \"./storyblok/components\";\nimport { storyblokInit, apiPlugin } from \"@storyblok/react\"\n\nstoryblokInit({\n\taccessToken: \"\u003cyour access token\u003e\",\n\tuse: [apiPlugin],\n\t// You pass in the components here, the components will be lazy loaded when actually used.\n\tcomponents,\n})\n```\n\n### Storyblok CLI Caveats\n\nThe Plugin uses the Storyblok CLI to pull the components from your Storyblok space. This means that you need to have the CLI installed on your machine and available in your path.\n\nYou will also need to be logged in to the Storyblok CLI properly. You should login via SSO instead of\nusing the username and password combo as that keeps you logged in but after some time the login expires\nand you need to login again by first logging out and logging in again.\n\n\n## Configuration\n\nThe plugin accepts the following configuration options:\n\n| Option            | Type     |   Description   | Default | Required |\n| ----------------- | -------- | --------------- | ------- | -------- |\n| spaceId           | string   | Your Storyblok space ID. | - | Yes |\n| componentsDir     | string   | The directory where the components will be generated. | - | Yes |\n| typeFileLoc       | string   | The location of the type file.  | `./storyblok/types.d.ts` | No |\n| pullCommand       | string   | The command to use to pull the components from Storyblok via the CLI  | `storyblok pull-components --space \u003cspaceId\u003e --path \u003cpathToComponentsDir\u003e` | No |\n| typesCommand      | string   | The command to use to generate the types for the components via the CLI | `storyblok generate-typescript-typedefs --sourceFilePaths \u003cpathToComponentsDir\u003e --destinationFilePath \u003cpathToTypeFileLoc\u003e` | No |\n| componentsJsonLoc | string   | The location of the components JSON file.  | `./storyblok/components.\u003cspaceId\u003e.json` | No |\n| fileNameConvention | string   | The file name convention for the components. Can be either `kebab-case` or `camel-case`. | `kebab-case` | No |\n| componentAs       | string   | The component structure. Can be either `file` or `folder`. | `file` | No |\n| debug             | boolean  | Whether to enable debug mode. If enabled, the plugin will print additional information to the console. | `false` | No |\n\n\n## Development\n\nTo develop this plugin, you can clone the repository and run the following commands:\n\n```bash\nnpm install\nnpm run dev\n```\n\nThis will build the plugin, install the dependencies, and start the development server.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforge-42%2Fstoryblok-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fforge-42%2Fstoryblok-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforge-42%2Fstoryblok-generator/lists"}