Skip to content
This repository was archived by the owner on Aug 15, 2022. It is now read-only.

Commit 6da4daa

Browse files
committed
chore(workspace, docs): update readme, update workspace configs
1 parent 5c68653 commit 6da4daa

File tree

13 files changed

+576
-225
lines changed

13 files changed

+576
-225
lines changed

.eslintrc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
{
22
"extends": [
33
"oclif",
4-
"oclif-typescript"
4+
"oclif-typescript",
5+
"standard"
56
],
67
"root": true,
78
"rules": {
8-
"node/no-missing-import": 1
9+
"node/no-missing-import": "off",
10+
"unicorn/no-process-exit": "off",
11+
"no-process-exit": "off"
912
}
1013
}

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
*-debug.log
2-
*-error.log
3-
/.nyc_output
1+
*.log
42
/dist
53
/lib
6-
/package-lock.json
74
/tmp
85
node_modules
6+
.DS_Store

.vscode/extensions.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"editorconfig.editorconfig",
4+
"dbaeumer.vscode-eslint"
5+
]
6+
}

.vscode/settings.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"cSpell.words": [
3+
"dstack",
4+
"ipfs",
5+
"libp2p"
6+
],
7+
"editor.codeActionsOnSave": {
8+
"source.fixAll": true
9+
},
10+
"editor.formatOnSave": true,
11+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
12+
}

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
peerchat
1+
Peerchat
22
===============
33

