Simple action scripts using the Management API
Install the dependencies:
npm install
Then, copy .env.example
and rename it to .env
, provide your own Storyblok equivalent variables:
SB_MANAGEMENT_API_TOKEN=<your-personal-access-token>
SB_SPACE_ID=<space-ID>
# Migration between spaces scripts variables
SB_SPACE_A_ID=<SPACE-A-ID>
SB_SPACE_B_ID=<SPACE-B-ID>
# Update a task dialog script
SB_TASK_ID=
# App or Tool ID to get or update Space Settings script
SB_APP_ID=
-
Make your space duplicable:
npm run duplicable
-
Get all the folders from your space:
npm run folders
-
Make your component fields translatable:
Go to ./scripts/component-translatable.js and add the component details needed to make the fields translatable:
// Component Details component: { id: '', // Provided in the URL when opening the blok in the Block library name: '', // Technical name in the Config Tab fields: [ // Fields name & type in lowercase { name: 'headline', type: 'text' }, { name: 'teaser', type: 'textarea' }, ] }
Then you will be able to run:
npm run component-translatable
-
Page History: Get the latest 25th story versions and the difference from each one
Go to ./scripts/story-versions.js and add the story id:
story_id: ""; // Provided in the URL when opening the story in the Visual Editor
Then you will be able to run:
npm run story-versions
-
Migrate or update first 100 pages from space A to space B:
npm run share-content
-
Migrate first 25 assets from an old space to a new one:
npm run migrate-assets
-
Update a task dialog based on a specific Content Type entries:
npm run update-task
-
Get number of Nestable components in a space:
npm run components-by-type
-
Get or update the Space Settings from a Tool or App plugin:
npm run app-space-settings