From dca7c8f3f87ef011b156f1ef75fb929269b570da Mon Sep 17 00:00:00 2001 From: Sean Zellmer Date: Mon, 23 Dec 2024 02:59:13 -0600 Subject: [PATCH] Pear release 1.8.0 docs (#162) * Add `Pear.badge(count)` documentation Picked `null` to be the documented way to display a plain dot given it coerces to `0`, so passes the `Number.isInteger(count)` check, and has the same behavior in plain electron. * Add `pear.stage.prefetch` to Application Configuration * Update `stage` subcommand help output The `truncate` was added since https://github.com/holepunchto/pear/commit/85892a6a#diff-c218df6a550b0f3a42a2879e83f3ce2281061a1e79123d2a6d610d62d5f63bd8R79 but was missing. * Add `pear.userAgent` to Application Configuration * Adjust info about warmup in the guides * Clarify that `pear.userAgent` will not change Sidecar requests --- guide/sharing-a-pear-app.md | 2 +- reference/pear/api.md | 8 ++++++++ reference/pear/cli.md | 3 ++- reference/pear/configuration.md | 12 +++++++++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/guide/sharing-a-pear-app.md b/guide/sharing-a-pear-app.md index c298e1e..7df9162 100644 --- a/guide/sharing-a-pear-app.md +++ b/guide/sharing-a-pear-app.md @@ -34,7 +34,7 @@ The channel name can be any valid name. Using `dev` for local development checks Stage will output a diff of changes - the first time will all be additions of course - and then it will output the application link. -If the application is a desktop application there will also be a warmup step where the application is opened in the background and analyzed for initialization-to-loaded critical-path. This metadata is stored along with the application into an application-dedicated hypercore inside Pear. This helps the desktop application load faster. All state is local and by default only the original machine that stages an application can write to this application-dedicated hypercore. +There will be a warmup step where the application is analyzed for initialization-to-loaded critical-path. This metadata is stored along with the application into an application-dedicated hypercore inside Pear. This helps the application load faster. All state is local and by default only the original machine that stages an application can write to this application-dedicated hypercore. > Some frontend frameworks will load different assets based on whether the `NODE_ENV` environment variable is set to `production`. If the application has this need, use `NODE_ENV=production pear stage dev` in order to stage the production library code so that when Stage Warmup occurs the captured critical-path consists of production assets. diff --git a/reference/pear/api.md b/reference/pear/api.md index 0cd58a0..1dce634 100644 --- a/reference/pear/api.md +++ b/reference/pear/api.md @@ -433,6 +433,14 @@ The `listener` function is called for every incoming wakeup with a `wakeup` obje Also returns a [`streamx`](https://github.com/mafintosh/streamx) `Readable`) stream. +### `Pear.badge(count ) => Promise` + +Set the badge number for the application on desktop for Linux & MacOS. Setting the `count` to `0` will hide the badge while `null` will display a plain dot on MacOS only. + +Returns a `Boolean` promise for whether the call succeeded. + +Desktop Applications only. + ### `const win = new Pear.Window(entry , options )` Desktop Applications only. diff --git a/reference/pear/cli.md b/reference/pear/cli.md index d0d0fb4..cca5c34 100644 --- a/reference/pear/cli.md +++ b/reference/pear/cli.md @@ -48,7 +48,8 @@ Outputs diff information and project link. ``` --json Newline delimited JSON output --dry-run|-d Execute a stage without writing - --ignore Comma separated file path ignore list + --ignore Comma separated file path ignore list + --truncate Advanced. Truncate to version length n --name Advanced. Override app name --no-ask Suppress permissions dialogs --help|-h Show help diff --git a/reference/pear/configuration.md b/reference/pear/configuration.md index fe69bfd..9de8f02 100644 --- a/reference/pear/configuration.md +++ b/reference/pear/configuration.md @@ -153,13 +153,23 @@ Note that this is only for requests that the Pear app makes itself such as loadi } ``` +### `pear.userAgent ` (default: `Pear ${Pear.#state.id}`) + +User Agent to use when Pear makes web requests. Pear will use the default `userAgent` when making requests to the Sidecar. + +Desktop Applications only. + ### `pear.stage ` Staging configuration options. #### `pear.stage.entrypoints ` -An array of entrypoints as staging start-points in addition to (deduped) main entry point. +An array of entrypoint paths as staging start-points in addition to (deduped) main entry point. + +#### `pear.stage.prefetch ` + +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. #### `pear.stage.ignore `