Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): migrate website to React #233

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
36 changes: 23 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
public
build-command-docs
build-command-json
build-topics
build-clients
content/commands/*
!content/commands/_index.md
content/topics/*
!content/topics/_index.md
_site
_data/groups.json
_data/resp2_replies.json
_data/resp3_replies.json
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
dist
build
coverage
.next
.vercel
.cache
public
pnpm-lock.yaml
package-lock.json
yarn.lock
6 changes: 4 additions & 2 deletions CONTRIBUTING-BLOG-POST.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Attaching a photo isn’t always possible, so don’t fret if you don’t want t

## Step 4: Put everything together

[Valkey.io](http://valkey.io/) uses Zola to build the website: each page requires what’s called *frontmatter*.
[Valkey.io](http://valkey.io/) follows Zola format to build the website: each page requires what’s called *frontmatter*.
*Frontmatter* is a short snippet of [TOML](https://toml.io/en/) surrounded by `+++` that defines metadata about your post.

Here is an example of the frontmatter:
Expand All @@ -83,6 +83,8 @@ description= "It's become clear that people want to talk about Valkey and have b
# 'authors' are the folks who wrote or contributed to the post.
# Each author corresponds to a biography file (more info later in this document)
authors= [ "maury", "jacobim" ]
categories= "update"
trending= true
+++
```

Expand Down Expand Up @@ -146,4 +148,4 @@ They may have feedback for you and ask you to make changes.
Once everyone is satisfied with the post, the maintainers will merge it into the `main` branch.
The `main` branch of the repo represents the *future* state of all integrated changes before publishing.
At this point, the maintainers make further changes to your post to properly schedule or link the post.
Once this occurs, the maintainers will make move the changes into ‘production’ which will trigger a rebuild and publishing of the content website to [Valkey.io](http://valkey.io/)
Once this occurs, the maintainers will make move the changes into ‘production’ which will trigger a rebuild and publishing of the content website to [Valkey.io](http://valkey.io/)
108 changes: 48 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Valkey.io website
# Valkey.io

This repo contains the source for the valkey.io website (build scripts, template, blog posts, stylesheets, etc.).
The build integrates content from [`valkey-io/valkey-doc`](https://github.com/valkey-io/valkey-doc) and the commands definitions from [`valkey-io/valkey`](https://github.com/valkey-io/valkey) (see [Build Locally](#build-locally) below for more details).
Expand All @@ -8,87 +8,75 @@ The build integrates content from [`valkey-io/valkey-doc`](https://github.com/va
We welcome contributions! Please see our [CONTRIBUTING](CONTRIBUTING.md) page to learn more about how to contribute to the website.

## Security

If you discover potential security issues, see the reporting instructions on our [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) page for more information.

## Build Locally

This site is built with [Zola](https://www.getzola.org/).

Follow these steps to build the site locally:
## Prerequisites

1. [Install Zola](https://www.getzola.org/documentation/getting-started/installation/).
2. Switch to the directory with your fork of this repo.
3. Run `zola serve`
Before you begin, ensure you have the following installed:
- [Node.js](https://nodejs.org/) (version 16 or higher)
- [pnpm](https://pnpm.io/) (version 8.15.1 or higher)

Open your browser to `http://127.0.0.1:1111/`
## Installation

Zola will automatically rebuild on changes to the template or any content stored in this repo.
Changes to external content (command reference, documentation topics) require a restart of the Zola server process (`ctrl-c` then `zola serve` again, a browser refresh may also be needed).
1. Clone the repository:
```bash
git clone https://github.com/yourusername/valkey.io.git
cd valkey.io
```

## Building additional content
2. Install dependencies:
```bash
pnpm install
```

**By default, the site will build without documentation topics, command reference, or the clients page.**
The content for documentation topics and the clients page are stored within the `valkey-io/valkey-doc` repo.
The content for the command reference page is in the `valkey-io/valkey` repo.
## Development

If you want to build the site with this content, you'll need to have a local copy of `valkey-io/valkey-doc` and `valkey-io/valkey` _outside_ of this repo.
Then follow the instructions to [build the documentation topics and clients](#building-the-documentation-topics-and-clients-page) and/or [build the command reference](#building-the-command-reference).
The instructions show how to use scripts that create symbolic links to the `valkey-io/valkey-doc` and `valkey-io/valkey` repos as well as create a series of empty stub files that tell Zola to create pages.
To start the development server:
```bash
pnpm dev
```

### Building the documentation topics and clients page
This will start the development server at `http://localhost:5173`

Documentation 'topics' (i.e. `/topics/keyspace/`, `/topics/encryption/`, `/topics/transactions/`) and the client libraries' data (i.e. `/client-page-clients/nodejs/valkey-glide`, `/client-page-clients/python/valkey-py`) sources content from `valkey-io/valkey-doc`.
## Building for Production

```mermaid
flowchart TD
A[Webpage: /topics/keyspace/ ]
A --> B[Template: valkey-io/valkey-website]
B --> H[Repo: valkey-io/valkey-doc ] --> I[File: /topics/keyspace.md ] --> Y[Topic content]
To create a production build:
```bash
pnpm build
```

Let's say that this repo and your local copy of `valkey-io/valkey-doc` reside in the same directory.
First, stop the `zola serve` process if you're running it.
From the root directory of this repo run:
The built files will be in the `dist` directory.

```shell
# You should only need to run this once or when you add a new topic/client.
./build/init-topics-and-clients.sh ../valkey-doc/topics ../valkey-doc/clients
To preview the production build locally:
```bash
pnpm preview
```

Then, restart Zola.
Point your browser at `http://127.0.0.1:1111/topics/` and you should see the fully populated list of topics and clients.
All files created in this process are ignored by git.
Commit your changes to your local copy of `valkey-io/valkey-doc`.
## Scripts

### Building the command reference
- `pnpm dev` - Start development server
- `pnpm build` - Create production build
- `pnpm lint` - Run ESLint
- `pnpm preview` - Preview production build

The command reference (i.e. `/commands/set/`, `/commands/get/`, `/commands/lolwut/`) sources information from `valkey-io/valkey`, and `valkey-io/valkey-doc`.
`valkey-io/valkey` provides the command metadata (items like computational complexity, version history, arguments, etc) whilst `valkey-io/valkey-doc` provides the command description and the command reply.
## Tech Stack

```mermaid
flowchart TD
A[Webpage: valkey.io/commands/set]
A --> B[Template: valkey-io/valkey-website]
B --> F[Repo: valkey-io/valkey ] --> G[File: /src/commands/set.json ] --> X[Command Metadata]
B --> H[Repo: valkey-io/valkey-doc ] --> I[File: /commands/set.md ] --> Y[Command Description]
H --> J[Files: /resp2_replies.json,<br/>/resp3_replies.json] --> Z[Command Reply]
```
- React 18
- TypeScript
- Vite
- ESLint
- Node.js

Let's say that this repo and your local copy of `valkey-io/valkey-doc` and `valkey-io/valkey` reside in the same directories.
First, stop the `zola serve` process if you're running it.
From the root directory of this repo run:
## Project Structure

```shell
# You should only need to run this once or when you add a new command.
./build/init-commands.sh ../valkey-doc/commands ../valkey/src/commands
```

Then, restart Zola.
Point your browser at `http://127.0.0.1:1111/commands/` and you should see the fully populated list of topics.
All files created in this process are ignored by git.
Commit your changes to your local copy of `valkey-io/valkey-doc` for description changes and `valkey-io/valkey` for command JSON changes (if you have any).
valkey.io/
├── src/ # Source files
├── public/ # Static files
├── dist/ # Built files (after running build)
└── package.json # Project configuration
```

## License

This project is licensed under the BSD-3-Clause License.
[MIT](LICENSE)
81 changes: 0 additions & 81 deletions _data/participants.yml

This file was deleted.

37 changes: 0 additions & 37 deletions _data/repos.yml

This file was deleted.

Empty file added assets/media/blog/default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions build/custom-frontmatter/topics/history.toml

This file was deleted.

53 changes: 0 additions & 53 deletions build/init-commands.sh

This file was deleted.

Loading