Skip to content

Commit 4e062ad

Browse files
committed
docs: correct README for root and monorepos
1 parent 6e44510 commit 4e062ad

6 files changed

Lines changed: 106 additions & 156 deletions

File tree

README.md

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,8 @@
22

33
> An ActionCable companion for Y.js clients
44
5-
This *gem* builds on top of [ActionCable](https://guides.rubyonrails.org/action_cable_overview.html),
6-
but guarantees [at-least-once delivery](https://www.cloudcomputingpatterns.org/at_least_once_delivery/)
7-
for all subscribed clients. *ActionCable* uses [Redis Pub/Sub](https://redis.io/docs/manual/pubsub/),
8-
which cannot guarantee delivery under all circumstances (e.g. a temporary disconnected
9-
client, server process crash, …).
10-
11-
*yrb-actioncable* achieves this by storing all sent messages into
12-
[Redis Streams](https://redis.io/docs/data-types/streams/), and the client is
13-
responsible for fetching messages that it hasn't received yet and must
14-
acknowledge retrieving messages. A sending client must also receive an
15-
*acknowledgment* response from the server, before disposing the message locally.
16-
Otherwise, the client must send the message again (using an exponential backoff
17-
mechanism).
18-
19-
```mermaid
20-
sequenceDiagram
21-
participant client_a
22-
participant client_b
23-
participant server
24-
participant stream
25-
26-
client_a->>server: send update to server
27-
server->>server: process update
28-
server->>append_log: append update
29-
server->>client_a: acknowlege update
30-
31-
server->>client_b: send signal about update
32-
client_b->>append_log: fetch update(s) from append_log
33-
```
34-
35-
## Installation
36-
37-
Add this line to your application's Gemfile:
38-
39-
```ruby
40-
gem "yrb-actioncable"
41-
```
42-
43-
And then execute:
44-
45-
```bash
46-
$ bundle
47-
```
48-
49-
Or install it yourself as:
50-
51-
```bash
52-
$ gem install yrb-actioncable
53-
```
5+
This is a monorepo with [npm modules](./packages) and [Ruby gems](./gems).
6+
Please check the respective sub-repos for more information.
547

558
## License
569

gems/yrb-actioncable/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# yrb-actioncable
2+
3+
> An ActionCable companion for Y.js clients
4+
5+
This *gem* builds on top of [ActionCable](https://guides.rubyonrails.org/action_cable_overview.html),
6+
but guarantees [at-least-once delivery](https://www.cloudcomputingpatterns.org/at_least_once_delivery/)
7+
for all subscribed clients. *ActionCable* uses [Redis Pub/Sub](https://redis.io/docs/manual/pubsub/),
8+
which cannot guarantee delivery under all circumstances (e.g. a temporary disconnected
9+
client, server process crash, …).
10+
11+
*yrb-actioncable* achieves this by storing all sent messages into
12+
[Redis Streams](https://redis.io/docs/data-types/streams/), and the client is
13+
responsible for fetching messages that it hasn't received yet and must
14+
acknowledge retrieving messages. A sending client must also receive an
15+
*acknowledgment* response from the server, before disposing the message locally.
16+
Otherwise, the client must send the message again (using an exponential backoff
17+
mechanism).
18+
19+
```mermaid
20+
sequenceDiagram
21+
participant client_a
22+
participant client_b
23+
participant server
24+
participant stream
25+
26+
client_a->>server: send update to server
27+
server->>server: process update
28+
server->>append_log: append update
29+
server->>client_a: acknowlege update
30+
31+
server->>client_b: send signal about update
32+
client_b->>append_log: fetch update(s) from append_log
33+
```
34+
35+
## Installation
36+
37+
Add this line to your application's Gemfile:
38+
39+
```ruby
40+
gem "yrb-actioncable"
41+
```
42+
43+
And then execute:
44+
45+
```bash
46+
$ bundle
47+
```
48+
49+
Or install it yourself as:
50+
51+
```bash
52+
$ gem install yrb-actioncable
53+
```
54+
55+
## License
56+
57+
The gem is available as *open source* under the terms of the
58+
[MIT License](https://opensource.org/licenses/MIT).

node_modules/.yarn-integrity

Lines changed: 21 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/yrb-actioncable/README.md

Lines changed: 19 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,32 @@
1-
# TSDX User Guide
1+
# yrb-actioncable
22

3-
Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.
3+
> A WebSocket provider for Y.js that works with ActionCable
44
5-
> This TSDX setup is meant for developing libraries (not apps!) that can be published to NPM. If you’re looking to build a Node app, you could use `ts-node-dev`, plain `ts-node`, or simple `tsc`.
5+
## Installation
66

7-
> If you’re new to TypeScript, checkout [this handy cheatsheet](https://devhints.io/typescript)
8-
9-
## Commands
10-
11-
TSDX scaffolds your new library inside `/src`.
12-
13-
To run TSDX, use:
7+
With npm:
148

159
```bash
16-
npm start # or yarn start
10+
npm install yrb-actioncable
1711
```
1812

19-
This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.
20-
21-
To do a one-off build, use `npm run build` or `yarn build`.
22-
23-
To run tests, use `npm test` or `yarn test`.
24-
25-
## Configuration
26-
27-
Code quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields in `package.json` accordingly.
28-
29-
### Jest
30-
31-
Jest tests are set up to run with `npm test` or `yarn test`.
13+
With yarn:
3214

33-
### Bundle Analysis
34-
35-
[`size-limit`](https://github.com/ai/size-limit) is set up to calculate the real cost of your library with `npm run size` and visualize the bundle with `npm run analyze`.
36-
37-
#### Setup Files
38-
39-
This is the folder structure we set up for you:
40-
41-
```txt
42-
/src
43-
index.tsx # EDIT THIS
44-
/test
45-
blah.test.tsx # EDIT THIS
46-
.gitignore
47-
package.json
48-
README.md # EDIT THIS
49-
tsconfig.json
15+
```bash
16+
yarn add yrb-actioncable --save
5017
```
5118

52-
### Rollup
53-
54-
TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.
55-
56-
### TypeScript
57-
58-
`tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs.
19+
## Usage
5920

60-
## Continuous Integration
21+
```typescript
22+
import {Doc} from "yjs";
23+
import {WebsocketProvider} from "yrb-actioncable";
6124

62-
### GitHub Actions
63-
64-
Two actions are added by default:
65-
66-
- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
67-
- `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit)
68-
69-
## Optimizations
70-
71-
Please see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know that you can take advantage of development-only optimizations:
72-
73-
```js
74-
// ./types/index.d.ts
75-
declare var __DEV__: boolean;
76-
77-
// inside your code...
78-
if (__DEV__) {
79-
console.log('foo');
80-
}
25+
const document = new Doc();
26+
const provider = new WebsocketProvider(
27+
document,
28+
consumer,
29+
"SyncChannel",
30+
{path: "issues/1"}
31+
);
8132
```
82-
83-
You can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant) and [warning](https://github.com/palmerhq/tsdx#warning) functions.
84-
85-
## Module Formats
86-
87-
CJS, ESModules, and UMD module formats are supported.
88-
89-
The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.
90-
91-
## Named Exports
92-
93-
Per Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split inside your React app instead of your React library.
94-
95-
## Including Styles
96-
97-
There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.
98-
99-
For vanilla CSS, you can include it at the root directory and add it to the `files` section in your `package.json`, so that it can be imported separately by your users and run through their bundler's loader.
100-
101-
## Publishing to NPM
102-
103-
We recommend using [np](https://github.com/sindresorhus/np).

packages/yrb-actioncable/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"devDependencies": {
5252
"@rails/actioncable": "^7.0.4",
5353
"@size-limit/preset-small-lib": "^8.1.0",
54+
"@types/actioncable": "^5.2.7",
5455
"@types/rails__actioncable": "^6.1.6",
5556
"eslint-config-custom": "*",
5657
"husky": "^8.0.2",

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,11 @@
15591559
"@size-limit/esbuild" "8.1.0"
15601560
"@size-limit/file" "8.1.0"
15611561

1562+
"@types/actioncable@^5.2.7":
1563+
version "5.2.7"
1564+
resolved "https://registry.yarnpkg.com/@types/actioncable/-/actioncable-5.2.7.tgz#b42de922ba32f1a46c863df1ed32807ab08dda80"
1565+
integrity sha512-HVpCvvE4Att0vSfCVNHf3gmCoqQPlySWIhH4THkG4r0hc0IcvRa0gIVyd9ekswMf3WiBsDc52OKnduIZQ7qcRw==
1566+
15621567
"@types/babel__core@^7.1.7":
15631568
version "7.1.20"
15641569
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.20.tgz#e168cdd612c92a2d335029ed62ac94c95b362359"

0 commit comments

Comments
 (0)