experimental
A Pear project must have a package.json
file and a main entry file.
The package.json
file must have either a name
property or pear
object with a name
property.
The package.json
name
field must be lowercase and one word, and may contain letters, numbers, hyphens (-
), underscores (_
), forward slashes (/
) and asperands (@
).
The package.json
file may also contain a main
field, which typically should point to an HTML file. If omitted, index.html
or index.js
is the default entry file depending on application type.
Any other fields (such as dependencies
) may also be present in the package.json
file.
The package.json
pear
object contains application configuration and is exposed via the API as pear.config.options
.
Pear versioning is automatic. The package.json
file does not require a version field, the version field will be ignored.
The name of the application. Overrides package.json
name
.
Graphical User Interface configuration options.
Window width (pixels).
Window height (pixels).
Horizontal window position (pixels).
Vertical window position (pixels).
Window minimum width (pixels).
Window minimum height (pixels).
Window maximum width (pixels).
Window maximum height (pixels).
Center window.
Window resizability.
Window movability.
Window minimizability.
Window maximizability.
Window closability.
Window focusability.
Set window to always be on top.
Set window to fullscreen on start.
Set window to enter kiosk mode on start.
Hide menu bar unless Alt key is pressed (Linux, Windows).
Window shadow.
Set window opacity (0.0 - 1.0) (Windows, macOS).
Enable transparency. Must be set for opacity to work.
Background color (Hex, RGB, RGBA, HSL, HSLA, CSS color).
Storing and managing Pear application links and domains.
links
can be an object or an array. If it's an object, naming the key makes it easy to reference from Pear.config.links
By default in Pear apps, only requests to the sidecar host (127.0.0.1:9342) are allowed. Additional hosts and trusted keys must be added in pear.links
to allow access.
Any Pear links that the app trusts to run (eg as a worker) must be added and any http(s) domains that the app wants to access must also be added, including localhost.
Adding "https://*"
or "http://*"
will trust all domains based on their respective protocol.
Note that this is only for requests that the Pear app makes itself such as loading assets.
{
// ...
"pear": {
// accessed at runtime using Pear.config.links[index] eg. Pear.config.links[0] for pear://somePearKey
"links": [
"pear://somePearKey",
"https://example.com"
]
// OR
// accessed at runtime using Pear.config.links.name eg. Pear.config.links.myWorker for myWorker
"links": {
"myWorker": "pear://somePearKey",
"host": "https://example.com"
}
}
}
User Agent to use when Pear makes web requests. Pear will use the default userAgent
when making requests to the Sidecar.
Desktop Applications only.
Staging configuration options.
An array of entrypoint paths as staging start-points in addition to (deduped) main entry point.
An array of file paths to the warmup during staging in addition to all entry points. This is useful for loading assets needed to start the application quickly.
An array of file paths to ignore relative to package.json
file.