From 2ee7373e62d09ea2a6d17c75383fd43562f66ec0 Mon Sep 17 00:00:00 2001 From: Vivek Singh <47470314+heyitsvi@users.noreply.github.com> Date: Wed, 25 Sep 2024 15:48:40 +0530 Subject: [PATCH] add pear interface (#143) * add pear interface * fix semi-colon spacing --- .DS_Store | Bin 0 -> 6148 bytes assets/.DS_Store | Bin 0 -> 6148 bytes guide/making-a-pear-desktop-app.md | 14 +++++++++++++- guide/making-a-pear-terminal-app.md | 12 ++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 .DS_Store create mode 100644 assets/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d71279d6678a66ad814ad5269e73848423edfaca GIT binary patch literal 6148 zcmeHKO>fgM7=GQgYr65#14z3dMdCU}HwF^oQc8E=uuH>-5TMdDVU6a+Rnt_?}y*VNgNZAXicI+qB;?ID2(MDRBMFCxvWUZ z_FMxB_VHAzekfIldv@r=G2j^ZzZu|nw@f`6;>woZ-^Um`_^CxFu?@WpS4`s--LHSr z4X4@Aeiy!lLz!gbM&r9EZIvtARj=ypdT)b)ng-+Ec#^exqt|@*Oeq;&wtL}=B%XHb zH=d|;+)L7Uqz#fNhRU0lNgAnXOHI-!)3$*b@M>PITi=__?l+G2{o})<`My7Uc+^1q z-h=tP=H0w~_fe;NE-zB`NoPm`-!Uy$EndQBGz$5D2u7(?=^6Uj<~oHmp@bwws8c$l zJLr+5s88q1Y>8X2$TRDK(~n^H0;?d=URnvk(ewHh_~&R5#l*Yed5awi=sEnKB2I^1t&PGwVnCGJLA!;N?B2SP9PhP0$~zPm)>|0VCaCOotQ)))@1bbHn9mJh)8fJ)dLZsc NK-1tV$G|^j;1^A!>P!Ft literal 0 HcmV?d00001 diff --git a/assets/.DS_Store b/assets/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..71d1cc26cac9604b8ac129d427db98e8f539958c GIT binary patch literal 6148 zcmeHKOHRWu5S=Mm6cErQ8>C#ImH6#LRTiwd08Lw!Le-+u?z86(T!Hhkf;Z!lNLxqB zsvtBIji2Mpi|yywj){o7tKm6Oi-?+V!Q=o*#N@g7mNl&85XkzDHudQRSDWx|H&?(F z_~Q!5+&!iNJ!0lAF>in7ZwK>uM&rBbe2`D)IpSoIxPf=R)R2pFFDTCasKLFAbNOt8 zdlG5$6bPY@gAWU3w#9=jQm9Fh)|55C%@uG3T!FFzvOc76!OXA-s7nVDJpup|6ssXGzX`%g4Ku?cAfCWD zP=SHUcEsR7M|o;-nPCwy(24Ev!B#Wd35B(Gyg$`&;w+%2u7E4BuE1WnZOQ(BTYdgt zC;6Q#;0pXJ1vu&5_qynk?X6p#lf5>DKfuK#t_Y|UB(@!EMz-QpxEh|Nk^yFhML?9m O{6|1#@Wd6^sRG}-sjtTX literal 0 HcmV?d00001 diff --git a/guide/making-a-pear-desktop-app.md b/guide/making-a-pear-desktop-app.md index 22a334c..0253d54 100644 --- a/guide/making-a-pear-desktop-app.md +++ b/guide/making-a-pear-desktop-app.md @@ -169,6 +169,14 @@ Running `pear run --dev .` should show **Note**: Close the app before installing dependencies. If dependencies are installed while the app is running, an error is thrown. +Install the development dependencies using: +``` +npm install +``` +This will install the following: +- [pear-interface](https://github.com/holepunchto/pear-interface) for documentation and auto-completion inside editor. +- [brittle](https://github.com/holepunchto/brittle) a TAP framework for testing. + The app uses these modules: - [hyperswarm](https://www.npmjs.com/package/hyperswarm) to connect peers on a "topic". @@ -187,11 +195,15 @@ npm install hyperswarm hypercore-crypto b4a Replace `app.js` with ``` js + +// For interactive documentation and code auto-completion in editor +/** @typedef {import('pear-interface')} */ + /* global Pear */ import Hyperswarm from 'hyperswarm' // Module for P2P networking and connecting peers import crypto from 'hypercore-crypto' // Cryptographic functions for generating the key in app import b4a from 'b4a' // Module for buffer-to-string and vice-versa conversions -const { teardown, updates } = Pear // Cleanup and updates function +const { teardown, updates } = Pear // Functions for cleanup and updates const swarm = new Hyperswarm() diff --git a/guide/making-a-pear-terminal-app.md b/guide/making-a-pear-terminal-app.md index 327bdc6..22b2be3 100644 --- a/guide/making-a-pear-terminal-app.md +++ b/guide/making-a-pear-terminal-app.md @@ -8,6 +8,14 @@ It continues where [Starting a Pear Terminal Project](./starting-a-pear-terminal ## Step 1. Install modules +Install the development dependencies using: +``` +npm install +``` +This will install the following: +- [pear-interface](https://github.com/holepunchto/pear-interface) for documentation and auto-completion inside editors. +- [brittle](https://github.com/holepunchto/brittle) a TAP framework for testing. + For the chat part of the app, the same modules are needed as in [Making a Pear Desktop Application](./making-a-pear-desktop-app.md), `hyperswarm`, `b4a` and `hypercore-crypto`. Pear runs on [`Bare`](https://github.com/holepunchto/bare), a lightweight JavaScript runtime which is similar to Node.js but comes with very few internal modules. Almost all Bare functionality comes from dependencies. Pear Terminal Applications are Bare applications so we will need `bare-readline` and `bare-tty` to read user input. @@ -22,6 +30,10 @@ npm i bare-readline bare-tty bare-process hyperswarm b4a hypercore-crypto Replace `index.js` with ``` js + +// For interactive documentation and code auto-completion in editor +/** @typedef {import('pear-interface')} */ + /* global Pear */ import Hyperswarm from 'hyperswarm' // Module for P2P networking and connecting peers import b4a from 'b4a' // Module for buffer-to-string and vice-versa conversions