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

Remove magic #151

Merged
merged 40 commits into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7e533da
feat: made the engine code functional in the user's code
arctic-hen7 Jun 11, 2022
fced589
feat: added support for serving
arctic-hen7 Jun 11, 2022
a50875c
feat: integrated client-side code
arctic-hen7 Jun 11, 2022
814078b
feat: updated the cli and brought everything together
arctic-hen7 Jun 12, 2022
e383b16
fix: fixed all issues by changing the cargo resolver
arctic-hen7 Jun 12, 2022
f5fd65b
fix: fixed `HydrateNode`/`DomNode` issues and reformed original struc…
arctic-hen7 Jun 12, 2022
0ef0424
fix: fixed small errors with cli
arctic-hen7 Jun 12, 2022
9ef2b50
fix: fixed some macro and example errors
arctic-hen7 Jun 12, 2022
39389b1
style: appeased `clippy`
arctic-hen7 Jun 12, 2022
c808915
chore: updated bonnie checking script
arctic-hen7 Jun 12, 2022
3354c2b
chore: deleted `.perseus/`!
arctic-hen7 Jun 12, 2022
3f17ec7
feat: added convenience macros
arctic-hen7 Jun 13, 2022
89c5629
feat: added more convenience macros
arctic-hen7 Jun 13, 2022
11135e3
refactor: broke out macros under a new features
arctic-hen7 Jun 13, 2022
00f15e6
feat: added dflt engine system for export-only apps
arctic-hen7 Jun 13, 2022
90e5c3f
test: updated all examples
arctic-hen7 Jun 14, 2022
10966ab
chore: merged from `main` for docs/examples updates
arctic-hen7 Jun 14, 2022
dc6ae08
test: updated `fetching` example
arctic-hen7 Jun 14, 2022
ace810e
style: appeased clippy
arctic-hen7 Jun 14, 2022
72f2661
fix: fixed unused code warnings from macros
arctic-hen7 Jun 14, 2022
fa7ab64
feat: added `#[main_export]` for apps not using a server
arctic-hen7 Jun 14, 2022
13bfe56
feat: added support for custom cargo/wasm-pack args to cli
arctic-hen7 Jun 14, 2022
7bbb911
fix: fixed actix dflt server return type
arctic-hen7 Jun 14, 2022
78bb7d7
test: made all examples work with all integrations
arctic-hen7 Jun 18, 2022
c4c7b56
fix: fixed i18n translator misreference
arctic-hen7 Jun 18, 2022
6665d11
feat: superseded `autoserde` macro
arctic-hen7 Jun 18, 2022
a6869d9
test: fixed testing script
arctic-hen7 Jun 19, 2022
34132a2
chore: updated `bonnie.toml` for new layout
arctic-hen7 Jun 19, 2022
7dfae23
ci: removed `ci-prep` calls and added `wasm32-unknown-unknown` target…
arctic-hen7 Jun 19, 2022
5455b3c
ci: fixed remnant `ci-prep` invocation
arctic-hen7 Jun 19, 2022
b1bc6ee
fix: fixed global build state server/client division
arctic-hen7 Jun 19, 2022
b4921af
fix: added missing build paths annotation
arctic-hen7 Jun 19, 2022
d8da1cb
test: removed unnecessary test from plugins example
arctic-hen7 Jun 19, 2022
78d142e
chore: updated `bn test` command with all core examples
arctic-hen7 Jun 19, 2022
4c0d423
feat: added `should_revalidate` macro
arctic-hen7 Jun 19, 2022
53da801
fix: fixed imports in headers example
arctic-hen7 Jun 20, 2022
fd56eb1
chore: merged from main
arctic-hen7 Jun 20, 2022
dd82418
chore: merged from main again
arctic-hen7 Jun 20, 2022
b2bb8f3
fix: fixed static content paths in new layout
arctic-hen7 Jun 21, 2022
143c141
fix: fixed imports in state generation example
arctic-hen7 Jun 22, 2022
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
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EXAMPLE_INTEGRATION=warp
2 changes: 0 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: cargo install bonnie
- run: bonnie ci-prep
- name: Build
run: cargo build --release
working-directory: packages/perseus-cli
Expand All @@ -45,7 +44,6 @@ jobs:
- name: Install musl toolchain
run: rustup target add x86_64-unknown-linux-musl
- run: cargo install bonnie
- run: bonnie ci-prep
- name: Build
run: cargo build --release --target x86_64-unknown-linux-musl
working-directory: packages/perseus-cli
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: cargo install bonnie
- run: bonnie ci-prep
- run: rustup target add wasm32-unknown-unknown
- name: Run checks
run: bonnie check
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: cargo install bonnie
- run: bonnie ci-prep
- name: Run traditional tests
run: cargo test --all
# We now have a separate job for each example's E2E testing because they all take a while, we may as well run them in parallel
Expand Down Expand Up @@ -64,6 +63,5 @@ jobs:
- run: sudo apt install firefox firefox-geckodriver
- name: Run Firefox WebDriver
run: geckodriver &
- run: bonnie ci-prep
- name: Run E2E tests for example ${{ matrix.name }} in category ${{ matrix.type }}
run: bonnie test example-all-integrations ${{ matrix.type }} ${{ matrix.name }} --headless
16 changes: 13 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ members = [
"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/core/basic/.perseus",
"examples/core/basic/.perseus/server",
"examples/core/basic/.perseus/builder"
# "examples/core/basic/.perseus",
# "examples/core/basic/.perseus/server",
# "examples/core/basic/.perseus/builder"
]
resolver = "2"

