8000 GitHub - shacthulu/payloadthemes: PayloadThemes is an advanced GitHub Actions-driven automated repo allowing front-end developers to use standard DevOps practices to submit and update themes for PayloadCMS.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

PayloadThemes is an advanced GitHub Actions-driven automated repo allowing front-end developers to use standard DevOps practices to submit and update themes for PayloadCMS.

Notifications You must be signed in to change notification settings

shacthulu/payloadthemes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Warning This project is on the backburner due to higher priority projects. Putting in maintenance mode until PayloadCMS 3.0 is released.

PayloadCMS Themes

PayloadThemes is a CLI application to simplify the implementation and communal sharing of PayloadCMS themes. The CLI is currently in a private repo and will be added here as time allows. Until then, this repo qualifies as "Stupid/awesome GitHub tricks." Rather than using a dedicated file storage service like AWS, Azure, Vercel, etc, everything is managed and version controlled through GitHub. A theme developer makes a pull request with a SCSS file, GitHub Actions parses it, places the file appropriately in the repo, then updates the manifest file. Any necessary metadata is provided in comments at the top of the SCSS file. The payloadthemes CLI keeps up with the available themes by reading the manifest, providing options to the user, and downloading the appropriate SCSS file from this repo.

Motivation

PayloadCMS is a great content management system! However the UI is very distinctive and, perhaps, not to everyone's tastes. There are a number of boiler-plate, opaque, and onerous steps you'll need to do for significant visual overhauls. PayloadCMS has no current theme marketplace or repository.

Usage

  1. Kick off the CLI without downloading npx payloadthemes or install npm add -D payloadthemes
    • The app will create a themes directory and add an overrides entry in your Payload config file (if it doesn't already exist). This is non-disruptive and won't otherwise break anything.
    • The app will read the manifest.json file from this github repository
  2. Select the theme you want
    • The app will download the theme's .scss file to the themes directory
    • The app will update the payload config to point to the new .scss file. Note that the downloaded theme will have its own name to allow easily reverting to the prior theme.
  3. Restart your payload project to see the new changes

GitHub Actions Backend

This project uses a GitHub Actions workflow to automatically process theme submissions and update a manifest file. This allows theme developers to easily contribute new themes while maintaining an up-to-date catalog for CLI tools to access.

Workflow Overview

The workflow is triggered whenever a push is made to the repository that includes changes to SCSS files in the themes/ directory. Here's what the workflow does:

  1. Theme Processing:

    • Parses each SCSS file in the themes/ directory.
    • Extracts metadata (theme name, description, author, version) from the file comments.
    • Generates a download link for each theme.
  2. Manifest Generation:

    • Creates or updates a manifest.json file.
    • Adds an entry for each theme with its metadata and download link.
  3. Automatic Commit and Push:

    • Commits the updated manifest.json file.
    • Pushes the changes back to the repository.

How It Works

  1. The workflow is defined in .github/workflows/update-manifest.yml.
  2. It uses a custom bash script (scripts/process_themes.sh) to process the themes and generate the manifest.
  3. The script reads the first four lines of each SCSS file to extract metadata:
    • Line 1: Theme name
    • Line 2: Description
    • Line 3: Author
    • Line 4: Version
  4. A download link is generated for each theme, pointing to the raw file in the repository.
  5. The manifest is updated with the new or changed theme information.
  6. Changes are committed and pushed back to the repository automatically.

For Theme Developers

To submit a new theme or update an existing one:

  1. Create or modify an SCSS file in the themes/ directory.

  2. Ensure the first four lines of your SCSS file contain the required metadata:

    /* MyTheme */
    /* A brief description of the theme */
    /* Author Name */
    /* 1.0.0 */
  3. Commit and push your changes to the repository.

  4. The GitHub Action will automatically process your theme and update the manifest.

For CLI Developers

The manifest.json file at the root of the repository contains up-to-date information about all available themes. You can use this file to retrieve theme metadata and download links for integration with your CLI tools.


This automated process ensures that the theme catalog stays current with minimal manual intervention, facilitating easy theme submission for developers and providing reliable, up-to-date information for CLI tools.

Roadmap

  • Add params to allow initialization only, i.e. npx payloadthemes --init
  • Use semantic versioning in the manifest and denote upgrades
  • Add support for themes that overwrite (or add) components
  • Diff the current version of the theme and confirm for overwrite
  • Establish conventions for easily modified elements (such as color)
  • Add mechanism to add screenshots for a theme
  • Finish README.md
  • Add license (MIT)
  • Publish to npm

Contributing

About

PayloadThemes is an advanced GitHub Actions-driven automated repo allowing front-end developers to use standard DevOps practices to submit and update themes for PayloadCMS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0