Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
storyblok-generator
Advanced tools
Generate Storyblok components out of your components.json file and get full type-safety and bundle splitting out of the box
Storyblok React component generator for Vite Storyblok apps (React/Remix.run).
To get up and running quickly, you first install the vite plugin as a dev dependency in your project.
npm install -D storyblok-generator
Then, in your vite.config.ts
file, add the following:
import { storyblokPlugin } from "storyblok-generator"
export default defineConfig({
plugins: [
storyblokPlugin({
spaceId: "<your space id>",
componentsDir: "./storyblok/components",
}),
],
})
Once 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.
import { components } from "./storyblok/components";
import { storyblokInit, apiPlugin } from "@storyblok/react"
storyblokInit({
accessToken: "<your access token>",
use: [apiPlugin],
// You pass in the components here, the components will be lazy loaded when actually used.
components,
})
The 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.
You will also need to be logged in to the Storyblok CLI properly. You should login via SSO instead of using the username and password combo as that keeps you logged in but after some time the login expires and you need to login again by first logging out and logging in again.
The plugin accepts the following configuration options:
Option | Type | Description | Default | Required |
---|---|---|---|---|
spaceId | string | Your Storyblok space ID. | - | Yes |
componentsDir | string | The directory where the components will be generated. | - | Yes |
typeFileLoc | string | The location of the type file. | ./storyblok/types.d.ts | No |
pullCommand | string | The command to use to pull the components from Storyblok via the CLI | storyblok pull-components --space <spaceId> --path <pathToComponentsDir> | No |
typesCommand | string | The command to use to generate the types for the components via the CLI | storyblok generate-typescript-typedefs --sourceFilePaths <pathToComponentsDir> --destinationFilePath <pathToTypeFileLoc> | No |
componentsJsonLoc | string | The location of the components JSON file. | ./storyblok/components.<spaceId>.json | No |
fileNameConvention | string | The file name convention for the components. Can be either kebab-case or camel-case . | kebab-case | No |
componentAs | string | The component structure. Can be either file or folder . | file | No |
debug | boolean | Whether to enable debug mode. If enabled, the plugin will print additional information to the console. | false | No |
To develop this plugin, you can clone the repository and run the following commands:
npm install
npm run dev
This will build the plugin, install the dependencies, and start the development server.
FAQs
Generate Storyblok components out of your components.json file and get full type-safety and bundle splitting out of the box
The npm package storyblok-generator receives a total of 1 weekly downloads. As such, storyblok-generator popularity was classified as not popular.
We found that storyblok-generator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.