A command line tool to help package browser extensions for different browsers and manifest versions.
- Set project-specific configurations
- Sync files between source and target directories
- Package (zip) targets for distribution
- Create temporary target directories
- Prevent version overwrite
- Clean manifest.json
To use extbuild in the terminal, install with the -g
option
npm install -g extbuild
Navigate the current working directory to where build_config.json is an immediate child, then run
extbuild
{
"project_name_short": "extbuild",
"enforce_version_control": true,
"clean_manifest": true,
"default_actions": ["copy"],
"release_directory": "../releases",
"source": {
"directory": "../src/chrome",
"platform": "chrome"
},
"targets": [
{
"directory": "../src/firefox",
"platform": "firefox",
"manifest_version": 2,
"patch": [],
"temp": true
}
],
"git_messages": {
"directory_sync": "automated directory sync",
"packages": "automated package build"
},
"debug": false
}
The extension's short/abbreviated name.
dad
, pur
, or extbuild
.
If set to true
, the program will check if a package already exists for the extension's current version. You can temporarily override this by using the --force
option.
If true
, the program will remove any empty fields in the manifest, including empty objects, arrays, and strings.
An array of actions that will run on every invocation.
copy
This will sync the target (excluding temp
enabled) directories with the source directory, adjusting any patch files and manifest fields.
package
This will create packages for the source and target (including temp
enabled) directories.
git
This will push to GitHub after every action with automated messages configured in build_config.json
.
The relative path of the release directory, where packages will be created. If the directory does not exist, it will be created.
An object containing information on the source directory.
The relative path of the source directory. This path must exist and contain a manifest.json
file.
The platform of the source directory. Supports chrome
and firefox
.
An array of objects containing information on the build targets.
The relative path of the source directory. If temp
is true
, this will be the relative path of the temporary directory. If the directory does not exist, one will be created.
The platform of the target. Supports chrome
, firefox
, opera
, and edge
.
The manifest version of the target.
Array of files to patch. Patches version and platform-specific methods, including changing chrome
to browser
for Firefox and browserAction
to action
for sync between manifest V2 and V3.
manifest.json
files will be synced by default, it does not need to be included in patch
.
If true
, the target directory will only be created if the package action is invoked, in which the directory will be removed after the process has finished.
Commit messages used when the git action is invoked.
Extra console output
If invoking the script via npm
, this field is required to point the program to the .sh scripts.