4-
Peer-to-peer terminal chat based on [DStack](https://github.com/dstack-js/dstack)
4+
Zero configuration peer-to-peer terminal chat with built-in end-to-end encryption working on [DStack](https://github.com/dstack-js/dstack)
55

6-
Checkout [DStack blog post](https://dstack.0x77.dev/blog/peerchat) to learn more
6+
[Checkout blog post for more info](https://dstack.0x77.dev/blog/peerchat)
77

88
[![asciicast](https://asciinema.org/a/465056.svg)](https://asciinema.org/a/465056)
9-
10-
_Recording looks ugly, but in terminal it seems to be fine_
11-
12-
[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
9+
[![dstack](https://dstack.0x77.dev/img/badge.svg)](https://dstack.0x77.dev)
1310
[![Version](https://img.shields.io/npm/v/peerchat.svg)](https://npmjs.org/package/peerchat)
1411
[![Downloads/week](https://img.shields.io/npm/dw/peerchat.svg)](https://npmjs.org/package/peerchat)
1512
[![License](https://img.shields.io/npm/l/peerchat.svg)](https://github.com/dstack-js/chat/blob/master/package.json)

docs/demo.svg

Lines changed: 1 addition & 154 deletions
Loading

package.json

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,24 @@
1313
"@dstack-js/lib": "^0.2.23",
1414
"@oclif/command": "^1",
1515
"@oclif/config": "^1",
16-
"@oclif/plugin-help": "^5.1.10",
1716
"blessed": "^0.1.81",
1817
"discord.js": "^13.6.0",
1918
"tslib": "^1",
2019
"wrtc": "^0.4.7"
2120
},
2221
"devDependencies": {
2322
"@oclif/dev-cli": "^1",
23+
"@oclif/plugin-help": "^5.1.10",
24+
"@oclif/plugin-not-found": "^2.3.1",
25+
"@oclif/plugin-warn-if-update-available": "^2.0.4",
2426
"@types/blessed": "^0.1.19",
2527
"@types/node": "^17.0.13",
2628
"eslint": "^7.32.0",
2729
"eslint-config-oclif": "^3.1.2",
2830
"eslint-config-oclif-typescript": "^0.2.0",
31+
"eslint-config-standard": "^16.0.3",
32+
"eslint-plugin-import": "^2.25.4",
33+
"eslint-plugin-promise": "^6.0.0",
2934
"ts-node": "^8",
3035
"typescript": "^4.5.5"
3136
},
@@ -39,20 +44,30 @@
3944
],
4045
"homepage": "https://github.com/dstack-js/chat",
4146
"keywords": [
42-
"oclif"
47+
"oclif",
48+
"blessed",
49+
"dstack",
50+
"ipfs",
51+
"libp2p",
52+
"peer-to-peer",
53+
"chat",
54+
"zero-configuration"
4355
],
4456
"license": "GPL-3.0",
4557
"main": "lib/index.js",
4658
"oclif": {
4759
"commands": "./lib/commands",
4860
"bin": "peerchat",
4961
"plugins": [
50-
"@oclif/plugin-help"
62+
"@oclif/plugin-help",
63+
"@oclif/plugin-not-found",
64+
"@oclif/plugin-warn-if-update-available"
5165
]
5266
},
5367
"repository": "dstack-js/chat",
5468
"scripts": {
55-
"posttest": "eslint . --ext .ts --config .eslintrc",
69+
"lint": "eslint . --ext .ts --config .eslintrc",
70+
"posttest": "yarn lint",
5671
"prepack": "rm -rf lib && tsc -b && oclif-dev readme",
5772
"test": "echo NO TESTS",
5873
"version": "oclif-dev readme && git add README.md"

src/commands/discord/index.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
import {Command, flags} from '@oclif/command'
1+
import { Command, flags } from '@oclif/command'
22
import PeerChat from '..'
3-
import {getStack} from '../../services/stack'
4-
import Discord, {Intents} from 'discord.js'
3+
import { getStack } from '../../services/stack'
4+
import Discord, { Intents } from 'discord.js'
55

66
class DiscordRelay extends Command {
7-
static description = 'Peerchat <-> Discord'
7+
static description = 'Peerchat/Discord relay'
88

99
static flags = {
10-
version: flags.version({char: 'v'}),
10+
version: flags.version({ char: 'v' })
1111
}
1212

1313
static examples = [
14-
'$ peerchat discord',
15-
'$ peerchat discord [ROOM]',
16-
'$ peerchat discord dstack',
14+
'$ CHANNEL_ID="<discord channel id>" DISCORD_KEY="<discord bot token>" peerchat discord',
15+
'$ CHANNEL_ID="<discord channel id>" DISCORD_KEY="<discord bot token>" peerchat discord [ROOM]',
16+
'$ CHANNEL_ID="<discord channel id>" DISCORD_KEY="<discord bot token>" peerchat discord dstack'
1717
]
1818

19-
static args = [{name: 'room', default: PeerChat.args[0].default, description: 'chat room'}]
19+
static args = [{ name: 'room', default: PeerChat.args[0].default, description: 'chat room' }]
2020

2121
async run() {
22-
const {args} = this.parse(DiscordRelay)
22+
const { args } = this.parse(DiscordRelay)
2323

2424
if (!process.env.DISCORD_KEY) {
2525
throw new Error('DISCORD_KEY env is missing')
2626
}
2727

28-
const {pubsub} = await getStack()
29-
const client = new Discord.Client({intents: [Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILDS, Intents.FLAGS.DIRECT_MESSAGES]})
28+
const { pubsub } = await getStack()
29+
const client = new Discord.Client({ intents: [Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILDS, Intents.FLAGS.DIRECT_MESSAGES] })
3030
await client.login(process.env.DISCORD_KEY)
3131

3232
client.on('message', async msg => {
3333
if (msg.author.bot) return
3434

35-
await pubsub.publish(args.room, {nickname: msg.author.tag, message: msg.content})
35+
await pubsub.publish(args.room, { nickname: msg.author.tag, message: msg.content })
3636
})
3737

3838
await pubsub.subscribe(args.room, async event => {

src/commands/index.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
import {Command, flags} from '@oclif/command'
2-
import {run} from '../services/chat'
1+
import { Command, flags } from '@oclif/command'
2+
import { run } from '../services/chat'
33

44
export default class PeerChat extends Command {
55
static description = 'Peer-to-peer terminal chat running on DStack'
66

77
static flags = {
8-
version: flags.version({char: 'v'}),
8+
version: flags.version({ char: 'v' })
99
}
1010

1111
static examples = [
1212
'$ peerchat',
1313
'$ peerchat [ROOM] [NICKNAME]',
14-
'$ peerchat dstack myCoolNickname',
14+
'$ peerchat dstack myCoolNickname'
1515
]
1616

17-
static args = [{name: 'room', default: 'dstack', description: 'chat room'}, {name: 'nickname', description: 'your nickname'}]
17+
static args = [
18+
{ name: 'room', default: 'dstack', description: 'chat room' },
19+
{ name: 'nickname', description: 'your nickname' }
20+
]
1821

1922
async run() {
20-
const {args} = this.parse(PeerChat)
23+
const { args } = this.parse(PeerChat)
2124
await run(args.room, args.nickname)
2225
}
2326
}

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export {run} from '@oclif/command'
1+
export { run } from '@oclif/command'

0 commit comments

Comments
 (0)