Skip to content

Commit

Permalink
feat: ✨ added website (#47)
Browse files Browse the repository at this point in the history
* feat(website): ✨ added basic website boilerplate

* chore: 🔧 added automatic reloading to site dev scripts

* feat(website): ✨ added tailwindcss

* feat(website): ✨ added initial landing page

* feat(website): ✨ added landing page

* chore(website): 🔧 make browsersync allow non-extensioned files

* feat(website): ✨ added comparisons page and improved mobile support on landing page

* refactor(book): ♻️ refactored book for website deployment

* refactor(book): ♻️ refactored book for i18n

* refactor(book): ♻️ refactored docs for new links systems

* feat(website): ✨ created basic docs system with generation

No styling yet at all, but the pages are all generated.

* feat(website): ✨ added docs stability system

No proper diplaying yet though.

* refactor(book): ♻️ removed `no_run` directives in docs

* refactor(book): ♻️ corrected titles in `SUMMARY.md` files

* feat(website): ✨ created a docs system

* feat(website): ✨ added docs version switcher

* refactor(book): ♻️ made all line includes use new directive `#lines_include`

* feat(website): ✨ added code including

Can't include specific lines yet though.

* feat(website): ✨ added support for  including specific lines

* docs(book): ✏️ fixed 'amlagamation' typo

* fix(website): 🐛 fixed prism load failures

Caused by #46.

* feat(website): ✨ created placeholder for comparisons page

Needs to be more mobile-friendly, that'll come soon.

* chore: 🔧 added `rust-toolchain` for netlify

* chore(website): 📦 added `pkg/` to build temporarily

This might rectify Netlify deployment issues.

* chore(website): 🙈 removed `pkg/`

Abandoning Netlify for this.

* fix(website): 🐛 fixed docs version switcher in dark mode

* fix(website): 🐛 fixed status messages in dark mode

* chore(website): 🔧 added bonnie script to deploy site

* ci(website): 👷 added ci build for website

* ci(website): 💚 fixed ci for tailwindcss

We now use `npx` for the production build.

* refactor(website): 🚨 silenced linter warnings for comparisons page placeholder

Removed `components/comparisons.rs` from the module, but kept the file.

* ci(website): 💚 fixed ci by adding `npm install` stage

* ci(website): 👷 updated ci build for full deployment

* docs: 📝 added warning notice to readme about switch to website
  • Loading branch information
arctic-hen7 authored Oct 4, 2021
1 parent 63e1431 commit 45a0f6c
Show file tree
Hide file tree
Showing 213 changed files with 3,585 additions and 1,284 deletions.
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

0 comments on commit 45a0f6c

Please sign in to comment.