Storyblok Command Line Interface
Storyblok provides an official CLI for quickly scaffolding ambitious web projects.
Installation
Section titled Commands Commands
Section titled undefinedLogin undefinedLogin
Sign into your account via the following command:
Section titled Logout Logout
Sign out of your account with the following command:
if you encounter a 404 by executing any Storyblok CLI commands, logout & login again will help.
Section titled Select Select
Use select
to kickstart a boilerplate, fieldtype, or theme.
After running the command, you will be prompted to name your new project, and select the type of project it will be:
Type | Description |
---|---|
Theme | This will prompt you to select pre-rendered themes that Storyblok has made. After selecting a theme, you will be prompted to type in your space ID so that the project can be tied to a space on Storyblok. Then, it will ask you for your domain URL and theme token. Finally, it will git-clone the repository for you with all your information pre-populated. |
Boilerplate | This will bring up a selection of boilerplates that can be used with your coding language of choice: JavaScript (Node.js and Vue.js), Python (Django), Ruby (Sinatra), and PHP (Silex). Then, the GitHub repo for the boilerplate of choice will be cloned. After, you will be prompted to type in your space ID so that the project can be tied to a space on Storyblok. |
Fieldtype | This will automatically git-clone our fieldtype repo. |
Download your space's components schema as json
The following command allows you to save your components schemas somewhere save (git, svn) and also allows you to migrate components between different spaces. Download your components json:
storyblok pull-components --space <SPACE_ID>
Use your Space ID to access this feature.
To access your space id go to {1} Settings, then {2} Space. Your {3} Space ID should be displayed.
Push your components file to your/another space
To push your downloaded components schema to another space you can execute the following command. Make sure to pass the right path/url of your components file you've downloaded as last parameter:
storyblok push-components --space <DEST_SPACE_ID> {{path/url}}
Section titled sync sync
You can sync components, folder, roles, datasources or stories between spaces.
Options | Description |
---|---|
type | describe the command type to execute. Can be folders, components, stories, datasources or roles. It's possible pass multiple types separated by comma (,). |
source | the source space to use to sync |
target | the target space to use to sync |
region | your space region (default: eu). If your space was created under the US region, you should use us instead. In general you can use one of the available region (Europe, US, Canada, Australia end China). More info about the region: https://www.storyblok.com/faq/define-specific-region-storyblok-api. |
Section titled Examples Examples
Please note that it is currently not possible to use the CLI to synchronize information between spaces in different regions.
You can sync multiple spaces! Tutorial: Setting Up Multiple Spaces with Storyblok CLI
Section titled quickstart quickstart
Create a space in Storyblok and select the boilerplate to use
Section titled spaces spaces
List all the spaces of the currently logged-in account
Section titled import import
Imports flat content from .csv
, .xml
and .json
files coming from other systems.
The attributes path and title are required.
Options | Description |
---|---|
file | name of the file |
type | name of the content type you want to use for the import |
space | ID number of your space |
delimiter (optional) | delimiter of the .cvs files, only necessary if you are uploading a csv file (Default value is ; ) |
folder (optional) | id of the folder where you want to store the content in Storyblok |
Section titled help help
For global help
For command help
Section titled version version
To check your current version of the Storyblok CLI
Section titled Migrations Migrations
Section titled generate-migration generate-migration
Create a migration file (with the name change_<COMPONENT>_<FIELD>.js
) inside the migrations folder.
Options | Description |
---|---|
space | the space of where the component is |
component | component name |
field | name of field |
Section titled run-migration run-migration
Execute a specific migration file.
You can provide the publish parameter to publish content after saving.
Example:
Option | Description |
---|---|
space | the space ID number you get from the space settings area |
component | component name |
field | name of field |
dryrun | when passed as an argument, does not perform the migration |
publish (optional) | publish the content when update
|
publish-languages (optional) | publish specific languages. You can publish more than one language at a time by separating the languages by a comma ( ,). |
Section titled rollback-migration rollback-migration
The rollback-migration command gives the ability to undo changes made from the execution of the last run-migrations command.
The rollback-migration
command will only work if there where changes done with run-migrations. Therefore running run-migrations command with the --dryrun
flag will NOT create a rollback file.
Option | Description |
---|---|
space | the space ID number you get from the space settings area |
component | component name |
field | name of field |