Skip to content

Fix: update tauri-updater script to use node for JSON parsing and replace ripgrep with grep#1101

Merged
shm11C3 merged 6 commits into
developfrom
fix/tauri-updater
Feb 11, 2026
Merged

Fix: update tauri-updater script to use node for JSON parsing and replace ripgrep with grep#1101
shm11C3 merged 6 commits into
developfrom
fix/tauri-updater

Conversation

@shm11C3

@shm11C3 shm11C3 commented Feb 11, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings February 11, 2026 09:57
@github-actions github-actions Bot added the bug Something isn't working label Feb 11, 2026
@github-actions

github-actions Bot commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 79.84% (🎯 60%) 800 / 1002
🔵 Statements 77.81% (🎯 60%) 828 / 1064
🔵 Functions 71.2% (🎯 60%) 178 / 250
🔵 Branches 66.76% (🎯 60%) 231 / 346
File CoverageNo changed files found.
Generated in workflow #2212 for commit 97ff80e by the Vitest Coverage Report Action

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the Tauri dependency updater script by replacing external tools (jq and ripgrep) with alternatives that leverage existing project dependencies. The script is used in the weekly automated workflow (auto-update-tauri.yml) that runs on Ubuntu to keep Tauri-related packages up to date.

Changes:

  • Replaced jq with Node.js for JSON parsing in the npm package update logic
  • Replaced ripgrep (rg) with GNU grep for extracting Tauri plugin names from Cargo.toml

Copilot AI review requested due to automatic review settings February 11, 2026 10:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@github-actions github-actions Bot added dependencies Pull requests that update a dependency file rust Pull requests that update Rust code frontend configuration labels Feb 11, 2026
Copilot AI review requested due to automatic review settings February 11, 2026 10:07
@shm11C3 shm11C3 enabled auto-merge (squash) February 11, 2026 10:07
@shm11C3 shm11C3 removed dependencies Pull requests that update a dependency file rust Pull requests that update Rust code frontend configuration labels Feb 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

PLUGINS=$(rg -o 'tauri-plugin-[a-zA-Z0-9_-]+' Cargo.toml | sort -u || true)
if [ -n "${PLUGINS}" ]; then
for p in ${PLUGINS}; do
mapfile -t PLUGINS < <(grep -oP 'tauri-plugin-[a-zA-Z0-9_-]+' Cargo.toml | sort -u || true)

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grep -oP requires PCRE support (GNU grep) and will fail on environments with BSD grep (e.g., macOS). Since the pattern doesn’t need PCRE features, prefer grep -oE to keep the script portable while still removing the ripgrep dependency.

Suggested change
mapfile -t PLUGINS < <(grep -oP 'tauri-plugin-[a-zA-Z0-9_-]+' Cargo.toml | sort -u || true)
mapfile -t PLUGINS < <(grep -oE 'tauri-plugin-[a-zA-Z0-9_-]+' Cargo.toml | sort -u || true)

Copilot uses AI. Check for mistakes.
OUTDATED_JSON="$(npm outdated --json 2>/dev/null | sed -n '/^{/,/^}/p' || true)"
if [ -n "${OUTDATED_JSON}" ] && [ "${OUTDATED_JSON}" != "null" ]; then
mapfile -t PKGS < <(echo "$OUTDATED_JSON" | jq -r 'keys[]' | grep '^@tauri-apps/' || true)
mapfile -t PKGS < <(echo "$OUTDATED_JSON" | node -e 'let s="";process.stdin.on("data",c=>s+=c);process.stdin.on("end",()=>{for(const k of Object.keys(JSON.parse(s)))console.log(k)})' | grep '^@tauri-apps/' || true)

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline node -e JSON parsing one-liner is hard to read/maintain and makes failures easy to miss (the surrounding || true will silently produce an empty package list if parsing breaks). Consider switching to a small, more readable Node snippet (e.g., using fs.readFileSync(0, "utf8") and a try/catch) or factoring it into a helper function within the script.

Suggested change
mapfile -t PKGS < <(echo "$OUTDATED_JSON" | node -e 'let s="";process.stdin.on("data",c=>s+=c);process.stdin.on("end",()=>{for(const k of Object.keys(JSON.parse(s)))console.log(k)})' | grep '^@tauri-apps/' || true)
mapfile -t PKGS < <(node <<'EOF' "$OUTDATED_JSON"
const data = process.argv[2] || "";
try {
const trimmed = data.trim();
if (!trimmed || trimmed === "null") {
process.exit(0);
}
const obj = JSON.parse(trimmed);
for (const key of Object.keys(obj)) {
if (key.startsWith("@tauri-apps/")) {
console.log(key);
}
}
} catch (err) {
console.error("Failed to parse npm outdated JSON:", err && err.message ? err.message : err);
process.exit(1);
}
EOF
)

Copilot uses AI. Check for mistakes.
@shm11C3 shm11C3 merged commit be2afff into develop Feb 11, 2026
30 checks passed
@shm11C3 shm11C3 deleted the fix/tauri-updater branch February 11, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants