Skip to content

Conversation

tashifkhan
Copy link
Contributor

@tashifkhan tashifkhan commented Oct 6, 2025

This PR adds a small manifest generation utility and the accompanying documentation and package.json scripts,
to add firefox compatibility #2

  • Adds scripts/generate-manifest.js which copies icons/ and src/ into dist/<browser>/ and prepares browser bundles.
  • Adds npm scripts: manifest:chrome, manifest:firefox, manifest:all.
  • Updates .gitignore to exclude generated dist/, .env, and .DS_Store.
  • Updates README.md with usage instructions for generating browser bundles.

Files changed (summary)

  • Added: scripts/generate-manifest.js — a simple Node script to copy icons and src/ into dist/<browser>/ and produce browser-specific manifests.
  • Modified: .gitignore — ignore .env, dist/, and macOS .DS_Store.
  • Modified: README.md — added instructions for using the new manifest generation scripts.
  • Modified: package.json — added npm scripts: manifest:chrome, manifest:firefox, and manifest:all.

Detailed per-file notes

  1. scripts/generate-manifest.js (new)
  • Purpose: generate browser-specific bundles into dist/ by copying icons/ and src/ and generating the appropriate manifest structure.
  • Location: scripts/generate-manifest.js
  • Status: added (staged).
  • Quick test: node scripts/generate-manifest.js chrome should create dist/chrome/ with expected files.
  1. .gitignore (modified)
  • Added lines:
    • .env
    • dist/
    • .DS_Store

Rationale: dist/ is generated output from the manifest generator; .env and .DS_Store are common local/OS files we don't want in version control.

  1. README.md (modified)
  • Added a short section titled "Building browser bundles (manifests)" that documents how to run the generator via npm scripts:

    • npm run manifest:chrome
    • npm run manifest:firefox
    • npm run manifest:all

Rationale: Makes it easier for contributors to create browser-specific artifacts.

  1. package.json (modified)
  • Added npm scripts:
    • manifest:chrome -> node scripts/generate-manifest.js chrome
    • manifest:firefox -> node scripts/generate-manifest.js firefox
    • manifest:all -> node scripts/generate-manifest.js

Rationale: provide convenient shortcuts for running the generator.

How to test locally

  1. Generate a Chrome bundle:
npm run manifest:chrome
  1. Verify dist/chrome/ contains icons/, src/, and a manifest suitable for Chrome.

  2. Generate Firefox bundle:

npm run manifest:firefox
  1. Inspect the generated files or load the dist/<browser>/ directory as an unpacked extension in your browser for a quick smoke test.

Closes #2

@AlokYadavCodes
Copy link
Owner

@tashifkhan I made a few changes on top of your PR: replaced generate-manifest.js with build.js as we are generating full dist/ folder and not just manifest, switched to fs-extra for simpler file operations and added separate manifests for Chrome and Firefox.

I decided to keep two separate manifests because trying to use a single manifest with tweaks for each browser caused conflicts. For example, Chrome requires background.service_worker, while Firefox uses background.scripts and needs the browser_specific_settings.gecko block. Firefox also has stricter CORS policies, so we need additional host permissions like https://i.ytimg.com/*.
Keeping separate manifests is much easier and more maintainable than trying to tweak a single manifest programmatically during the build.

Thanks for your PR! The issue was just about Firefox support, but you went further and set up proper builds, which is really helpful. Your work made this update much easier.

@AlokYadavCodes AlokYadavCodes merged commit d264162 into AlokYadavCodes:main Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make it compatible for Firefox

2 participants