mirror of
https://github.com/zen-browser/theme-store.git
synced 2025-07-07 17:05:31 +02:00
chore: Update create-theme workflow to write styles and readme to separate files
This commit is contained in:
parent
f7711c3b57
commit
9f5c6ebd05
2 changed files with 36 additions and 8 deletions
|
@ -3,6 +3,7 @@ import os
|
|||
import argparse
|
||||
import json
|
||||
import uuid
|
||||
import sys
|
||||
|
||||
STYLES_FILE = "chrome.css"
|
||||
README_FILE = "readme.md"
|
||||
|
@ -30,6 +31,26 @@ def get_readme():
|
|||
content = content[:-len("```")]
|
||||
return content
|
||||
|
||||
def validate_name(name):
|
||||
if len(name) == 0:
|
||||
print("Name is required.", file=sys.stderr)
|
||||
exit(1)
|
||||
if len(name) > 20:
|
||||
print("Name must be less than 50 characters.", file=sys.stderr)
|
||||
exit(1)
|
||||
for char in name:
|
||||
if not char.isalnum() and char != ' ':
|
||||
print("Name must only contain letters, numbers, and spaces.", file=sys.stderr)
|
||||
exit(1)
|
||||
|
||||
def validate_description(description):
|
||||
if len(description) == 0:
|
||||
print("Description is required.", file=sys.stderr)
|
||||
exit(1)
|
||||
if len(description) > 120:
|
||||
print("Description must be less than 100 characters.", file=sys.stderr)
|
||||
exit(1)
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='Submit a theme to the theme repo.')
|
||||
parser.add_argument('--name', type=str, help='The theme to submit.')
|
||||
|
@ -43,6 +64,9 @@ def main():
|
|||
homepage = args.homepage
|
||||
author = args.author
|
||||
|
||||
validate_name(name)
|
||||
validate_description(description)
|
||||
|
||||
theme_id = create_theme_id()
|
||||
|
||||
print("""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue