From 884211abcb258f525fc898111ecd648ca4168cf6 Mon Sep 17 00:00:00 2001 From: Vivek Singh <47470314+heyitsvi@users.noreply.github.com> Date: Thu, 22 Aug 2024 17:44:14 +0530 Subject: [PATCH] Release alignment (#133) * update pear worker * update pear dump * update pear run * update pear versions * typo fix * update pear wakeups * fix * fix pear versions * fix cli --- reference/pear/api.md | 24 ++++++++++++++++++------ reference/pear/cli.md | 18 +++++++++++++----- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/reference/pear/api.md b/reference/pear/api.md index 7e8bdc1..151abf3 100644 --- a/reference/pear/api.md +++ b/reference/pear/api.md @@ -282,7 +282,7 @@ Reference counting is handled automatically to manage the sidecar lifecycle. ### `const pipe = Pear.worker.run(link , args >)` -Runs a Pear Worker by spawning a Pear Terminal Application process from the specified `link` parameter. The Worker uses the flags of the parent application but any application arguments must be passed using the `args` parameter. Returns a pipe (a [`streamx`](https://github.com/mafintosh/streamx) `Duplex` stream) for Worker communication. +Runs a Pear Worker by spawning a Pear Terminal Application process from the specified `link` parameter. The Worker uses the flags of the parent application but any application arguments must be passed using the `args` parameter, the `args` parameter also sets `Pear.config.args`. Returns a pipe (a [`streamx`](https://github.com/mafintosh/streamx) `Duplex` stream) for Worker communication. ### `const pipe = Pear.worker.pipe()` @@ -354,9 +354,9 @@ Captures available desktop sources. Resolves to an array of objects with shape ` * https://www.electronjs.org/docs/latest/api/structures/desktop-capturer-source * [``](https://www.electronjs.org/docs/latest/api/native-image) -### `Pear.versions ` +### `Pear.versions ` -Versions object. Pear versions are objects with the shape `{ fork , length , key }`. +Function that returns a promise which resolves to a Pear versions object with the shape `{ fork , length , key }`. The `key` is a Buffer of the run key. The `length` is the size of the relevant Hypercore. The `fork` property is determined by data truncation. @@ -366,10 +366,14 @@ These three properties together are a unique identifier for the entire state of The platform version. -### `Pear.versions.application { fork , length , key }` +### `Pear.versions.app { fork , length , key }` The application version. +### `Pear.versions.runtimes { bare , electron , pear }` + +The versions of runtimes. + **References** * [Pear.config.key](#pearconfigkey-objectnull) @@ -385,6 +389,10 @@ Functions supplied to teardown will be executed in order of registration when an application begins to unload. Any promise returned from each supplied function will be waited upon until resolution before calling the next teardown handler. +### Pear.reload() + +Soft-restart Terminal applications (keeps I/O), refresh application in Desktop applications. + ### `Pear.restart()` Restart the application. @@ -427,12 +435,16 @@ The `listener` function is called for every incoming wakeup with a `wakeup` obje { type: 'pear/wakeup', link: , - data: + linkData: , + fragment: , + entrypoint: } ``` * `link` is the `pear://` link for the application receiving the wakeup -* `data` is everything after the key in the `pear://` link - this would be `pathname` of a [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) object but without the leading slash (`/`). Given `pear://8ts9yz9dtucxzwbxafygnjasqe9ti3dt3w7rm6sbiu8prmidacao/some/more/stuff` the `data` string would hold `some/more/stuff`. +* `linkData` is everything after the key in the `pear://` link - this would be `pathname` of a [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) object but without the leading slash (`/`). Given `pear://8ts9yz9dtucxzwbxafygnjasqe9ti3dt3w7rm6sbiu8prmidacao/some/more/stuff` the `data` string would hold `some/more/stuff`. +* `fragment` is the `fragment` part of `pear://link#fragment` (location hash without the `#` prefix). +* `entrypoint` includes `entrypoint` of `pear://link/some/entry/point` (URL pathname). Also returns a [`streamx`](https://github.com/mafintosh/streamx) `Readable`) stream. diff --git a/reference/pear/cli.md b/reference/pear/cli.md index 9c65ef5..f7a350f 100644 --- a/reference/pear/cli.md +++ b/reference/pear/cli.md @@ -10,6 +10,10 @@ Create initial project files. Template Types: desktop, terminal, terminal-node +> Default Project directory path is `.` + +Template can also be initialized from a pear:// link, the template should contain a `_template.json` file. This file defines the prompts which are converted to locals that are injected into the template. + ``` --yes|-y Autoselect all defaults --type|-t=type Template type. Overrides @@ -61,15 +65,14 @@ Specify a remote key to reseed. --verbose|-v Additional output ``` -## `pear run [flags] [...app-args]` +## `pear run [flags] [...app-args]` Run an application from a key or dir. | | | |-------|---------------------------------------------------| -| key | `pear://` | +| link | `pear://` \| `pear://` | | dir | `file://` \| `` \| `` | -| alias | `pear://` | ``` @@ -80,6 +83,7 @@ Run an application from a key or dir. --link=url Simulate deep-link click open --store|-s=path Set the Application Storage path --tmp-store|-t Automatic new tmp folder as store path + --links Override configured links with comma-separated key-values --chrome-webrtc-internals Enable chrome://webrtc-internals --unsafe-clear-app-storage Clear app storage --unsafe-clear-preferences Clear preferences (such as trustlist) @@ -89,6 +93,7 @@ Run an application from a key or dir. --checkout=staged Run checkout from latest version length --no-ask-trust Exit instead of asking to trust unknown keys --detached Wakeup existing app or run detached + --help|-h Show help ``` ### Examples @@ -138,13 +143,16 @@ Supply no argument to view platform information. --json Newline delimited JSON output ``` -## `pear dump [dir]` +## `pear dump [flags] ` Synchronize files from key to dir. +> To dump to stdout use `-` in place of `` + ``` + --checkout=n Dump from specified checkout, n is version length --json Newline delimited JSON output - --checkout=n Dump from a custom release length (version) + --help|-h Show help ``` ## `pear sidecar`