diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 5d2a34b39e..49aab8b96d 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -45,50 +45,58 @@ jobs: - uses: actions/checkout@v2 # Cache Cargo binaries - - uses: actions/cache@v3 + - uses: actions/cache@v4 id: cache with: - path: | - ~/.cargo/bin/ - # The cache should be OS-specific - key: ${{ runner.os }}-cargo-bins + path: | + ~/.cargo/bin/ + # The cache should be OS-specific + key: ${{ runner.os }}-cargo-bins # Only install the binaries if the cache doesn't have them - name: Install Dependencies if: steps.cache.outputs.cache-hit != 'true' run: cargo install bonnie rust-script # Also cache all the other Cargo files, since plenty of CI runs won't involve different dependencies - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: - path: | - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} - name: Run benchmark for ${{ matrix.name }} in category ${{ matrix.type }} - run: bonnie bench size ${{ matrix.type }} ${{ matrix.name }} --json | tee output.txt + run: bonnie bench size ${{ matrix.type }} ${{ matrix.name }} --json > output.txt + + # Add this step to see what's actually in the file before the action runs + - name: "Debug: Display benchmark output file" + run: | + echo "--- Contents of output.txt ---" + cat output.txt + echo "------------------------------" + # Download previous benchmark result from cache (if exists) - name: Download previous benchmark data - uses: actions/cache@v1 + uses: actions/cache@v4 with: - path: ./cache - key: ${{ runner.os }}-benchmark + path: ./cache + key: ${{ runner.os }}-benchmark - name: Store benchmark result uses: benchmark-action/github-action-benchmark@v1 with: - # What benchmark tool the output.txt came from - tool: "customSmallerIsBetter" - # Where the output from the benchmark tool is stored - output-file-path: output.txt - # Where the previous data file is stored - external-data-json-path: ./cache/benchmark-data.json - # Workflow will fail when an alert happens - fail-on-alert: true - # GitHub API token to make a commit comment - github-token: ${{ secrets.GITHUB_TOKEN }} - alert-threshold: "110%" - comment-on-alert: true - alert-comment-cc-users: '@arctic-hen7' # We need this kind of quoting, `@` is special in YAML + # What benchmark tool the output.txt came from + tool: "customSmallerIsBetter" + # Where the output from the benchmark tool is stored + output-file-path: output.txt + # Where the previous data file is stored + external-data-json-path: ./cache/benchmark-data.json + # Workflow will fail when an alert happens + fail-on-alert: true + # GitHub API token to make a commit comment + github-token: ${{ secrets.GITHUB_TOKEN }} + alert-threshold: "110%" + comment-on-alert: true + alert-comment-cc-users: '@arctic-hen7' # We need this kind of quoting, `@` is special in YAML diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02e6ed91cb..540b882cf9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,10 +16,10 @@ jobs: - uses: actions/cache@v3 id: cache with: - path: | - ~/.cargo/bin/ - # The cache should be OS-specific - key: ${{ runner.os }}-cargo-bins + path: | + ~/.cargo/bin/ + # The cache should be OS-specific + key: ${{ runner.os }}-cargo-bins # Only install the binaries if the cache doesn't have them - name: Install Dependencies if: steps.cache.outputs.cache-hit != 'true' @@ -37,10 +37,10 @@ jobs: - uses: actions/cache@v3 id: cache with: - path: | - ~/.cargo/bin/ - # The cache should be OS-specific - key: ${{ runner.os }}-cargo-bins + path: | + ~/.cargo/bin/ + # The cache should be OS-specific + key: ${{ runner.os }}-cargo-bins # Only install the binaries if the cache doesn't have them - name: Install Dependencies if: steps.cache.outputs.cache-hit != 'true' @@ -57,10 +57,10 @@ jobs: - uses: actions/cache@v3 id: cache with: - path: | - ~/.cargo/bin/ - # The cache should be OS-specific - key: ${{ runner.os }}-cargo-bins + path: | + ~/.cargo/bin/ + # The cache should be OS-specific + key: ${{ runner.os }}-cargo-bins # Only install the binaries if the cache doesn't have them - name: Install Dependencies if: steps.cache.outputs.cache-hit != 'true' @@ -126,10 +126,10 @@ jobs: - uses: actions/cache@v3 id: cache with: - path: | - ~/.cargo/bin/ - # The cache should be OS-specific - key: ${{ runner.os }}-cargo-bins + path: | + ~/.cargo/bin/ + # The cache should be OS-specific + key: ${{ runner.os }}-cargo-bins # Only install the binaries if the cache doesn't have them - name: Install Dependencies if: steps.cache.outputs.cache-hit != 'true' @@ -138,12 +138,12 @@ jobs: # Also cache all the other Cargo files, since plenty of CI runs won't involve different dependencies - uses: actions/cache@v3 with: - path: | - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} # # Also cache the apt packages we need for testing # - uses: awalsh128/cache-apt-pkgs-action@latest diff --git a/.gitignore b/.gitignore index cb00b5470e..773e6e1d60 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ Cargo.lock pkg/ .tribble/ - +.idea/ target_engine/ target_wasm/ dist/ diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000..13566b81b0 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/examples/core/preload/Cargo.toml b/examples/core/preload/Cargo.toml index 37d0f65487..49a604bfee 100644 --- a/examples/core/preload/Cargo.toml +++ b/examples/core/preload/Cargo.toml @@ -6,7 +6,10 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -perseus = { path = "../../../packages/perseus", features = [ "hydrate", "translator-fluent" ] } +perseus = { path = "../../../packages/perseus", features = [ + "hydrate", + "translator-fluent", +] } sycamore = "^0.8.1" serde = { version = "1", features = ["derive"] } serde_json = "1" @@ -15,7 +18,7 @@ serde_json = "1" fantoccini = "0.19" [target.'cfg(engine)'.dependencies] -tokio = { version = "1", features = [ "macros", "rt", "rt-multi-thread" ] } +tokio = { version = "1", features = ["macros", "rt", "rt-multi-thread"] } ## **WARNING!** Before running this example outside the Perseus repo, replace the below line with ## the one commented out below it (changing the path dependency to the version you want to use) perseus-axum = { package = "perseus-integration", path = "../../../packages/perseus-integration", default-features = false } diff --git a/packages/perseus-cli/Cargo.toml b/packages/perseus-cli/Cargo.toml index 47d027d455..919d6f00cc 100644 --- a/packages/perseus-cli/Cargo.toml +++ b/packages/perseus-cli/Cargo.toml @@ -9,13 +9,14 @@ repository = "https://github.com/framesurge/perseus" homepage = "https://framesurge.sh/perseus" readme = "./README.md" keywords = ["wasm", "cli", "webdev", "ssg", "ssr"] -categories = ["wasm", "development-tools", "asynchronous", "gui", "command-line-utilities"] -include = [ - "src/", - "Cargo.toml", - ".perseus/", - "README.proj.md" +categories = [ + "wasm", + "development-tools", + "asynchronous", + "gui", + "command-line-utilities", ] +include = ["src/", "Cargo.toml", ".perseus/", "README.proj.md"] autotests = false @@ -36,24 +37,24 @@ indicatif = "0.17" console = "0.15" serde = "1" serde_json = "1" -clap = { version = "4.2", features = [ "color", "derive" ] } +clap = { version = "4.2", features = ["color", "derive"] } fs_extra = "1" -tokio = { version = "1", features = [ "macros", "rt-multi-thread", "sync" ] } +tokio = { version = "1", features = ["macros", "rt-multi-thread", "sync"] } warp = "0.3" command-group = "2" ctrlc = { version = "3.2", features = ["termination"] } notify = "6" futures = "0.3" tokio-stream = "0.1" -reqwest = { version = "0.11", features = [ "json", "stream" ] } +reqwest = { version = "0.11", features = ["json", "stream"] } tar = "0.4" flate2 = "1" directories = "5" cargo_metadata = "0.15" -cargo-lock = "8" -minify-js = "=0.4.3" # Be careful changing this, and test extensively! +cargo-lock = "10" +minify-js = "=0.4.3" # Be careful changing this, and test extensively! walkdir = "2" -openssl = { version = "0.10.52", optional = true} +openssl = { version = "0.10.52", optional = true } brotlic = "0.8" [dev-dependencies] @@ -71,4 +72,4 @@ path = "src/bin/main.rs" [features] # `reqwest` uses the system-native transport layer by default, this is necessary in some environments -vendored-openssl = [ "openssl/vendored" ] +vendored-openssl = ["openssl/vendored"] diff --git a/packages/perseus-cli/src/deploy.rs b/packages/perseus-cli/src/deploy.rs index cece514334..a075acf523 100644 --- a/packages/perseus-cli/src/deploy.rs +++ b/packages/perseus-cli/src/deploy.rs @@ -328,7 +328,11 @@ fn minify_js(from: &Path, to: &Path) -> Result<(), DeployError> { // Guaranteed to be UTF-8 output &mut minified, ) - .map_err(|err| DeployError::MinifyError { source: err })?; + // This is the updated line + .map_err(|err| DeployError::MinifyError { + source: Box::new(std::io::Error::other(err.to_string())), + })?; + let minified = String::from_utf8(minified).map_err(|err| DeployError::MinifyNotUtf8 { source: err })?; fs::write(to, minified).map_err(|err| DeployError::WriteMinifiedJsFailed { source: err })?; diff --git a/packages/perseus-cli/src/errors.rs b/packages/perseus-cli/src/errors.rs index 152fcb020a..4a2cf9358b 100644 --- a/packages/perseus-cli/src/errors.rs +++ b/packages/perseus-cli/src/errors.rs @@ -165,11 +165,14 @@ pub enum DeployError { #[source] source: std::io::Error, }, + #[error("failed to minify javascript bundle (this is probably an upstream bug, re-try with `--no-minify-js`)")] MinifyError { #[source] - source: minify_js::MinifyError, + source: Box, + // source: minify_js::Error, }, + #[error("minified js was not utf-8 (this is a bug, re-try with `--no-minify-js` for now)")] MinifyNotUtf8 { #[source]