feat: add extension packing script and update build script
All checks were successful
Deploy to Production / deploy (push) Successful in 14s
All checks were successful
Deploy to Production / deploy (push) Successful in 14s
This commit is contained in:
@@ -6,9 +6,14 @@ import zipfile
|
||||
# Configuration
|
||||
SOURCE_DIR = "extension"
|
||||
BUILD_DIR = "dist-extension"
|
||||
OUTPUT_ZIP = "extension-release.zip"
|
||||
MANIFEST_FILE = "manifest.json"
|
||||
|
||||
# Read version to create dynamic zip name
|
||||
with open(os.path.join(SOURCE_DIR, MANIFEST_FILE), "r") as f:
|
||||
source_manifest = json.load(f)
|
||||
version = source_manifest.get("version", "unknown")
|
||||
OUTPUT_ZIP = f"tools-app-extension-v{version}.zip"
|
||||
|
||||
# Remove build directory if exists
|
||||
if os.path.exists(BUILD_DIR):
|
||||
shutil.rmtree(BUILD_DIR)
|
||||
@@ -27,7 +32,7 @@ print("Removing localhost from manifest...")
|
||||
# Filter host_permissions
|
||||
if "host_permissions" in manifest:
|
||||
manifest["host_permissions"] = [
|
||||
perm for perm in manifest["host_permissions"]
|
||||
perm for perm in manifest["host_permissions"]
|
||||
if "localhost" not in perm
|
||||
]
|
||||
|
||||
@@ -36,7 +41,7 @@ if "content_scripts" in manifest:
|
||||
for script in manifest["content_scripts"]:
|
||||
if "matches" in script:
|
||||
script["matches"] = [
|
||||
match for match in script["matches"]
|
||||
match for match in script["matches"]
|
||||
if "localhost" not in match
|
||||
]
|
||||
|
||||
@@ -55,4 +60,4 @@ with zipfile.ZipFile(OUTPUT_ZIP, "w", zipfile.ZIP_DEFLATED) as zipf:
|
||||
|
||||
# Cleanup
|
||||
shutil.rmtree(BUILD_DIR)
|
||||
print(f"Done! {OUTPUT_ZIP} is ready for upload to Chrome Web Store.")
|
||||
print(f"Done! {OUTPUT_ZIP} is ready for upload to Chrome Web Store.")
|
||||
|
||||
Reference in New Issue
Block a user