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

Added website #47

Merged
merged 39 commits into from
Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
fe457a4
feat(website): ✨ added basic website boilerplate
arctic-hen7 Sep 30, 2021
d969253
chore: 🔧 added automatic reloading to site dev scripts
arctic-hen7 Sep 30, 2021
fb3809e
feat(website): ✨ added tailwindcss
arctic-hen7 Sep 30, 2021
995ee1b
feat(website): ✨ added initial landing page
arctic-hen7 Sep 30, 2021
0b12e8b
feat(website): ✨ added landing page
arctic-hen7 Oct 1, 2021
4013fad
chore(website): 🔧 make browsersync allow non-extensioned files
arctic-hen7 Oct 1, 2021
713abfd
feat(website): ✨ added comparisons page and improved mobile support o…
arctic-hen7 Oct 1, 2021
4a7698f
chore: 🔀 merged from `main` for new beta version
arctic-hen7 Oct 1, 2021
fc49fc7
refactor(book): ♻️ refactored book for website deployment
arctic-hen7 Oct 2, 2021
f92b9af
chore: 🔀 merged from `main` for latest beta version
arctic-hen7 Oct 2, 2021
0dd86e6
refactor(book): ♻️ refactored book for i18n
arctic-hen7 Oct 2, 2021
26a7ed3
chore: 🔀 merged from `main` for latest beta release
arctic-hen7 Oct 2, 2021
f8b41d5
chore: 🔀 merged from `main` for latest beta release
arctic-hen7 Oct 2, 2021
aa11333
refactor(book): ♻️ refactored docs for new links systems
arctic-hen7 Oct 2, 2021
cef0110
feat(website): ✨ created basic docs system with generation
arctic-hen7 Oct 2, 2021
2496fe4
feat(website): ✨ added docs stability system
arctic-hen7 Oct 3, 2021
58fd174
refactor(book): ♻️ removed `no_run` directives in docs
arctic-hen7 Oct 3, 2021
6719fd8
refactor(book): ♻️ corrected titles in `SUMMARY.md` files
arctic-hen7 Oct 3, 2021
71020eb
feat(website): ✨ created a docs system
arctic-hen7 Oct 3, 2021
bd9b544
feat(website): ✨ added docs version switcher
arctic-hen7 Oct 3, 2021
4126651
refactor(book): ♻️ made all line includes use new directive `#lines_i…
arctic-hen7 Oct 4, 2021
a52239d
feat(website): ✨ added code including
arctic-hen7 Oct 4, 2021
0d33806
feat(website): ✨ added support for including specific lines
arctic-hen7 Oct 4, 2021
ca35e28
docs(book): ✏️ fixed 'amlagamation' typo
arctic-hen7 Oct 4, 2021
43ba935
fix(website): 🐛 fixed prism load failures
arctic-hen7 Oct 4, 2021
e9ee1dc
feat(website): ✨ created placeholder for comparisons page
arctic-hen7 Oct 4, 2021
9117d57
chore: 🔧 added `rust-toolchain` for netlify
arctic-hen7 Oct 4, 2021
b965aef
chore(website): 📦 added `pkg/` to build temporarily
arctic-hen7 Oct 4, 2021
e126571
chore(website): 🙈 removed `pkg/`
arctic-hen7 Oct 4, 2021
7d704f3
fix(website): 🐛 fixed docs version switcher in dark mode
arctic-hen7 Oct 4, 2021
8706c5d
fix(website): 🐛 fixed status messages in dark mode
arctic-hen7 Oct 4, 2021
e8d146b
chore(website): 🔧 added bonnie script to deploy site
arctic-hen7 Oct 4, 2021
4044153
ci(website): 👷 added ci build for website
arctic-hen7 Oct 4, 2021
669b849
ci(website): 💚 fixed ci for tailwindcss
arctic-hen7 Oct 4, 2021
1748d37
refactor(website): 🚨 silenced linter warnings for comparisons page pl…
arctic-hen7 Oct 4, 2021
9cc23b0
ci(website): 💚 fixed ci by adding `npm install` stage
arctic-hen7 Oct 4, 2021
94b9c7e
chore: 🔀 merged from `main`
arctic-hen7 Oct 4, 2021
2ca4fae
ci(website): 👷 updated ci build for full deployment
arctic-hen7 Oct 4, 2021
4d8519a
docs: 📝 added warning notice to readme about switch to website
arctic-hen7 Oct 4, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions .github/workflows/book.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Compile and Deploy Website

on:
push:
paths:
- "docs/**"
- "website/**"
- ".github/workflows/website.yml" # If we change this build script, it should rerun
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: cargo install bonnie
- run: cargo install wasm-pack
- run: cargo install perseus-cli --version 0.3.0-beta.6
- run: npm install
working-directory: website
- name: Build website
run: bonnie site deploy
- name: Deploy website to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: website/pkg
publish_branch: gh-pages
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"examples",
"testing",
"templates",
"exporting"
"exporting",
"website"
]
}
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
members = [
"packages/*",
"examples/*",
"website",
# We have the CLI subcrates as workspace members so we can actively develop on them
# They also can't be a workspace until nested workspaces are supported
"examples/basic/.perseus",
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
[![Top Language](https://img.shields.io/github/languages/top/arctic-hen7/perseus?style=for-the-badge)]()
[![Discord Chat](https://img.shields.io/discord/820400041332179004?label=Discord&style=for-the-badge)](https://discord.gg/PgwPn7dKEk)

> **WARNING:** the book is currently down for maintenance, but itll be back up soon as a fully-fledged website built with Perseus!

Perseus is a blazingly fast frontend web development framework built in Rust with support for major rendering strategies, reactivity without a virtual DOM, and extreme customizability. It wraps the lower-level capabilities of [Sycamore](https://github.com/sycamore-rs/sycamore)!

- 📕 Supports static generation (serving only static resources)
Expand Down
27 changes: 27 additions & 0 deletions bonnie.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,33 @@ dev.subcommands.example.cmd = [
dev.subcommands.example.args = [ "example" ]
dev.subcommands.example.desc = "serves the given example using a live version of the cli"

site.subcommands.export.cmd = [
"cd website",
"find . -not -path \"./.perseus/*\" -not -path \"./target/*\" | entr -s \"perseus export\""
]
site.subcommands.export.desc = "exports the site, watching for changes"
site.subcommands.serve.cmd = [
"cd website",
"browser-sync start --server \".perseus/dist/exported\" --files .perseus/dist --no-open --port 8080 --extensions html"
]
site.subcommands.serve.desc = "serves the site's exported content"
site.subcommands.build-tailwind.cmd = [
"cd website",
"tailwindcss -c ./tailwind.config.js -o ./static/tailwind.css"
]
site.subcommands.build-tailwind.desc = "builds a tailwind stylesheet for development (no purging)"
site.subcommands.build-tailwind.subcommands.prod.cmd = [
"cd website",
"NODE_ENV=production npx tailwindcss -c ./tailwind.config.js -o ./static/tailwind.css --minify"
]
site.subcommands.build-tailwind.subcommands.prod.desc = "builds a tailwind stylesheet for production (purging and minifying)"
site.subcommands.deploy.cmd = [
"bonnie site build-tailwind prod",
"cd website",
"perseus deploy -e"
]
site.subcommands.deploy.desc = "builds the website for production and finalizes it at `website/pkg`"

build = "cargo build"

copy-subcrates.cmd = [
Expand Down
2 changes: 0 additions & 2 deletions docs/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion docs/0.1.x/book.toml

This file was deleted.

21 changes: 21 additions & 0 deletions docs/0.1.x/en-US/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
- [Introduction](/docs/intro)
- [Setup](/docs/setup)
- [Architecture](/docs/arch)
- [Building Your First App](/docs/tutorials/first_app/intro)
- [Installation and Setup](/docs/tutorials/first_app/setup)
- [Writing Your First Template](/docs/tutorials/first_app/template)
- [Setting up the App Itself](/docs/tutorials/first_app/app)
- [CLI](/docs/cli)
- [Templates](/docs/templates)
- [Routing](/docs/routing)
- [Error Pages](/docs/error_pages)
- [Rendering Strategies](/docs/strategies/intro)
- [Build Paths](/docs/strategies/build_paths)
- [Build State](/docs/strategies/build_state)
- [Request State](/docs/strategies/request_state)
- [Revalidation](/docs/strategies/revalidation)
- [Incremental generation](/docs/strategies/incremental)
- [Building](/docs/building)
- [Serving](/docs/serving)
- [Actix Web Integration](/docs/integrations/actix-web)
- [Config Managers](/docs/config_managers)
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/0.1.x/src/building.md → docs/0.1.x/en-US/building.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Building

*You only need this page if you're not using the Perseus CLI, which performs this process for you!*
_You only need this page if you're not using the Perseus CLI, which performs this process for you!_

After you've defined all your templates and the like, you'll of course need to build them into pages! Perseus tries to make this process as simple as possible.

Expand Down Expand Up @@ -49,4 +49,4 @@ The reason we don't just make this whole function asynchronous is so we don't ha

## File Storage

It may have crossed your mind as to where all these static files are stored in production, and Perseus provides an excellent solution to this problem with custom read/write systems, documented in-depth [here](./config_managers.md).
It may have crossed your mind as to where all these static files are stored in production, and Perseus provides an excellent solution to this problem with custom read/write systems, documented in-depth [here](./config_managers).
6 changes: 3 additions & 3 deletions docs/0.1.x/src/cli.md → docs/0.1.x/en-US/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ define_app!{
}
```

