This project includes a Python-based build system to compile and publish web extensions for various browsers, including Chromium-based browsers (Chrome, Edge) and Gecko-based browsers (Firefox).
- Python 3.x installed
- Optional: Linux/Unix environment or WSL for better compatibility
pip install
the required dependencies, if applicable
The build script, build.py
, allows you to build, test, and package the extension for different browsers. You can specify which browser/platform you are building for using command-line arguments.
To generate compressed packages for the browser platforms, such as .zip for Chrome-based browsers and .xpi for Firefox, use the following commands:
- Chrome (Chromium-based):
python build.py -p chrome --publish
- Microsoft Edge
python build.py -p edge --publish
- Firefox (Manifest V2)
python build.py -p firefox-mv2 --publish
- All platforms (chrome, edge firefox)
python build.py --unpacked
Unpacked builds are used for local testing and development. You can generate browser-specific extensions as follows:
- Chrome (Chromium-based):
python build.py -p chrome --unpacked
- Microsoft Edge
python build.py -p edge --unpacked
- Firefox (Manifest V2)
python build.py -p firefox-mv2 --unpacked
- All platforms (chrome, edge firefox)
python build.py --unpacked
python build.py --rm
- Prerequisities : Must run in Linux / Unix derivative environment
Unpacked builds are used for local testing and development. You can generate browser-specific extensions as follows:
Use the make
command followed by the target browser:
- Chrome (Chromium-based):
make chrome
- Microsoft Edge version
make edge
- Firefox (Manifest V2)
make firefox
- Creating all platforms Chrome and Firefox browsers
make unpacked
To generate compressed packages for the browser platforms such as .zip
for chrome-based and .xpi
for firefox:
- Chrome (Chromium-based):
make chrome-publish
- Microsoft Edge version
make edge-publish
- Firefox (Manifest V2)
make firefox-publish
- Creating all platforms Chrome and Firefox browsers
make publish
make clean
The output of the build will be placed in the dist/build
directory.
To test the extension on offline mode / local copy follow these steps:
Browser Name | Platform | Manifest Version |
---|---|---|
Chrome | chrome | MV3 |
Microsoft Edge | edge | MV3 |
Firefox | firefox-mv2 | MV2 |
Firefox (manifest v3) | firefox-mv3 | MV3 |
-
Get a Local Copy of the SIS Website:
- Clone or download the test branch of this repository.
- Extract the files and serve them using VSCode's Live Server extension.
-
Build the Extension for Local Testing:
- Add the
-t
flag when runningbuild.py
to enable the extension to work on the local version ofsis.pup.edu.ph
. - Example build.py commands:
Replace
python build.py -p <platform> -u -t # unpacked mode # or python build.py -p <platform> -z -t # zipped mode
<platform>
with the desired target (e.g.,chrome
,firefox-mv2
).
- Add the
Now, you can test the extension using the local copy of SIS, the output of the build will be placed in the dist/build
directory.
The project is organized into the following directories and files to streamline the development, building, and publishing process:
-
src/
This directory contains common assets used across all browser platforms, including:- HTML: Structure and layout for the extension's user interface.
- CSS: Stylesheets for the extension's appearance.
- Frontend JS: JavaScript files for handling client-side functionality.
-
platform/
This folder holds browser-specific files that vary between platforms. These include:- Main JS: Platform-specific logic, such as fetching the schedule or interacting with browser APIs.
- manifest.json: The manifest file tailored to the respective browser (Chrome, Edge, Firefox) and its required manifest version (V2 or V3).
-
dist/
The directory where built extensions and other generated files are stored:dist/build/
: The main output folder for the extensions generated by theMakefile
. Each build is placed here for easy access during development and publishing.version
: This file keeps track of the current version number of the extension.
-
tools/
Backend scripts and utilities used by theMakefile
to automate the building and packaging process. This includes platform-specific build scripts to compile the extension based on the target browser (e.g., Chrome, Firefox)
This project is under the MIT License