Add missing import of process (#108)

* Add missing import of process

* Add missing (bare-)process

* Add missing (bare-)process

* Add missing (bare-)process
This commit is contained in:
Thomas Verstreken
2024-06-04 10:13:08 +02:00
committed by rafapaezbas
parent 74c4e389b8
commit a90e91fd6b
4 changed files with 10 additions and 5 deletions

View File

@@ -16,7 +16,7 @@ Create the `peer-app` project with the following commands:
mkdir peer-app mkdir peer-app
cd peer-app cd peer-app
pear init -y -t terminal pear init -y -t terminal
npm install hyperswarm hypercore-crypto b4a npm install hyperswarm hypercore-crypto b4a bare-process
``` ```
Alter the peer-app/index.js file to the following: Alter the peer-app/index.js file to the following:
@@ -25,6 +25,7 @@ Alter the peer-app/index.js file to the following:
import Hyperswarm from 'hyperswarm' import Hyperswarm from 'hyperswarm'
import crypto from 'hypercore-crypto' import crypto from 'hypercore-crypto'
import b4a from 'b4a' import b4a from 'b4a'
import process from 'bare-process'
const swarm = new Hyperswarm() const swarm = new Hyperswarm()
Pear.teardown(() => swarm.destroy()) Pear.teardown(() => swarm.destroy())

View File

@@ -21,7 +21,7 @@ Create the `server-app` project with the following commands:
mkdir server-app mkdir server-app
cd server-app cd server-app
pear init -y -t terminal pear init -y -t terminal
npm install hyperdht b4a npm install hyperdht b4a bare-process
``` ```
Alter `server-app/index.js` to the following: Alter `server-app/index.js` to the following:
@@ -29,6 +29,7 @@ Alter `server-app/index.js` to the following:
```javascript ```javascript
import DHT from 'hyperdht' import DHT from 'hyperdht'
import b4a from 'b4a' import b4a from 'b4a'
import process from 'bare-process'
const dht = new DHT() const dht = new DHT()
@@ -57,13 +58,14 @@ Create the `client-app` project with the following commands:
mkdir client-app mkdir client-app
cd client-app cd client-app
pear init -y -t terminal pear init -y -t terminal
npm install hyperdht b4a npm install hyperdht b4a bare-process
``` ```
Alter `client-app/index.js` to the following: Alter `client-app/index.js` to the following:
``` javascript ``` javascript
import DHT from 'hyperdht' import DHT from 'hyperdht'
import b4a from 'b4a' import b4a from 'b4a'
import process from 'bare-process'
console.log('Connecting to:', process.argv[2]) console.log('Connecting to:', process.argv[2])
const publicKey = b4a.from(process.argv[2], 'hex') const publicKey = b4a.from(process.argv[2], 'hex')

View File

@@ -165,7 +165,7 @@ In a new terminal, create the `bee-reader-app` project with these commands:
mkdir bee-reader-app mkdir bee-reader-app
cd bee-reader-app cd bee-reader-app
pear init -y -t terminal pear init -y -t terminal
npm install corestore hyperswarm hyperdrive debounceify b4a npm install corestore hyperswarm hyperdrive debounceify b4a bare-process
``` ```
Adjust the `bee-reader-app/index.js` file to: Adjust the `bee-reader-app/index.js` file to:
@@ -176,6 +176,7 @@ import Corestore from 'corestore'
import Hyperbee from 'hyperbee' import Hyperbee from 'hyperbee'
import debounce from 'debounceify' import debounce from 'debounceify'
import b4a from 'b4a' import b4a from 'b4a'
import process from 'bare-process'
// create a Corestore instance // create a Corestore instance
const store = new Corestore(Pear.config.storage) const store = new Corestore(Pear.config.storage)

View File

@@ -164,7 +164,7 @@ Finally create a `core-reader-app` project:
mkdir core-reader-app mkdir core-reader-app
cd core-reader-app cd core-reader-app
pear init -y -t terminal pear init -y -t terminal
npm install corestore hyperswarm hyperbee b4a npm install corestore hyperswarm hyperbee b4a bare-process
``` ```
@@ -174,6 +174,7 @@ Alter the generated `core-reader-app/index.js` file to the following
import Hyperswarm from 'hyperswarm' import Hyperswarm from 'hyperswarm'
import Corestore from 'corestore' import Corestore from 'corestore'
import b4a from 'b4a' import b4a from 'b4a'
import process from 'bare-process'
import { Node } from 'hyperbee/lib/messages.js' import { Node } from 'hyperbee/lib/messages.js'