This assumes you've defined a function to get your error pages elsewhere (you can read more about that [here](error_pages.md)), and that it's in a module called `error_pages`, you can customize that as needed.
This assumes you've defined a function to get your error pages elsewhere (you can read more about that [here](error_pages)), and that it's in a module called `error_pages`, you can customize that as needed.

The way the rest of this works is pretty simple. First off, you define a router with [Sycamore](https://sycamore-rs.netlify.app/docs/advanced/routing), which defines each of your templates and the paths on your site that it will accept. This **must** have a variant explicitly named `NotFound`, that's handled for you. Then, you define your app itself, which takes the following properties (which need to be in order right now!):

- `root` – the CSS selector for the element to render Perseus to, which should be unique, like an HTML `id`
- `route` – the `enum` for your app's routes that you just defined
- `router` – a match-like input that handles each of the variants of your `route`, except `NotFound` (handled for you); each one gets mapped to the corresponding page's path (e.g. `Post` with slug `test` might be mapped to `format!("post/{}", slug)`), which shouldn't include a leading or trailing `/`
- `error_pages` – your [error pages](error_pages.md)
- `error_pages` – your [error pages](error_pages)
- `templates` – each of your templates, taking the `G` parameter (which will be used at runtime to render them for the server or the client)
- `config_manager` (optional) – the [config manager](config_manager.md) your app should use, default is the inbuilt `FsConfigManager::new()`
- `config_manager` (optional) – the [config manager](config_manager) your app should use, default is the inbuilt `FsConfigManager::new()`

## Usage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ In development, you'll still need to specify a config manager, which allows you

Any custom config managers have to implement the `ConfigManager` trait, which only has two functions: `read` and `write`. Here's the trait definition:

```rust,no_run,no_playground
```rust
pub trait ConfigManager {
/// Reads data from the named asset.
async fn read(&self, name: &str) -> Result<String>;
Expand All @@ -21,11 +21,11 @@ pub trait ConfigManager {

### Errors

It's easily possible for CDNs of filesystems to throw errors when we try to interact with them, and Perseus provides a custom set of errors with [`error_chain!`]() to deal with this. Note that your implementation *must* use these, or it will not implement the trait and thus not be compatible with Perseus. The errors available to you are:
It's easily possible for CDNs of filesystems to throw errors when we try to interact with them, and Perseus provides a custom set of errors with [`error_chain!`]() to deal with this. Note that your implementation _must_ use these, or it will not implement the trait and thus not be compatible with Perseus. The errors available to you are:

- `NotFound`, takes a `String` asset name
- `ReadFailed`, takes a `String` asset name and a `String` error (not chained because it might come back by carrier pigeon for all we know)
- `WriteFailed`, takes a `String` asset name and a `String` error (not chained because it might come back by carrier pigeon for all we know)
- `NotFound`, takes a `String` asset name
- `ReadFailed`, takes a `String` asset name and a `String` error (not chained because it might come back by carrier pigeon for all we know)
- `WriteFailed`, takes a `String` asset name and a `String` error (not chained because it might come back by carrier pigeon for all we know)

## Best Practices

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ If you're using [Actix Web](https://actix.rs), then Perseus can automate nearly

This integration provides a configuration function, which you can use to configure an existing web server to support Perseus, so you could even run something like [Diana](https://github.com/arctic-hen7/diana) on the same server!

This integration should support almost every use case of Perseus, but there may be some extremely advanced things that you'll need to go back to basics for. If that's the case, please let us know by [opening an issue]() (we want these integrations to be as powerful as possible), and in the meantime you can use the guide [here](./serving.md) to see how to set up a server without using the integrations. If you need implementation details, check out the actual source code for the integration in the [repository](https://github.com/arctic-hen7/perseus).
This integration should support almost every use case of Perseus, but there may be some extremely advanced things that you'll need to go back to basics for. If that's the case, please let us know by [opening an issue]() (we want these integrations to be as powerful as possible), and in the meantime you can use the guide [here](./serving) to see how to set up a server without using the integrations. If you need implementation details, check out the actual source code for the integration in the [repository](https://github.com/arctic-hen7/perseus).

## Installation

Expand Down
Loading