这篇翻译不完整。请帮忙从英语翻译这篇文章。
The package.json
file contains manifest data for your add-on, providing not only descriptive information about the add-on for presentation in the Add-ons Manager, but other metadata required of add-ons.
一些条目, 比如icon
, name
和description
, 有类似install manifest的格式, 并且package.json会写入
install manifest, 当使用jpm xpi
的时候.
Others, such as lib
, permissions
, and preferences
, represent instructions to the jpm tool itself to generate and include particular code and data structures in your add-on.
其他如lib
, permissions
和preferences
表示使用jpm工具的步骤, 生成你扩展包含的特殊代码和数据结构.
创建manifest
package.json起初是通过运行
jpm init
生成的,通常在扩展的根目录.比如下面(假设扩展目录是
"my-addon")
{ "name": "my-addon", "title": "my-addon", "id": "jid1-1FERGV45e4f4f", "description": "a basic add-on", "author": "", "license": "MPL-2.0", "version": "0.1" }
如果你使用新的jpm tool话,可以方便的从package.json获取manifest数据, 通过require其他模块的方式:
var title = require("./package.json").title;
Key reference
package.json
may contain the following keys:
author |
The name of the package's original author; this could be the name of a person or a company. 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 Note: jpm supports NodeJS people fields.
|
contributors |
An array of additional These values will be used as the add-on's Note: This is deprecated along with
cfx ; it's not available when using jpm. |
dependencies |
A string or an array of strings specifying the names of packages that this add-on requires in order to function properly. |
description |
The add-on's description; this is a human-readable message describing what the add-on does. This defaults to the text "a basic add-on". This value will be used as the add-on's |
engines |
Object with supported applications (key) and required version numbers (value).
Example:
|
fullName |
Note: This is deprecated along with
cfx ; it's not available when using jpm.The full name of the package. It can contain spaces. If this key is present its value will be used as the add-on's |
harnessClassID |
Note: This is deprecated along with
cfx ; it's not available when using jpm.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 path to an image file containing the icon for the add-on. Defaults to When using jpm, relative path to the data directory (to make it re-usable for add-on HTML content) does not currently work. Instead you have to use following syntax: resource://ID/data/icon-name.png ID is the value from the This value will be used as the add-on's The icon may be up to 48x48 pixels in size (although a bigger icon is tolerated here too) |
icon64 |
Note: This is deprecated along with The path to an image 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 "lib". Note: This is deprecated along with |
license |
The name of the license under which the add-on is distributed, with an optional URL in parentheses. Defaults to Note: It is recommend that you use an SPDX license ID. |
main |
A 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 |
Note: This is deprecated along with A string pointing to a directory containing additional packages. Defaults to |
permissions |
A set of permissions that the add-on needs.
Note the |
preferences |
An array of JSON objects that use the following keys: See the documentation for the |
preferences-branch |
Use this to specify an alternative branch for your add-on's simple-prefs. See "Simple-prefs in the preferences system" for more details. |
title |
The human-readable title of the package; this can contain spaces. If this key is present its value will be used as the add-on's |
translators |
An array of strings listing the people who contributed to the localization of this add-on. These values will be used as the add-on's Note: jpm supports NodeJS people fields.
|
unpack |
Same as the Useful when the extension contains binaries. |
updateKey |
Same as the See Supporting updates for self-hosted add-ons. Note: This key is only available with jpm. |
updateLink |
Same as the See Supporting updates for self-hosted add-ons. Note: This key is only available with jpm. |
updateURL |
Same as the See Supporting updates for self-hosted add-ons. Note: This key is only available with jpm. |
version |
String representing the version of the add-on. Defaults to "0.0.1". This value is used as the add-on's |