[patch.crates-io]
sycamore = { git = "https://github.com/arctic-hen7/sycamore" }
sycamore-router = { git = "https://github.com/arctic-hen7/sycamore" }
sycamore-router-macro = { git = "https://github.com/arctic-hen7/sycamore" }
sycamore-macro = { git = "https://github.com/arctic-hen7/sycamore" }
sycamore-core = { git = "https://github.com/arctic-hen7/sycamore" }
sycamore-reactive = { git = "https://github.com/arctic-hen7/sycamore" }
sycamore-web = { git = "https://github.com/arctic-hen7/sycamore" }
37 changes: 15 additions & 22 deletions bonnie.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
version="0.3.2"
env_files = [ ".env" ]

[scripts]
setup.cmd.generic = [
"mkdir -p examples/core/basic/.perseus/dist",
"mkdir -p examples/core/basic/.perseus/dist/static",
"mkdir -p examples/core/basic/.perseus/dist/exported",
"cargo build",
"npm i --prefix ./website",
"echo \"\n\nThe Perseus repository is ready for local development! Type 'bonnie help' to see the available commands you can run here. Also, please ensure that you have 'npx' available and that you've installed 'tailwindcss', `concurrently`, `serve` and 'browser-sync' ('npm i -g tailwindcss concurrently serve browser-sync') if you'll be working with the website or running `bonnie dev export-serve ...`.\""
]
setup.cmd.targets.windows = [
"New-Item -Force -ItemType directory -Path examples\\core\\basic\\.perseus\\dist",
"New-Item -Force -ItemType directory -Path examples\\core\\basic\\.perseus\\dist\\static",
"New-Item -Force -ItemType directory -Path examples\\core\\basic\\.perseus\\dist\\exported",
"cargo build",
"npm i --prefix ./website",
"Write-Host \"\n\nThe Perseus repository is ready for local development! Type 'bonnie help' to see the available commands you can run here. Also, please ensure that you have 'npx' available and that you've installed 'tailwindcss', `concurrently`, `serve` and 'browser-sync' ('npm i -g tailwindcss concurrently serve browser-sync') if you'll be working with the website or running `bonnie dev export-serve ...`.\""
Expand Down Expand Up @@ -40,17 +35,19 @@ dev.subcommands.export-serve-deploy-relative.cmd.targets.windows = [
dev.subcommands.export-serve-deploy-relative.args = [ "category", "example" ]
dev.subcommands.export-serve-deploy-relative.desc = "deploys (exported) and serves the given example at a relative local path"

# TODO Make this not set the integration feature unless a certain file in the example calls for it
dev.subcommands.example.cmd.generic = [
"cd packages/perseus-cli",
# Point this live version of the CLI at the given example
"TEST_EXAMPLE=../../examples/%category/%example cargo run -- %%"
"TEST_EXAMPLE=../../examples/%category/%example PERSEUS_CARGO_ARGS=\"--features \"perseus-integration/%EXAMPLE_INTEGRATION\"\" cargo run -- %%"
]
dev.subcommands.example.cmd.targets.windows = [
"cd packages\\perseus-cli",
# Point this live version of the CLI at the given example
"powershell -Command { $env:TEST_EXAMPLE=\"..\\..\\examples\\%category\\%example\"; cargo run -- %% }"
"powershell -Command { $env:TEST_EXAMPLE=\"..\\..\\examples\\%category\\%example\"; $end:PERSEUS_CARGO_ARGS=\"--features \"perseus-integration/%EXAMPLE_INTEGRATION\"\"; cargo run -- %% }"
]
dev.subcommands.example.args = [ "category", "example" ]
dev.subcommands.example.env_vars = [ "EXAMPLE_INTEGRATION" ] # This will be set automatically to Warp by `.env` unless overridden
dev.subcommands.example.desc = "runs the given example using a live version of the cli"

site.cmd = "concurrently \"bonnie site export\" \"bonnie site build-tailwind\""
Expand Down Expand Up @@ -143,20 +140,13 @@ site.subcommands.run.desc = "runs the website without watching for changes"
check.cmd = [
"cargo check --all",
"cargo fmt --all -- --check",
"cargo clippy --all"
"cargo clippy --all",
# We also have to check the `perseus` package in particular on Wasm (the examples are handled by the E2E tests)
"cd packages/perseus",
"cargo check --target wasm32-unknown-unknown"
]
check.desc = "checks code for formatting errors and the like"

ci-prep.cmd.generic = [
"mkdir -p examples/core/basic/.perseus/dist",
"mkdir -p examples/core/basic/.perseus/dist/static",
]
ci-prep.cmd.targets.windows = [
"New-Item -Force -ItemType directory -Path examples\\core\\basic\\.perseus\\dist",
"New-Item -Force -ItemType directory -Path examples\\core\\basic\\.perseus\\static",
]
ci-prep.desc = "creates empty directories to preserve the file structure that testing expects"

test.cmd = [
"cargo test", # This will ignore Wasm tests
# Run tests for each example
Expand All @@ -169,7 +159,10 @@ test.cmd = [
"bonnie test example-all-integrations core global_state --headless",
"bonnie test example-all-integrations core idb_freezing --headless",
"bonnie test example-all-integrations core router_state --headless",
"bonnie test example-all-integrations core rx_state --headless"
"bonnie test example-all-integrations core rx_state --headless",
"bonnie test example-all-integrations core index_view --headless",
"bonnie test example-all-integrations core set_headers --headless",
"bonnie test example-all-integrations core static_content --headless"
]
test.desc = "runs all tests headlessly (assumes geckodriver running in background)"
test.subcommands.core.cmd = "cargo test"
Expand Down Expand Up @@ -204,7 +197,7 @@ release.desc = "creates a new project release and pushes it to github (cargo ver

# --- COMMANDS FOLLOWING THIS POINT ARE LINUX-ONLY ---

replace-versions.cmd = "find . \\( \\( -name \"*Cargo.toml\" -or -name \"*Cargo.toml.example\" -or \\( -name \"*.md\" -not -name \"*.proj.md\" \\) \\) -not -name \"CHANGELOG.md\" -not -path \"./target/*\" -not -path \"./website/*\" -not -path \"*.perseus*\" -or \\( -name \"*Cargo.toml\" -path \"./examples/core/basic/.perseus/*\" -not -path \"./examples/core/basic/.perseus/dist/*\" \\) \\) -exec sed -i -e 's/%old_version/%new_version/g' {} \\;"
replace-versions.cmd = "find . \\( \\( -name \"*Cargo.toml\" -or -name \"*Cargo.toml.example\" -or \\( -name \"*.md\" -not -name \"*.proj.md\" \\) \\) -not -name \"CHANGELOG.md\" -not -path \"./target/*\" -not -path \"./website/*\" \\) -exec sed -i -e 's/%old_version/%new_version/g' {} \\;"
replace-versions.args = [ "old_version", "new_version" ]
replace-versions.desc = "replaces an old version number with a new one in all relevant files (Linux only)"

Expand All @@ -217,7 +210,7 @@ publish.cmd = [
"cd ../perseus",
"cargo publish %%",
"cd ../perseus-cli",
"cargo publish --allow-dirty %%", # Without this flag, `.perseus` will be a problem because it's not in Git
"cargo publish %%",
# We delay this so that `crates.io` can have time to host the core
"cd ../perseus-actix-web",
"cargo publish %%",
Expand Down
3 changes: 1 addition & 2 deletions examples/comprehensive/tiny/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

.perseus/
dist/
16 changes: 16 additions & 0 deletions examples/comprehensive/tiny/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,19 @@ edition = "2021"
[dependencies]
perseus = { path = "../../../packages/perseus" }
sycamore = "=0.8.0-beta.6"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1", features = [ "macros", "rt", "rt-multi-thread" ] }
perseus-integration = { path = "../../../packages/perseus-integration", default-features = false }

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2"

[lib]
name = "lib"
path = "src/lib.rs"
crate-type = [ "cdylib", "rlib" ]

[[bin]]
name = "perseus-example-tiny"
path = "src/lib.rs"
11 changes: 0 additions & 11 deletions examples/comprehensive/tiny/index.html

This file was deleted.

4 changes: 2 additions & 2 deletions examples/comprehensive/tiny/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use perseus::{Html, PerseusApp, Template, ErrorPages};
use perseus::{ErrorPages, Html, PerseusApp, Template};
use sycamore::view;

#[perseus::main]
#[perseus::main(perseus_integration::dflt_server)]
pub fn main<G: Html>() -> PerseusApp<G> {
PerseusApp::new()
.template(|| {
Expand Down
1 change: 1 addition & 0 deletions examples/core/basic/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
2 changes: 0 additions & 2 deletions examples/core/basic/.perseus/.gitignore

This file was deleted.

29 changes: 0 additions & 29 deletions examples/core/basic/.perseus/Cargo.toml

This file was deleted.

36 changes: 0 additions & 36 deletions examples/core/basic/.perseus/builder/Cargo.toml

This file was deleted.

93 changes: 0 additions & 93 deletions examples/core/basic/.perseus/builder/src/bin/export_error_page.rs

This file was deleted.

24 changes: 0 additions & 24 deletions examples/core/basic/.perseus/builder/src/bin/tinker.rs

This file was deleted.

Loading