diff --git a/.env b/.env new file mode 100644 index 0000000000..0cf3b0bb60 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +EXAMPLE_INTEGRATION=warp diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 08d091ddc0..84bbb1a3ac 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -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 @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a38ba66ddd..1777c63d89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ 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: @@ -20,7 +20,6 @@ jobs: 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 @@ -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 diff --git a/Cargo.toml b/Cargo.toml index b577e95e14..88df8baa9a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" } diff --git a/bonnie.toml b/bonnie.toml index 2952fee551..5b9de39fc1 100644 --- a/bonnie.toml +++ b/bonnie.toml @@ -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 ...`.\"" @@ -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\"" @@ -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 @@ -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" @@ -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)" @@ -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 %%", diff --git a/examples/comprehensive/tiny/.gitignore b/examples/comprehensive/tiny/.gitignore index 19f4c83304..849ddff3b7 100644 --- a/examples/comprehensive/tiny/.gitignore +++ b/examples/comprehensive/tiny/.gitignore @@ -1,2 +1 @@ - -.perseus/ \ No newline at end of file +dist/ diff --git a/examples/comprehensive/tiny/Cargo.toml b/examples/comprehensive/tiny/Cargo.toml index 3ebc52a5d2..8d6ffa0cda 100644 --- a/examples/comprehensive/tiny/Cargo.toml +++ b/examples/comprehensive/tiny/Cargo.toml @@ -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" diff --git a/examples/comprehensive/tiny/index.html b/examples/comprehensive/tiny/index.html deleted file mode 100644 index 2f972c2e1d..0000000000 --- a/examples/comprehensive/tiny/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - -
- - -