Skip to main content

Utility to clean unused storyblok assets.

Project description

significa's banner

Cleanup Storyblok assets

PyPI version storyblok-assets-cleanup CI/CD

storyblok-assets-cleanup is a CLI utility to find and delete unused assets (images, videos, documents, etc) in the Storyblok CMS.

Features:

  • Find assets without references;
  • Output a summary of assets to be deleted, grouped by folder;
  • Perform a backup of assets before deletion;
  • Delete the actual assets.

Getting started

Requirements

Installation

In order to keep your system tidy and without conflicts in your global and user packages, we recommend pipx:

pipx install storyblok-assets-cleanup

This should do the trick for all systems. Adapt the installation command to fit your and preferred tool.

Use pipx upgrade storyblok-assets-cleanup to update to the latest release. Check the package releases on PyPI.

Usage

usage: storyblok-assets-cleanup [-h] --token TOKEN --space-id SPACE_ID [--region {eu,us,ca,au,cn}]
                                [--delete | --no-delete] [--backup | --no-backup]
                                [--backup-directory BACKUP_DIRECTORY] [--cache | --no-cache]
                                [--cache-directory CACHE_DIRECTORY]
                                [--continue-download-on-failure | --no-continue-download-on-failure]
                                [--ignore-path IGNORE_PATH] [--ignore-word IGNORE_WORD]

storyblok-assets-cleanup an utility to delete unused assets.

options:
  -h, --help            show this help message and exit
  --token TOKEN         Storyblok personal access token, alternatively use the env var
                        STORYBLOK_PERSONAL_ACCESS_TOKEN.
  --space-id SPACE_ID   Storyblok space ID, alternatively use the env var STORYBLOK_SPACE_ID.
  --region {eu,us,ca,au,cn}
                        Storyblok region (default: EU)
  --delete, --no-delete
                        If we should delete assets, default to false.
  --backup, --no-backup
                        If we should backup assets (to the directory specified in `--backup-
                        directory`), defaults to true.
  --backup-directory BACKUP_DIRECTORY
                        Backup directory, defaults to ./assets_backup.
  --cache, --no-cache   If we should use cache the assets index. Defaults to True (recommended).
  --cache-directory CACHE_DIRECTORY
                        Cache directory, defaults to ./cache.
  --continue-download-on-failure, --no-continue-download-on-failure
                        If we should continue if the download of an asset fails. Defaults to true.
  --ignore-path IGNORE_PATH
                        Absolute filepaths that should be ignored, can be passed multiple times.
                        Does not support prefixes, meaning you would need to pass the full path
                        for each directory, as seen in the summary table (with starting slash and
                        without trailing slash). Optional, defaults to no blacklisted paths.
                        Example: --ignore-path '/Do not delete/emails' --ignore-path '/Do not
                        delete/logos'.
  --ignore-word IGNORE_WORD
                        Will not delete assets which contains the specified words in its filename.
                        Default to none/empty list.

Development

  • Ensure you have make installed.
  • Create a virtual environment: make setup-venv.
  • Install dependencies: make install-deps.

Then you can install (link) the local repository globally with make local-install.

Before pushing changes ensure your code is properly formatted with make lint. Auto format the code with make format.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

storyblok_assets_cleanup-0.0.1.dev61.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file storyblok_assets_cleanup-0.0.1.dev61.tar.gz.

File metadata

File hashes

Hashes for storyblok_assets_cleanup-0.0.1.dev61.tar.gz
Algorithm Hash digest
SHA256 cd124f82c4e0826bf9a6672d5f52a1cae26e91170767bcca2f9d8a4ea9ca1537
MD5 984c284e2ab72564662875c28543d1dd
BLAKE2b-256 7d02241eef1948d5b049b52aa808f626c8a8f785bd8d55c0e157904c9cf6762c

See more details on using hashes here.

File details

Details for the file storyblok_assets_cleanup-0.0.1.dev61-py3-none-any.whl.

File metadata

File hashes

Hashes for storyblok_assets_cleanup-0.0.1.dev61-py3-none-any.whl
Algorithm Hash digest
SHA256 f6e6d60087b61c61294f261f2d4995169f359e1f944997b28c4a2c8f20e72cb2
MD5 77a6c7fafd7e9eb91786b74d917fddbd
BLAKE2b-256 8afb1f39d46db343b704122bdfc7ecdc8ade700789d412903ad724f1dd1e94c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page