@onestic/spaces-manager
v1.3.5
Published
Storyblok Spaces manager by API
Readme
Spaces Manager CLI
The "Spaces Manager" module is a command-line tool designed to streamline and automate the management of content within Storyblok (CMS). This module offers a comprehensive suite of commands enabling developers and content managers to efficiently perform critical tasks such as backing up, restoring, synchronizing, and managing various data types within Storyblok spaces.
Features
- Backup and Restore: Backup stories, components, and assets; restore them as needed.
- Content Synchronization: Sync local changes with Storyblok, keeping environments aligned.
- Component Management: Download, compare, and sync component definitions.
- Datasource Handling: Manage datasources with download, diff, and sync capabilities.
- Role Management: Download and sync roles for effective access control.
- Asset Management: Download assets for backup and version control.
- Space Management: Create new spaces and manage API keys easily.
Table of Contents
⚙️ Configuration
Create an .env file in the root folder of your project with the following information:
STORYBLOK_BACKUPS_FOLDER="backups"
STORYBLOK_PERSONAL_TOKEN="Y0URT0K3N"
STORYBLOK_MASTER_SPACE_NAME="SPACE_NAME"You can find a .env.sample file at the root of the project.
💻 Commands
You can run the following commands from the root folder of your project using your preferred package manager, such as npm, npx, or yarn.
| Command | Description |
|--------------------------------------|-------------------------------------------------------------------------------------------------------|
| storyblok-components-download | Downloads the components from a Storyblok space to enable local backups and version control. |
| storyblok-components-diff | Compares local component definitions with those in Storyblok to identify differences. |
| storyblok-components-sync | Synchronizes local component changes to Storyblok, updating the remote components to match locally. |
| storyblok-stories-backup-save | Saves a backup of stories from Storyblok to a local directory for safekeeping. |
| storyblok-stories-backup-restore | Restores stories from a local backup to the Storyblok space, overwriting the remote versions. |
| storyblok-stories-sync | Synchronizes local story changes to Storyblok, updating the remote stories to match locally. |
| storyblok-stories-set-content-type | Changes the content-type of the desired story. |
| storyblok-datasources-download | Downloads the datasource entries from Storyblok for local backup and version control. |
| storyblok-datasources-diff | Compares local datasource definitions with those in Storyblok to identify differences. |
| storyblok-datasources-sync | Synchronizes local datasource changes to Storyblok, updating the remote datasources to match locally. |
| storyblok-roles-download | Downloads the roles from Storyblok to enable local backups and version control. |
| storyblok-roles-sync | Synchronizes local role changes to Storyblok, updating the remote roles to match locally. |
| storyblok-create | Creates a new space in Storyblok based on local definitions and templates. |
| storyblok-getapikey | Retrieves the API key for a specified Storyblok space for authentication purposes. |
| storyblok-presets-sync | Synchronizes local preset changes to Storyblok, updating the remote presets to match locally. |
| storyblok-presets-download | Downloads the presets from Storyblok for local backup and version control. |
| storyblok-assets-download | Downloads assets from Storyblok for local backup and to enable version control of media files. |
📖 Folder and Files Organization
📁 config: Contains all the commands and options that commands can receive.
📁 src/commands: Contains executable scripts designed for various tasks in a Storyblok development environment. These scripts handle operations like asset management, component comparison, and story synchronization, providing efficient tools for content and configuration management.
📁 src/utils:
- 🗄️
commander.js: Initializes command line interface and handles command options. (src/utils/commander.js) - 🗄️
fileManager.js: Reads and creates folders. (src/utils/fileManager.js) - 🗄️
helpers.js: Provides various helper functions like deleting stories, obtaining spaces, etc. (src/utils/helpers.js) - 🗄️
sbClient.js: Handles API requests to Storyblok. (src/utils/sbClient.js)
