Skip to content

Commit

Permalink
Merge branch 'main' into fix-view-error-reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
gbj authored Apr 8, 2024
2 parents e8adfa0 + ab1c4ca commit cf6f6d5
Show file tree
Hide file tree
Showing 231 changed files with 1,232 additions and 2,450 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-changed-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
with:
directory: ${{ matrix.directory }}
cargo_make_task: "ci"
toolchain: nightly-2024-01-29
toolchain: stable
2 changes: 1 addition & 1 deletion .github/workflows/ci-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
with:
directory: ${{ matrix.directory }}
cargo_make_task: "ci"
toolchain: nightly-2024-01-29
toolchain: stable
28 changes: 28 additions & 0 deletions .github/workflows/ci-semver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI semver

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
get-leptos-changed:
uses: ./.github/workflows/get-leptos-changed.yml

test:
needs: [get-leptos-changed]
if: needs.get-leptos-changed.outputs.leptos_changed == 'true'
name: Run semver check (nightly-2024-03-31)
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Semver Checks
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
rust-toolchain: nightly-2024-03-31
26 changes: 0 additions & 26 deletions .github/workflows/ci-stable-examples.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
with:
directory: ${{ matrix.directory }}
cargo_make_task: "ci"
toolchain: nightly-2024-01-29
toolchain: nightly-2024-03-31
2 changes: 1 addition & 1 deletion .github/workflows/get-example-changed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- name: Get example files that changed
id: changed-files
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v43
with:
files: |
examples/**
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/get-examples-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install JQ Tool
uses: mbround18/install-jq@v1
- name: Install jq
run: sudo apt-get install jq

- name: Set Matrix
id: set-matrix
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/get-leptos-changed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get source files that changed
id: changed-source
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v43
with:
files: |
integrations/**
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/run-cargo-make-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ jobs:
- uses: actions/checkout@v4

- name: Setup Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ inputs.toolchain }}
override: true
components: rustfmt

- name: Add wasm32-unknown-unknown
run: rustup target add wasm32-unknown-unknown
Expand All @@ -44,6 +42,18 @@ jobs:

- uses: Swatinem/rust-cache@v2

- name: Install binstall
uses: cargo-bins/cargo-binstall@main

- name: Install wasm-bindgen
run: cargo binstall wasm-bindgen-cli --no-confirm

- name: Install wasm-pack
run: cargo binstall wasm-pack --no-confirm

- name: Install cargo-leptos
run: cargo binstall cargo-leptos --no-confirm

- name: Install Trunk
uses: jetli/[email protected]
with:
Expand All @@ -69,7 +79,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
Expand Down
11 changes: 9 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,19 @@ check-examples`.

## Before Submitting a PR

We have a fairly extensive CI setup that runs both lints (like `rustfmt` and `clippy`)
We have a fairly extensive CI setup that runs both lints (like `rustfmt` and `clippy`)
and tests on PRs. You can run most of these locally if you have `cargo-make` installed.

Note that some of the `rustfmt` settings used require usage of the nightly compiler.
Formatting the code using the stable toolchain may result in a wrong code format and
subsequently CI errors.
Run `cargo +nightly fmt` if you want to keep the stable toolchain active.
You may want to let your IDE automatically use the `+nightly` parameter when a
"format on save" action is used.

If you added an example, make sure to add it to the list in `examples/Makefile.toml`.

From the root directory of the repo, run
From the root directory of the repo, run
- `cargo +nightly fmt`
- `cargo +nightly make check`
- `cargo +nightly make test`
Expand Down
26 changes: 13 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ members = [
exclude = ["benchmarks", "examples"]

[workspace.package]
version = "0.6.9"
version = "0.6.10"
rust-version = "1.75"

[workspace.dependencies]
leptos = { path = "./leptos", version = "0.6.9" }
leptos_dom = { path = "./leptos_dom", version = "0.6.9" }
leptos_hot_reload = { path = "./leptos_hot_reload", version = "0.6.9" }
leptos_macro = { path = "./leptos_macro", version = "0.6.9" }
leptos_reactive = { path = "./leptos_reactive", version = "0.6.9" }
leptos_server = { path = "./leptos_server", version = "0.6.9" }
server_fn = { path = "./server_fn", version = "0.6.9" }
server_fn_macro = { path = "./server_fn_macro", version = "0.6.9" }
leptos = { path = "./leptos", version = "0.6.10" }
leptos_dom = { path = "./leptos_dom", version = "0.6.10" }
leptos_hot_reload = { path = "./leptos_hot_reload", version = "0.6.10" }
leptos_macro = { path = "./leptos_macro", version = "0.6.10" }
leptos_reactive = { path = "./leptos_reactive", version = "0.6.10" }
leptos_server = { path = "./leptos_server", version = "0.6.10" }
server_fn = { path = "./server_fn", version = "0.6.10" }
server_fn_macro = { path = "./server_fn_macro", version = "0.6.10" }
server_fn_macro_default = { path = "./server_fn/server_fn_macro_default", version = "0.6" }
leptos_config = { path = "./leptos_config", version = "0.6.9" }
leptos_router = { path = "./router", version = "0.6.9" }
leptos_meta = { path = "./meta", version = "0.6.9" }
leptos_integration_utils = { path = "./integrations/utils", version = "0.6.9" }
leptos_config = { path = "./leptos_config", version = "0.6.10" }
leptos_router = { path = "./router", version = "0.6.10" }
leptos_meta = { path = "./meta", version = "0.6.10" }
leptos_integration_utils = { path = "./integrations/utils", version = "0.6.10" }

[profile.release]
codegen-units = 1
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ The new rendering approach being developed for 0.7 supports “universal renderi

### How is this different from Yew?

Yew is the most-used library for Rust web UI development, but there are several differences between Yew and Leptos, in philosophy, approach, and performance.
Yew is the most-used library for Rust web UI development, but there are several differences between Yew and Leptos, in philosophy, approach, and performance.

- **VDOM vs. fine-grained:** Yew is built on the virtual DOM (VDOM) model: state changes cause components to re-render, generating a new virtual DOM tree. Yew diffs this against the previous VDOM, and applies those patches to the actual DOM. Component functions rerun whenever state changes. Leptos takes an entirely different approach. Components run once, creating (and returning) actual DOM nodes and setting up a reactive system to update those DOM nodes.
- **Performance:** This has huge performance implications: Leptos is simply much faster at both creating and updating the UI than Yew is.
Expand All @@ -182,4 +182,4 @@ Sycamore and Leptos are both heavily influenced by SolidJS. At this point, Lepto

- **Templating DSLs:** Sycamore uses a custom templating language for its views, while Leptos uses a JSX-like template format.
- **`'static` signals:** One of Leptos’s main innovations was the creation of `Copy + 'static` signals, which have excellent ergonomics. Sycamore is in the process of adopting the same pattern, but this is not yet released.
- **Perseus vs. server functions:** The Perseus metaframework provides an opinionated way to build Sycamore apps that include server functionality. Leptos instead provides primitives like server functions in the core of the framework.
- **Perseus vs. server functions:** The Perseus metaframework provides an opinionated way to build Sycamore apps that include server functionality. Leptos instead provides primitives like server functions in the core of the framework.
2 changes: 1 addition & 1 deletion cargo-make/check.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ alias = "check-all"

[tasks.check-all]
command = "cargo"
args = ["+nightly-2024-01-29", "check-all-features"]
args = ["check-all-features"]
install_crate = "cargo-all-features"
9 changes: 8 additions & 1 deletion cargo-make/lint.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@ args = ["fmt", "--", "--check", "--config-path", "${LEPTOS_PROJECT_DIRECTORY}"]
[tasks.clippy-each-feature]
dependencies = ["install-clippy"]
command = "cargo"
args = ["hack", "clippy", "--all", "--each-feature", "--no-dev-deps"]
args = [
"clippy",
"--all-features",
"--no-deps",
"--",
"-D",
"clippy::print_stdout",
]
2 changes: 1 addition & 1 deletion cargo-make/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ alias = "test-all"

[tasks.test-all]
command = "cargo"
args = ["+nightly-2024-01-29", "test-all-features"]
args = ["test-all-features"]
install_crate = "cargo-all-features"
11 changes: 9 additions & 2 deletions examples/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,41 @@ CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_MAKE_CARGO_BUILD_TEST_FLAGS = ""
CARGO_MAKE_WORKSPACE_EMULATION = true
CARGO_MAKE_CRATE_WORKSPACE_MEMBERS = [
"action-form-error-handling",
"animated_show",
"counter",
"counter_isomorphic",
"counters",
"counters_stable",
"counter_url_query",
"counter_without_macros",
"directives",
"error_boundary",
"errors_axum",
"fetch",
"hackernews",
"hackernews_axum",
"hackernews_islands_axum",
"hackernews_js_fetch",
"js-framework-benchmark",
"login_with_token_csr_only",
"parent_child",
"portal",
"router",
"server_fns_axum",
"session_auth_axum",
"slots",
"spread",
"sso_auth_axum",
"ssr_modes",
"ssr_modes_axum",
"suspense_tests",
"tailwind_actix",
"tailwind_csr",
"tailwind_axum",
"tailwind_csr",
"timer",
"todo_app_sqlite",
"todo_app_sqlite_axum",
"todo_app_sqlite_csr",
"todomvc",
]

Expand Down
14 changes: 8 additions & 6 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To the extent that new features have been released or breaking changes have been

## Getting Started

The simplest way to get started with any example is to use the “quick start” command found in the README for each example. Most of the examples use either [`trunk`](https://trunkrs.dev/) (a simple build system and dev server for client-side-rendered apps) or [`cargo-leptos`](https://github.com/leptos-rs/cargo-leptos) (a build system for server-rendered and client-hydrated apps).
The simplest way to get started with any example is to use the “quick start” command found in the README for each example. Most of the examples use either [`trunk`](https://trunkrs.dev/) (a simple build system and dev server for client-side-rendered apps) or [`cargo-leptos`](https://github.com/leptos-rs/cargo-leptos) (a build system for server-rendered and client-hydrated apps).

## Using Cargo Make

Expand All @@ -17,15 +17,17 @@ You can also run any of the examples using [`cargo-make`](https://github.com/sag
Follow these steps to get any example up and running.

1. `cd` to the example you want to run
2. Run `cargo make ci` to setup and test the example
3. Run `cargo make start` to run the example
4. Open the client URL in the console output (<http://127.0.0.1:8080> or <http://127.0.0.1:3000> by default)
5. Run `cargo make stop` to end any processes started by `cargo make start`.
2. Make sure `cargo-make` is installed (for example by running `cargo install cargo-make`)
3. Make sure `rustup target add wasm32-unknown-unknown` was executed for the currently selected toolchain.
4. Run `cargo make ci` to setup and test the example
5. Run `cargo make start` to run the example
6. Open the client URL in the console output (<http://127.0.0.1:8080> or <http://127.0.0.1:3000> by default)
7. Run `cargo make stop` to end any processes started by `cargo make start`.

Here are a few additional notes:

- Extendable custom task files are located in the [cargo-make](./cargo-make/) directory
- Running a task will automatically install `cargo` dependencies
- Running a task will automatically install `cargo` dependencies
- Each `Makefile.toml` file must extend the [cargo-make/main.toml](./cargo-make/main.toml) file
- [cargo-make](./cargo-make/) files that end in `*-test.toml` configure web testing strategies
- Run `cargo make test-report` to learn which examples have web tests
Expand Down
2 changes: 1 addition & 1 deletion examples/animated_show/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"
codegen-units = 1
lto = true

[dependencies]
[dependencies]
leptos = { path = "../../leptos", features = ["csr"] }
console_log = "1"
log = "0.4"
Expand Down
4 changes: 2 additions & 2 deletions examples/cargo-make/cargo-leptos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ clear = true
dependencies = ["check-debug", "check-release"]

[tasks.check-debug]
toolchain = "nightly-2024-01-29"
toolchain = "stable"
command = "cargo"
args = ["check-all-features"]
install_crate = "cargo-all-features"

[tasks.check-release]
toolchain = "nightly-2024-01-29"
toolchain = "stable"
command = "cargo"
args = ["check-all-features", "--release"]
install_crate = "cargo-all-features"
Expand Down
11 changes: 9 additions & 2 deletions examples/cargo-make/clean.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ dependencies = [
"clean-trunk",
"clean-node_modules",
"clean-playwright",
"clean-pkg",
]

[tasks.clean-cargo]
command = "rm"
args = ["-rf", "target"]
script = '''
find . -type d -name target | xargs rm -rf
'''

[tasks.clean-trunk]
script = '''
Expand All @@ -27,3 +29,8 @@ fi
script = '''
find . -name playwright-report -name playwright -name test-results | xargs rm -rf
'''

[tasks.clean-pkg]
script = '''
find . -type d -name pkg | xargs rm -rf
'''
4 changes: 2 additions & 2 deletions examples/cargo-make/compile.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[tasks.build]
toolchain = "nightly-2024-01-29"
toolchain = "stable"
command = "cargo"
args = ["build-all-features"]
install_crate = "cargo-all-features"

[tasks.check]
toolchain = "nightly-2024-01-29"
toolchain = "stable"
command = "cargo"
args = ["check-all-features"]
install_crate = "cargo-all-features"
Loading

0 comments on commit cf6f6d5

Please sign in to comment.