Skip to content

Commit 00191a1

Browse files
authored
docs: deploy docs to gh-pages using github actions (#144)
* github actions to deploy docs to gh-pages * minor docs updates * remove docs/ dir with old docs
1 parent bb293fb commit 00191a1

File tree

243 files changed

+123
-2934
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+123
-2934
lines changed

.github/workflows/docs-deploy.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
name: Deploy to GitHub Pages
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: 18
17+
18+
- name: Install dependencies in apps/liveviewjs.com
19+
run: npm install -w apps/liveviewjs.com
20+
- name: Build docusaurus website
21+
run: npm run build -w apps/liveviewjs.com
22+
23+
# Popular action to deploy to GitHub Pages:
24+
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
25+
- name: Deploy to GitHub Pages
26+
uses: peaceiris/actions-gh-pages@v3
27+
with:
28+
github_token: ${{ secrets.GITHUB_TOKEN }}
29+
# Build output to publish to the `gh-pages` branch:
30+
publish_dir: ./apps/liveviewjs.com/build
31+
user_name: floodfx
32+
user_email: donnie@floodfx.com
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Test Docs Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- "*"
10+
11+
jobs:
12+
test-deploy:
13+
name: Test Docs Build
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 18
20+
- name: Install dependencies in apps/liveviewjs.com
21+
run: npm install -w apps/liveviewjs.com
22+
- name: Build docusaurus website
23+
run: npm run build -w apps/liveviewjs.com

apps/liveviewjs.com/docs/01-overview/gratitude.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ we can reuse on the client side.
1111
client code instead of reinventing!
1212

1313
🙌 Thanks to [@blimmer](https://github.com/blimmer/) for the awesome feedback, documentation suggestions, and support!
14+
15+
Thanks to you for checking out **LiveViewJS**! We hope you enjoy it as much as we do!

apps/liveviewjs.com/docs/01-overview/introduction.md

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,39 @@ far less code and complexity and far more speed and efficiency**.
1111

1212
## What is a LiveView?
1313

14-
A LiveView is a server-rendered HTML page that connects to the server via a persistent web socket. The web socket allows
15-
the client to send user events to the server and the server to send diffs in response. **LiveViewJS** is a LiveView
16-
framework that handles the complex part of this (handling websockets, diffing changes, applying DOM updates, etc.) so that
17-
you can focus on building your application.
14+
The LiveView pattern, [as popularized in Elixir’s Phoenix framework](https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.html), shifts your UI’s state management, event handling to the server, calculating minimal diffs to drive updates in your HTML over WebSockets.
1815

19-
Here's the typical "counter" example written as a LiveView in **LiveViewJS**:
16+
There are many benefits to this approach, including:
17+
* extremely fast, SEO-friendly page loads
18+
* simple state management that works well at any scale (not just small apps)
19+
* minimal data transfer (only send diffs)
20+
* no need to build (or operate) REST or GraphQL APIs
21+
22+
There are also some drawbacks, including:
23+
* requires a server (e.g. pure static sites are not the best fit)
24+
* requires a internet connection (e.g. offline-first apps are not the best fit - though sporadic internet connectivity is fine)
25+
26+
If you are building a web-based application, the LiveView approach is a super-powerful, some say "game-changing", way to build it and LiveViewJS is the best way to do it in NodeJS and Deno.
27+
28+
### More detail
29+
30+
As mentioned, a LiveView is a server-rendered HTML page that, when loaded, connects back to the server via a persistent web socket. As the user interacts with the LiveView, the client to sends user events (click, keys, etc) via the websocket back to the server and the server responds with diffs to the HTML page in return.
31+
32+
### Websockets and Diffs? That sounds complicated!
33+
34+
As a developer, you don't need to worry about connecting websockets or calculating diffs. **LiveViewJS** handles all of the complex parts of this for you. You just focus on implementing your business logic and rendering your views and LiveViewJS handles the rest.
35+
36+
## Example "Counter" LiveView
37+
38+
Here's the typical "counter" in **LiveViewJS**:
2039

2140
```ts
2241
import { createLiveView, html } from "liveviewjs";
2342

2443
/**
2544
* A basic counter that increments and decrements a number.
2645
*/
27-
export const counterLiveView = createLiveView<
28-
{ count: number }, // Define LiveView Context (a.k.a state)
29-
{ type: "increment" } | { type: "decrement" } // Define LiveView Events
30-
>({
46+
export const counterLiveView = createLiveView({
3147
mount: (socket) => {
3248
// init state, set count to 0
3349
socket.assign({ count: 0 });
@@ -66,16 +82,20 @@ Yes, it "looks" like a React/Vue/Svelt UI but the main differences are:
6682
- This page was first rendered as plain HTML (not a bundle of JS)
6783
- The client is automatically connected to a server via a websocket
6884
- The click events are automatically shipped to the server
69-
- The server then runs the business logic to update the state
70-
- Using the new state, the server then renders a new view and calculates any diffs
71-
- Those diffs are shipped back to the client, where they are automatically applied
85+
- The server then runs the business logic to update the state
86+
- The server automatically calculates the minimal diffs and sends them to the client
87+
- The client automatically applies the diffs to the DOM
7288

7389
Pretty cool eh? We think so too! While this counter LiveView isn't particularly useful, it gives you a quick intro to how
74-
LiveViews work and what they look like both as code and in the browser. We've got a lot more to show you about
75-
**LiveViewJS** including: built-in real-time / multi-player support, built-in form validation with changesets, built-in
76-
file uploads with image previews and drag and drop support, and more!
90+
LiveViews work and what they look like both as code and in the browser.
7791

78-
But first, a bit more about LiveViews...
92+
We've got a lot more to show you about **LiveViewJS** including some amazing features built-in the framework like:
93+
94+
* real-time / multi-player support
95+
* simple, powerfil form validation with changesets
96+
* file uploads with image previews and drag and drop support, and more!
97+
98+
If you want more detail on LiveViews and how awesome they are feel free to keep reading. If you want to jump right in, check out the [Quick Start](../02-quick-starts/get-liveviewjs-repo.md) guide.
7999

80100
## LiveView is already proven technology
81101

@@ -115,9 +135,6 @@ Here is a quote from the author and inventor of LiveView, [Chris McCord](http://
115135
- **No client-side routing** - No need to use a library like React Router or Vue Router. LiveViews route like multi-page
116136
applications which is handled automatically by the browser and server. (Another major complication rendered
117137
unnecessary.)
118-
- **No component libraries (or Storybook) required** - Traditional SPAs require teams to adopt, build or buy and then
119-
maintain, and customize a component library and use something like [Storybook](https://storybook.js.org/). LiveView
120-
simplifies this greatly with server-side HTML templates.
121138

122139
## Disadvantages
123140

@@ -134,11 +151,3 @@ and productivity of LiveView to the NodeJS and Deno ecosystems** and are obvious
134151
team that invented it. We believe in it so much that we think more developers should have access to the programming
135152
paradigm it enables.
136153

137-
### Reach more developers
138-
139-
Unfortunately, Elixir only represents
140-
[about 2%](https://survey.stackoverflow.co/2022/#section-most-popular-technologies-programming-scripting-and-markup-languages)
141-
of the programming language market share. We believe that **LiveViewJS** will help bring the productivity and magic of
142-
LiveView to the
143-
[65% of developers](https://survey.stackoverflow.co/2022/#section-most-popular-technologies-programming-scripting-and-markup-languages)
144-
that use Javascript (and Typescript).

apps/liveviewjs.com/docs/01-overview/runtimes.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ LiveViewJS is broken up into the following packages:
4040
- `liveviewjs` [Node](https://www.npmjs.com/package/liveviewjs) and [Deno](https://deno.land/x/liveviewjs) - The core
4141
package that contains the **LiveViewJS** core server code. This package is runtime agnostic and can be used with
4242
either NodeJS or Deno.
43+
- `@liveviewjs/gen` [Link](https://www.npmjs.com/package/@liveviewjs/gen) - The code generator package that is used to
44+
generate the LiveViewJS code including minimal project configuration for both NodeJS and Deno. This package will also add support for generating LiveViews and LiveComponents as well as other boilerplate code.
45+
- `@liveviewjs/express` [Node](https://www.npmjs.com/package/@liveviewjs/express) - The Express package contains [ExpressJS](https://expressjs.com/) integration code and NodeJS-specific utilities like Redis pub/sub. This package is used to integrate **LiveViewJS** with Express (NodeJS). To user this packages install via `npm install @liveviewjs/express` or `yarn add @liveviewjs/express`.
46+
- `deno` [Link](https://github.com/floodfx/liveviewjs/tree/main/packages/deno) - The Deno package contains [Oak](https://deno.land/x/oak) integration code and Deno-specific LiveViewJS utilities like BroadcastChannel pub/sub. This package is used to integrate **LiveViewJS** with Oak (Deno). To use this package, import into your Deno project via `import { LiveViewJS } from "https://raw.githubusercontent.com/floodfx/liveviewjs/main/packages/deno/mod.ts";`. (Note: DenoLand is broken for mono-repos, so we're hosting the package on GitHub for now.)
4347
- `@liveviewjs/examples` [Node](https://www.npmjs.com/package/@liveviewjs/examples) or
44-
[Deno](https://deno.land/x/liveviewjs/packages/examples/mod.ts) - The package contains all the example LiveViews that
45-
can be run on either NodeJS or Deno. This package is runtime agnostic and can be used with either NodeJS or Deno.
46-
- `@liveviewjs/express` [Node](https://www.npmjs.com/package/@liveviewjs/express) - The Express package that contains
47-
the Express server integration code. This package is used to integrate **LiveViewJS** with Express (NodeJS).
48-
- `https://deno.land/x/liveviewjs@VERSION/packages/deno/mod.ts` - The Deno package that contains the Oak server
49-
integration code. This package is used to integrate **LiveViewJS** with Oak (Deno).
48+
[Deno](https://raw.githubusercontent.com/floodfx/liveviewjs/main/packages/examples/mod.ts) - The package contains all the example LiveViews that
49+
can be run on either NodeJS or Deno. This package is runtime agnostic and can be used with either NodeJS or Deno. See the [examples](https://github.com/floodfx/liveviewjs/tree/main/packages/examples/src/liveviews) directory for the source code.

apps/liveviewjs.com/docs/02-quick-starts/get-liveviewjs-repo.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22
sidebar_position: 1
33
---
44

5+
# Let's Build a LiveView
6+
7+
Building a LiveView is easy with **LiveViewJS**. You can get started in just a few minutes.
8+
9+
## Create a New Project
10+
11+
**LiveViewJS** has a project generation tool that will setup the project structure and install the required dependencies for either NodeJS or Deno.
12+
13+
Run:
14+
```bash
15+
npx @liveviewjs/gen
16+
```
17+
18+
You will be prompted to select the type of project you want to create and a couple other questions. Then, voilà, you will have a new project that runs out of the box!
19+
20+
521
# Download the Repo
622

723
The fastest way to run the example or build your own LiveView is by downloading the **LiveViewJS** repo. This repo

apps/liveviewjs.com/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"docusaurus": "docusaurus",
77
"start": "docusaurus start",
8-
"build": "docusaurus build && rm -rf ../../docs && mv build ../../docs",
8+
"build": "docusaurus build",
99
"swizzle": "docusaurus swizzle",
1010
"deploy": "docusaurus deploy",
1111
"clear": "docusaurus clear",

docs/.nojekyll

Whitespace-only changes.

docs/404.html

Lines changed: 0 additions & 23 deletions
This file was deleted.

docs/CNAME

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)