package.json
The "package.json" file contains metadata for your add-on.
Some of its entries, such as icon
,
name
, and
description
, have
direct analogues in the
install manifest
format, and entries from package.json are written into the install
manifest when the add-on is built using cfx xpi
.
Others, such as
lib
,
permissions
,
and preferences
,
represent instructions to the cfx tool itself to generate and include
particular code and data structures in your add-on.
The package.json
file is initially generated in your add-on's root
directory the first time you run
cfx init
. It looks like this
(assuming the add-on's directory is "my-addon"):
{ "name": "my-addon", "fullName": "my-addon", "description": "a basic add-on", "author": "", "license": "MPL 2.0", "version": "0.1" }
package.json
may contain the following keys:
author |
The original author of the package. Defaults to an empty string. It may include a optional URL in parentheses and an email address in angle brackets. This value will be used as the add-on's
|
contributors |
An array of additional These values will be used as the add-on's
|
dependencies |
String or array of strings representing package names that this add-on requires in order to function properly. |
description |
The add-on's description. This defaults to the text
This value will be used as the add-on's
|
fullName |
The full name of the package. It can contain spaces. If this key is present its value will be used as the add-on'sem:name
element in its "install.rdf". |
harnessClassID |
String in the GUID format. This is used as a
|
homepage |
The URL of the add-on's website. This value will be used as the add-on's
|
icon |
The relative path from the root of the add-on to a
PNG file containing the icon for the add-on. Defaults to
This value will be used as the add-on's
The icon may be up to 48x48 pixels in size. |
icon64 |
The relative path from the root of the add-on to a
PNG file containing the large icon for the add-on. Defaults to
This value will be used as the add-on's
The icon may be up to 64x64 pixels in size. |
id |
A globally unique identifier for the add-on. This value will be used as the add-on's
See the Program ID documentation. |
lib |
String representing the top-level module directory provided in
this add-on. Defaults to |
license |
The name of the license under which the add-on is distributed, with an optional
URL in parentheses. Defaults to |
main |
String representing the name of a program module that is
located in one of the top-level module directories specified by
|
name |
The add-on's name. This name cannot contain spaces or periods, and defaults to the name of the parent directory. When the add-on is
built as an XPI, if the |
packages |
String or array of strings representing paths to
directories containing additional packages. Defaults to
|
permissions |
A set of permissions that the add-on needs.
|
preferences |
An array of JSON objects that use the following keys:
See the documentation for the
|
tests |
String representing the top-level module directory containing
test suites for this package. Defaults to |
translators |
An array of strings listing translators of this add-on. These values will be used as the add-on's
|
version |
String representing the version of the add-on. Defaults to
This value will be used as the add-on's
|