Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
A simple CLI for scaffolding Storyblok projects and fieldtypes.
You found an issue?
Tell us about it - open an issue or look if it was already reported.
Make sure you've node >= 9.11.0
installed.
$ npm i storyblok -g
Usage to kickstart a boilerplate, fieldtype or theme
$ storyblok select
Download your space's components schema as json
$ storyblok pull-components --space <SPACE_ID>
space
: your space idPush your components file to your/another space
$ storyblok push-components <SOURCE> --space <SPACE_ID>
source
: can be a URL or path to JSON file.Using an URL
$ storyblok push-components https://raw.githubusercontent.com/storyblok/nuxtdoc/master/seed.components.json --space 67819
Using a path to file
$ storyblok push-components ./components.json --space 67819
space
: your space idSync components, folder, roles or stories between spaces
$ storyblok sync --type <COMMAND> --source <SPACE_ID> --target <SPACE_ID>
type
: describe the command type to execute. Can be: folders
, components
, stories
or roles
. It's possible pass multiple types separated by comma (,
).source
: the source space to use to synctarget
: the target space to use to sync# Sync components from `00001` space to `00002` space
$ storyblok sync --type components --source 00001 --target 00002
# Sync components and stories from `00001` space to `00002` space
$ storyblok sync --type components,stories --source 00001 --target 00002
Create a space in Storyblok and select the boilerplate to use
$ storyblok quickstart
Logout from the Storyblok cli
$ storyblok logout
Login to the Storyblok cli
$ storyblok login
Create a migration file (with the name change_<COMPONENT>_<FIELD>.js
) inside the migrations
folder. Check Migrations section to more details
$ storyblok generate-migration --space <SPACE_ID> --component <COMPONENT_NAME> --field <FIELD>
space
: space where the component iscomponent
: component name. It needs to be a valid componentfield
: name of fieldExecute a specific migration file. Check Migrations section to more details
$ storyblok run-migration --space <SPACE_ID> --component <COMPONENT_NAME> --field <FIELD> --dryrun
space
: space where the component iscomponent
: component name. It needs to be a valid componentfield
: name of fielddryrun
: when passed as an argument, does not perform the migrationList all spaces of the logged account
$ storyblok spaces
For global help
$ storyblok --help
For command help
$ storyblok sync --help
For view the CLI version
$ storyblok -V # or --version
Content migrations are a convenient way to change fields of your content.
To execute a migration you first need to create a migration file. This file is a pure Javascript function where the content of a specific content type or compontent gets passed through.
To create a migration file, you need to execute the generate-migration
command:
# creating a migration file to product component to update the price
$ storyblok generate-migration --space 00000 --component product --field price
When you run this command a file called change_product_price.js
will be created inside a folder called migrations
.
The created file will have the following content:
// here, 'subtitle' is the name of the field defined when you execute the generate command
module.exports = function (block) {
// Example to change a string to boolean
// block.subtitle = !!(block.subtitle)
// Example to transfer content from other field
// block.subtitle = block.other_field
}
In the migration function you can manipulate the block variable to add or modify existing fields of the component.
To run the migration function you need to execute the run-migration
command. Pass the --dryrun option to not execute the updates and only show the changes in the terminal:
$ storyblok run-migration --space 00000 --component product --field price --dryrun
After checking the output of the dryrun you can execute the updates:
# you can use the --dryrun option to not execute the updates
$ storyblok run-migration --space 00000 --component product --field price
Let's create an example to update all occurrences of the image field in product component. In the example we replace the url from //a.storyblok.com
to //my-custom-domain.com
.
First, you need to create the migration function:
$ storyblok generate-migration --space 00000 --component product --field image
Then let's update the default image field:
module.exports = function (block) {
block.image = block.image.replace('a.storyblok.com', 'my-custom-domain.com')
}
Now you can execute the migration file:
$ storyblok run-migration --space 00000 --component product --field image --dryrun
To transform a markdown or html field into a richtext field you first need to install a converter library.
$ npm install storyblok-markdown-richtext -g
Now check the path to the global node modules folder
$ npm root -g
Generate the migration with storyblok generate-migration --space 00000 --component blog --field intro
and apply the transformation:
var richtextConverter = require('/usr/local/lib/node_modules/storyblok-markdown-richtext')
module.exports = function (block) {
if (typeof block.intro == 'string') {
block.intro = richtextConverter.markdownToRichtext(block.intro)
}
}
Check out our guides for client side apps (VueJS, Angular, React, ...), static site (Jekyll, NuxtJs, ...), dynamic site examples (Node, PHP, Python, Laravel, ...) on our Getting Started page.
FAQs
A simple CLI to start Storyblok from your command line.
The npm package storyblok receives a total of 20,013 weekly downloads. As such, storyblok popularity was classified as popular.
We found that storyblok 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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.