mirror of
https://github.com/aljazceru/pear-docs.git
synced 2025-12-17 14:34:19 +01:00
Updating guides (1.5.0) (#154)
* Remove `--` for app option passthrough Changed since `paparam` was used for parsing command line options: 85892a6a32a84ae42a548f8e3ac0b5dbedd70c80 Now uses `cmd.rest` for app args. * Use `Pear.config.args` for howto scripts * Update "starting a pear desktop project" guide to match template * Remove `--no-ask-trust` flag from `pear run` cli doc This command was replaced by `--no-ask` which was already in the documentation. Updated a reference to `--no-ask-trust` in the 'Sharing a Pear Application' guide. * Fix typos in "Releasing a Pear Application" guide * Correct application storage folder name in hyperbee howto * Add missing `test/index.test.js` in project structure for terminal guide * Remove language about app continuing to run This is no longer true at least as of pear: v0.5114.pqbzjhqyonxprx8hghxexnmctw75mr91ewqw5dxe1zmntfyaddqy / v1.5.0 * Fix extra indention in example code for hypercore howto * Format json in `_template.json` example * Add instructions to set up a minimal `package.json` for testing template Without this, the next step of `pear run --dev .` does not work since `pear` expects a `package.json` file. * Rename hyperbee reader app in hyperdrive howto to avoid name conflict Naming only matters if someone is following the guides and starts each guide from the same root directory. If they do, then `bee-reader-app` from the hyperdrive conflicts with the `bee-reader-app` from the hyperbee howto. * Remove unrelated youtube tutorial from hyperswarm howto * Update guide/creating-a-pear-init-template.md Co-authored-by: David Mark Clements <huperekchunow@googlemail.com> * Fix spelling mistake Co-authored-by: David Mark Clements <huperekchunow@googlemail.com> --------- Co-authored-by: David Mark Clements <huperekchunow@googlemail.com>
This commit is contained in:
@@ -28,28 +28,28 @@ npm install bare-path bare-process hypercore hyperswarm b4a
|
||||
Alter the generated `writer-app/index.js` file to the following:
|
||||
|
||||
```javascript
|
||||
import path from 'bare-path'
|
||||
import process from 'bare-process'
|
||||
import Hyperswarm from 'hyperswarm'
|
||||
import Hypercore from 'hypercore'
|
||||
import b4a from 'b4a'
|
||||
import path from 'bare-path'
|
||||
import process from 'bare-process'
|
||||
import Hyperswarm from 'hyperswarm'
|
||||
import Hypercore from 'hypercore'
|
||||
import b4a from 'b4a'
|
||||
|
||||
const swarm = new Hyperswarm()
|
||||
Pear.teardown(() => swarm.destroy())
|
||||
const swarm = new Hyperswarm()
|
||||
Pear.teardown(() => swarm.destroy())
|
||||
|
||||
const core = new Hypercore(path.join(Pear.config.storage, 'writer-storage'))
|
||||
const core = new Hypercore(path.join(Pear.config.storage, 'writer-storage'))
|
||||
|
||||
// core.key and core.discoveryKey will only be set after core.ready resolves
|
||||
await core.ready()
|
||||
console.log('hypercore key:', b4a.toString(core.key, 'hex'))
|
||||
// core.key and core.discoveryKey will only be set after core.ready resolves
|
||||
await core.ready()
|
||||
console.log('hypercore key:', b4a.toString(core.key, 'hex'))
|
||||
|
||||
// Append all stdin data as separate blocks to the core
|
||||
process.stdin.on('data', (data) => core.append(data))
|
||||
// Append all stdin data as separate blocks to the core
|
||||
process.stdin.on('data', (data) => core.append(data))
|
||||
|
||||
// core.discoveryKey is *not* a read capability for the core
|
||||
// It's only used to discover other peers who *might* have the core
|
||||
swarm.join(core.discoveryKey)
|
||||
swarm.on('connection', conn => core.replicate(conn))
|
||||
// core.discoveryKey is *not* a read capability for the core
|
||||
// It's only used to discover other peers who *might* have the core
|
||||
swarm.join(core.discoveryKey)
|
||||
swarm.on('connection', conn => core.replicate(conn))
|
||||
```
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ In another terminal, open the `reader-app` and pass it the key:
|
||||
|
||||
```
|
||||
cd reader-app
|
||||
pear run --dev . -- <SUPPLY THE KEY HERE>
|
||||
pear run --dev . <SUPPLY THE KEY HERE>
|
||||
```
|
||||
|
||||
As inputs are made to the terminal running the writer application, outputs should be shown in the terminal running the reader application.
|
||||
|
||||
Reference in New Issue
Block a user