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
This commit is contained in:
Vivek Singh
2024-08-22 17:44:14 +05:30
committed by GitHub
parent 7d3d279059
commit 884211abcb
2 changed files with 31 additions and 11 deletions

View File

@@ -282,7 +282,7 @@ Reference counting is handled automatically to manage the sidecar lifecycle.
### `const pipe = Pear.worker.run(link <String>, args <Array<String>>)` ### `const pipe = Pear.worker.run(link <String>, args <Array<String>>)`
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()` ### `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/structures/desktop-capturer-source
* [`<NativeImage>`](https://www.electronjs.org/docs/latest/api/native-image) * [`<NativeImage>`](https://www.electronjs.org/docs/latest/api/native-image)
### `Pear.versions <Object>` ### `Pear.versions <Async Function>`
Versions object. Pear versions are objects with the shape `{ fork <Integer>, length <Integer>, key <Buffer> }`. Function that returns a promise which resolves to a Pear versions object with the shape `{ fork <Integer>, length <Integer>, key <Buffer> }`.
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. 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. The platform version.
### `Pear.versions.application { fork <Integer>, length <Integer>, key <Buffer> }` ### `Pear.versions.app { fork <Integer>, length <Integer>, key <Buffer> }`
The application version. The application version.
### `Pear.versions.runtimes { bare <Integer>, electron <Integer>, pear <Integer> }`
The versions of runtimes.
**References** **References**
* [Pear.config.key](#pearconfigkey-objectnull) * [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 an application begins to unload. Any promise returned from each supplied function
will be waited upon until resolution before calling the next teardown handler. 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()` ### `Pear.restart()`
Restart the application. Restart the application.
@@ -427,12 +435,16 @@ The `listener` function is called for every incoming wakeup with a `wakeup` obje
{ {
type: 'pear/wakeup', type: 'pear/wakeup',
link: <String>, link: <String>,
data: <String> linkData: <String>,
fragment: <String>,
entrypoint: <String>
} }
``` ```
* `link` is the `pear://` link for the application receiving the wakeup * `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. Also returns a [`streamx`](https://github.com/mafintosh/streamx) `Readable`) stream.

View File

@@ -10,6 +10,10 @@ Create initial project files.
Template Types: desktop, terminal, terminal-node 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 --yes|-y Autoselect all defaults
--type|-t=type Template type. Overrides <link|type> --type|-t=type Template type. Overrides <link|type>
@@ -61,15 +65,14 @@ Specify a remote key to reseed.
--verbose|-v Additional output --verbose|-v Additional output
``` ```
## `pear run [flags] <key|dir|alias> [...app-args]` ## `pear run [flags] <link|dir> [...app-args]`
Run an application from a key or dir. Run an application from a key or dir.
| | | | | |
|-------|---------------------------------------------------| |-------|---------------------------------------------------|
| key | `pear://<key>` | | link | `pear://<key>` \| `pear://<alias>` |
| dir | `file://<absolute-path>` \| `<absolute-path>` \| `<relative-path>` | | dir | `file://<absolute-path>` \| `<absolute-path>` \| `<relative-path>` |
| alias | `pear://<alias>` |
``` ```
@@ -80,6 +83,7 @@ Run an application from a key or dir.
--link=url Simulate deep-link click open --link=url Simulate deep-link click open
--store|-s=path Set the Application Storage path --store|-s=path Set the Application Storage path
--tmp-store|-t Automatic new tmp folder as store path --tmp-store|-t Automatic new tmp folder as store path
--links <kvs> Override configured links with comma-separated key-values
--chrome-webrtc-internals Enable chrome://webrtc-internals --chrome-webrtc-internals Enable chrome://webrtc-internals
--unsafe-clear-app-storage Clear app storage --unsafe-clear-app-storage Clear app storage
--unsafe-clear-preferences Clear preferences (such as trustlist) --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 --checkout=staged Run checkout from latest version length
--no-ask-trust Exit instead of asking to trust unknown keys --no-ask-trust Exit instead of asking to trust unknown keys
--detached Wakeup existing app or run detached --detached Wakeup existing app or run detached
--help|-h Show help
``` ```
### Examples ### Examples
@@ -138,13 +143,16 @@ Supply no argument to view platform information.
--json Newline delimited JSON output --json Newline delimited JSON output
``` ```
## `pear dump <key> [dir]` ## `pear dump [flags] <link> <dir>`
Synchronize files from key to dir. Synchronize files from key to dir.
> To dump to stdout use `-` in place of `<dir>`
``` ```
--checkout=n Dump from specified checkout, n is version length
--json Newline delimited JSON output --json Newline delimited JSON output
--checkout=n Dump from a custom release length (version) --help|-h Show help
``` ```
## `pear sidecar` ## `pear sidecar`