From 105bc664da1d2e53f8bb9efde510f2a3a52f4a33 Mon Sep 17 00:00:00 2001 From: FabianLars Date: Mon, 2 Jan 2023 18:10:45 +0100 Subject: [PATCH 01/22] ci: don't use unmaintained actions-rs actions --- .github/workflows/audit-rust.yml | 13 +++++-- .github/workflows/lint-rust.yml | 59 ++++++++++++-------------------- 2 files changed, 32 insertions(+), 40 deletions(-) diff --git a/.github/workflows/audit-rust.yml b/.github/workflows/audit-rust.yml index f3ae64e2..65eb0a14 100644 --- a/.github/workflows/audit-rust.yml +++ b/.github/workflows/audit-rust.yml @@ -28,6 +28,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/audit-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} + + - name: Download cargo-audit + run: | + curl -s https://api.github.com/repos/rustsec/rustsec/releases/latest | grep "browser_download_url.*cargo-audit-x86_64-unknown-linux-musl.*" | cut -d : -f 2,3 | tr -d \" | wget -qi - + tar -xvzf ./cargo-audit*.tgz + mv ./cargo-audit*/cargo-audit ./cargo-audit + chmod +x ./cargo-audit + + - name: Run cargo-audit + run: ./cargo-audit audit -D unmaintained -D yanked diff --git a/.github/workflows/lint-rust.yml b/.github/workflows/lint-rust.yml index 4ad8c167..7c9ff19e 100644 --- a/.github/workflows/lint-rust.yml +++ b/.github/workflows/lint-rust.yml @@ -28,42 +28,30 @@ jobs: steps: - uses: actions/checkout@v3 - - name: install webkit2gtk + + - name: install webkit2gtk and libudev for [authenticator] run: | sudo apt-get update - sudo apt-get install -y webkit2gtk-4.0 - - name: install libudev for [authenticator] - run: | - sudo apt-get install -y libudev-dev + sudo apt-get install -y webkit2gtk-4.0 libudev-dev + - name: Install clippy with stable toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable - override: true components: clippy + - uses: Swatinem/rust-cache@v1 - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --workspace --exclude 'tauri-plugin-sql' --all-targets --all-features -- -D warnings - name: clippy - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --workspace --package 'tauri-plugin-sql' --all-targets --features sqlite -- -D warnings - name: clippy sql:sqlite - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --workspace --package 'tauri-plugin-sql' --all-targets --features mysql -- -D warnings - name: clippy sql:mysql - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --workspace --package 'tauri-plugin-sql' --all-targets --features postgres -- -D warnings - name: clippy sql:postgres + - name: clippy + run: --workspace --exclude 'tauri-plugin-sql' --all-targets --all-features -- -D warnings + + - name: clippy sql:sqlite + run: --workspace --package 'tauri-plugin-sql' --all-targets --features sqlite -- -D warnings + + - name: clippy sql:mysql + run: --workspace --package 'tauri-plugin-sql' --all-targets --features mysql -- -D warnings + + - name: clippy sql:postgres + run: --workspace --package 'tauri-plugin-sql' --all-targets --features postgres -- -D warnings fmt: runs-on: ubuntu-latest @@ -72,14 +60,11 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Install rustfmt with nightly toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@nightly with: - profile: minimal - toolchain: nightly - override: true components: rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + + - name: Check formatting + run: cargo fmt --all -- --check From 3d4679a9ae862f8535026d4a709aae798c094531 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Mon, 2 Jan 2023 18:16:31 +0100 Subject: [PATCH 02/22] fix copy paste mistake --- .github/workflows/lint-rust.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint-rust.yml b/.github/workflows/lint-rust.yml index 7c9ff19e..2ab15be3 100644 --- a/.github/workflows/lint-rust.yml +++ b/.github/workflows/lint-rust.yml @@ -42,16 +42,16 @@ jobs: - uses: Swatinem/rust-cache@v1 - name: clippy - run: --workspace --exclude 'tauri-plugin-sql' --all-targets --all-features -- -D warnings + run: cargo clippy --workspace --exclude 'tauri-plugin-sql' --all-targets --all-features -- -D warnings - name: clippy sql:sqlite - run: --workspace --package 'tauri-plugin-sql' --all-targets --features sqlite -- -D warnings + run: cargo clippy --workspace --package 'tauri-plugin-sql' --all-targets --features sqlite -- -D warnings - name: clippy sql:mysql - run: --workspace --package 'tauri-plugin-sql' --all-targets --features mysql -- -D warnings + run: cargo clippy --workspace --package 'tauri-plugin-sql' --all-targets --features mysql -- -D warnings - name: clippy sql:postgres - run: --workspace --package 'tauri-plugin-sql' --all-targets --features postgres -- -D warnings + run: cargo clippy --workspace --package 'tauri-plugin-sql' --all-targets --features postgres -- -D warnings fmt: runs-on: ubuntu-latest From 78dd86a3a961b6fa35dfdcd784889c15ef199365 Mon Sep 17 00:00:00 2001 From: FabianLars Date: Mon, 2 Jan 2023 18:45:51 +0100 Subject: [PATCH 03/22] set f --- .github/workflows/audit-rust.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/audit-rust.yml b/.github/workflows/audit-rust.yml index 65eb0a14..1c6e932b 100644 --- a/.github/workflows/audit-rust.yml +++ b/.github/workflows/audit-rust.yml @@ -31,10 +31,12 @@ jobs: - name: Download cargo-audit run: | + set +f curl -s https://api.github.com/repos/rustsec/rustsec/releases/latest | grep "browser_download_url.*cargo-audit-x86_64-unknown-linux-musl.*" | cut -d : -f 2,3 | tr -d \" | wget -qi - tar -xvzf ./cargo-audit*.tgz mv ./cargo-audit*/cargo-audit ./cargo-audit chmod +x ./cargo-audit + set -f - name: Run cargo-audit run: ./cargo-audit audit -D unmaintained -D yanked From a2afb07029a2f646b4adf6f73cb7efecc0eea686 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Fri, 6 Jan 2023 14:24:11 +0100 Subject: [PATCH 04/22] refactor(store): rename plugin align with plugin naming conventions --- plugins/store/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/store/src/lib.rs b/plugins/store/src/lib.rs index db9b3048..6c641dbc 100644 --- a/plugins/store/src/lib.rs +++ b/plugins/store/src/lib.rs @@ -244,12 +244,12 @@ async fn save( } #[derive(Default)] -pub struct PluginBuilder { +pub struct Builder { stores: HashMap, frozen: bool, } -impl PluginBuilder { +impl Builder { /// Registers a store with the plugin. /// /// # Examples From 6f7b24bc42c54f23b5d0012ab67890c17f441111 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Fri, 6 Jan 2023 14:31:02 +0100 Subject: [PATCH 05/22] revert audit-rust.yml changes --- .github/workflows/audit-rust.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/audit-rust.yml b/.github/workflows/audit-rust.yml index 1c6e932b..f3ae64e2 100644 --- a/.github/workflows/audit-rust.yml +++ b/.github/workflows/audit-rust.yml @@ -28,15 +28,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - - name: Download cargo-audit - run: | - set +f - curl -s https://api.github.com/repos/rustsec/rustsec/releases/latest | grep "browser_download_url.*cargo-audit-x86_64-unknown-linux-musl.*" | cut -d : -f 2,3 | tr -d \" | wget -qi - - tar -xvzf ./cargo-audit*.tgz - mv ./cargo-audit*/cargo-audit ./cargo-audit - chmod +x ./cargo-audit - set -f - - - name: Run cargo-audit - run: ./cargo-audit audit -D unmaintained -D yanked + - uses: actions-rs/audit-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} From 44c2188f232ee86f66fc8bf4b18e936cd0034053 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Fri, 6 Jan 2023 16:49:18 +0100 Subject: [PATCH 06/22] Update mirrors.txt --- plugins/mirrors.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/mirrors.txt b/plugins/mirrors.txt index ca4cb0cf..819c7a00 100644 --- a/plugins/mirrors.txt +++ b/plugins/mirrors.txt @@ -1 +1,14 @@ +authenticator +autostart +fs-extra +fs-watch +localhost +log +persisted-scope +positioner +sql +store +stronghold +upload websocket +window-state \ No newline at end of file From 5966b7d133fd833cd789e31f15cadd4b70fea465 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Fri, 6 Jan 2023 17:01:21 +0100 Subject: [PATCH 07/22] chore: add rust-version field --- Cargo.toml | 3 ++- plugins/authenticator/Cargo.toml | 3 ++- plugins/autostart/Cargo.toml | 3 ++- plugins/fs-extra/Cargo.toml | 3 ++- plugins/fs-watch/Cargo.toml | 3 ++- plugins/localhost/Cargo.toml | 3 ++- plugins/log/Cargo.toml | 3 ++- plugins/persisted-scope/Cargo.toml | 3 ++- plugins/positioner/Cargo.toml | 3 ++- plugins/sql/Cargo.toml | 3 ++- plugins/store/Cargo.toml | 3 ++- plugins/stronghold/Cargo.toml | 3 ++- plugins/upload/Cargo.toml | 3 ++- plugins/websocket/Cargo.toml | 3 ++- plugins/window-state/Cargo.toml | 3 ++- 15 files changed, 30 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 41ae9082..48a6a386 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,4 +12,5 @@ thiserror = "1" [workspace.package] edition = "2021" authors = [ "Tauri Programme within The Commons Conservancy" ] -license = "Apache-2.0 OR MIT" \ No newline at end of file +license = "Apache-2.0 OR MIT" +rust-version = "1.59" \ No newline at end of file diff --git a/plugins/authenticator/Cargo.toml b/plugins/authenticator/Cargo.toml index 73978f5f..af3d0851 100644 --- a/plugins/authenticator/Cargo.toml +++ b/plugins/authenticator/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "tauri-plugin-authenticator" version = "0.1.0" -edition.workspace = true authors.workspace = true license.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/plugins/autostart/Cargo.toml b/plugins/autostart/Cargo.toml index 3819ec10..b1a65e19 100644 --- a/plugins/autostart/Cargo.toml +++ b/plugins/autostart/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "tauri-plugin-autostart" version = "0.1.0" -edition.workspace = true authors.workspace = true license.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/plugins/fs-extra/Cargo.toml b/plugins/fs-extra/Cargo.toml index 63d5a13e..ae1c513c 100644 --- a/plugins/fs-extra/Cargo.toml +++ b/plugins/fs-extra/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "tauri-plugin-fs-extra" version = "0.1.0" -edition.workspace = true authors.workspace = true license.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/plugins/fs-watch/Cargo.toml b/plugins/fs-watch/Cargo.toml index 0eb232a4..4c943208 100644 --- a/plugins/fs-watch/Cargo.toml +++ b/plugins/fs-watch/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "tauri-plugin-fs-watch" version = "0.1.0" -edition.workspace = true authors.workspace = true license.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/plugins/localhost/Cargo.toml b/plugins/localhost/Cargo.toml index 5c20919d..416483b8 100644 --- a/plugins/localhost/Cargo.toml +++ b/plugins/localhost/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "tauri-plugin-localhost" version = "0.1.0" -edition.workspace = true authors.workspace = true license.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/plugins/log/Cargo.toml b/plugins/log/Cargo.toml index 8d627dfe..40784b22 100644 --- a/plugins/log/Cargo.toml +++ b/plugins/log/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "tauri-plugin-log" version = "0.1.0" -edition.workspace = true authors.workspace = true license.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/plugins/persisted-scope/Cargo.toml b/plugins/persisted-scope/Cargo.toml index 58427d32..de3c9209 100644 --- a/plugins/persisted-scope/Cargo.toml +++ b/plugins/persisted-scope/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "tauri-plugin-persisted-scope" version = "0.1.0" -edition.workspace = true authors.workspace = true license.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/plugins/positioner/Cargo.toml b/plugins/positioner/Cargo.toml index 59a9cfef..97f9e5bd 100644 --- a/plugins/positioner/Cargo.toml +++ b/plugins/positioner/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "tauri-plugin-positioner" version = "0.2.7" -edition.workspace = true authors.workspace = true license.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/plugins/sql/Cargo.toml b/plugins/sql/Cargo.toml index cee4ba13..b86a945b 100644 --- a/plugins/sql/Cargo.toml +++ b/plugins/sql/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "tauri-plugin-sql" version = "0.1.0" -edition.workspace = true authors.workspace = true license.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/plugins/store/Cargo.toml b/plugins/store/Cargo.toml index 4ea9924e..6ef15298 100644 --- a/plugins/store/Cargo.toml +++ b/plugins/store/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "tauri-plugin-store" version = "0.1.0" -edition.workspace = true authors.workspace = true license.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/plugins/stronghold/Cargo.toml b/plugins/stronghold/Cargo.toml index ba8f6c3f..63835077 100644 --- a/plugins/stronghold/Cargo.toml +++ b/plugins/stronghold/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "tauri-plugin-stronghold" version = "0.1.0" -edition.workspace = true authors.workspace = true license.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/plugins/upload/Cargo.toml b/plugins/upload/Cargo.toml index 9d427d15..2366e50f 100644 --- a/plugins/upload/Cargo.toml +++ b/plugins/upload/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "tauri-plugin-upload" version = "0.1.0" -edition.workspace = true authors.workspace = true license.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/plugins/websocket/Cargo.toml b/plugins/websocket/Cargo.toml index 1bea91f3..6acc0bbf 100644 --- a/plugins/websocket/Cargo.toml +++ b/plugins/websocket/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "tauri-plugin-websocket" version = "0.1.0" -edition.workspace = true authors.workspace = true license.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/plugins/window-state/Cargo.toml b/plugins/window-state/Cargo.toml index 001ac646..8593efcc 100644 --- a/plugins/window-state/Cargo.toml +++ b/plugins/window-state/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "tauri-plugin-window-state" version = "0.1.0" -edition.workspace = true authors.workspace = true license.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html From 84133c9db72b61f3d0230f4e78d824e42b9e4c22 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Fri, 6 Jan 2023 17:01:38 +0100 Subject: [PATCH 08/22] chore: fix template --- shared/template/guest-js/tsconfig.json | 1 - shared/template/{guest-js => }/package.json | 12 ++++++------ shared/template/{guest-js => }/rollup.config.mjs | 3 ++- shared/template/tsconfig.json | 1 + 4 files changed, 9 insertions(+), 8 deletions(-) delete mode 120000 shared/template/guest-js/tsconfig.json rename shared/template/{guest-js => }/package.json (63%) rename shared/template/{guest-js => }/rollup.config.mjs (70%) create mode 120000 shared/template/tsconfig.json diff --git a/shared/template/guest-js/tsconfig.json b/shared/template/guest-js/tsconfig.json deleted file mode 120000 index 9c2b2da2..00000000 --- a/shared/template/guest-js/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -../../../shared/tsconfig.json \ No newline at end of file diff --git a/shared/template/guest-js/package.json b/shared/template/package.json similarity index 63% rename from shared/template/guest-js/package.json rename to shared/template/package.json index 2c479ef3..ac5eefd1 100644 --- a/shared/template/guest-js/package.json +++ b/shared/template/package.json @@ -6,13 +6,13 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist/index.min.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "browser": "guest-js/dist/index.min.js", + "module": "guest-js/dist/index.mjs", + "types": "guest-js/dist/index.d.ts", "exports": { - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "browser": "./dist/index.min.js" + "import": "./guest-js/dist/index.mjs", + "types": "./guest-js/dist/index.d.ts", + "browser": "./guest-js/dist/index.min.js" }, "scripts": { "build": "rollup -c" diff --git a/shared/template/guest-js/rollup.config.mjs b/shared/template/rollup.config.mjs similarity index 70% rename from shared/template/guest-js/rollup.config.mjs rename to shared/template/rollup.config.mjs index ee885522..35002e05 100644 --- a/shared/template/guest-js/rollup.config.mjs +++ b/shared/template/rollup.config.mjs @@ -1,8 +1,9 @@ import { readFileSync } from "fs"; -import { createConfig } from "../../../shared/rollup.config.mjs"; +import { createConfig } from "../rollup.config.mjs"; export default createConfig({ + input: 'guest-js/index.ts', pkg: JSON.parse( readFileSync(new URL("./package.json", import.meta.url), "utf8") ), diff --git a/shared/template/tsconfig.json b/shared/template/tsconfig.json new file mode 120000 index 00000000..4ec6ff6a --- /dev/null +++ b/shared/template/tsconfig.json @@ -0,0 +1 @@ +../tsconfig.json \ No newline at end of file From 2f713b7fc5e29cfa7b0c92ba3270af2f16fbd93e Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Fri, 6 Jan 2023 17:21:48 +0100 Subject: [PATCH 09/22] don't force add --- .github/sync-to-mirrors.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/sync-to-mirrors.sh b/.github/sync-to-mirrors.sh index 757e1d10..ff5f3793 100755 --- a/.github/sync-to-mirrors.sh +++ b/.github/sync-to-mirrors.sh @@ -93,12 +93,13 @@ while read -r PLUGIN_NAME; do echo "Failed to find a branch to branch from, just creating an empty one." FORCE_COMMIT=--allow-empty fi - git add -Af + git rm -r --cached . + git add -A echo "::endgroup::" if [[ -n "$FORCE_COMMIT" || -n "$(git status --porcelain)" ]]; then echo "Committing to $PLUGIN_NAME" - if git commit --quiet $FORCE_COMMIT --author="${COMMIT_ORIGINAL_AUTHOR}" -m "${COMMIT_MESSAGE}" && + if git commit $FORCE_COMMIT --author="${COMMIT_ORIGINAL_AUTHOR}" -m "${COMMIT_MESSAGE}" && { [[ -z "$CI" ]] || git push origin "$BRANCH"; } # Only do the actual push from the GitHub Action then # echo "$BUILD_BASE/changes.diff" From 89650db1b1287e0da1d190e369a341657897f239 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Fri, 6 Jan 2023 17:27:04 +0100 Subject: [PATCH 10/22] Update sync-to-mirrors.sh --- .github/sync-to-mirrors.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/sync-to-mirrors.sh b/.github/sync-to-mirrors.sh index ff5f3793..1a65bf2d 100755 --- a/.github/sync-to-mirrors.sh +++ b/.github/sync-to-mirrors.sh @@ -93,7 +93,6 @@ while read -r PLUGIN_NAME; do echo "Failed to find a branch to branch from, just creating an empty one." FORCE_COMMIT=--allow-empty fi - git rm -r --cached . git add -A echo "::endgroup::" From e6cfc80b17f5c0fd2ee87be73201ffb7e4001d2b Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Fri, 6 Jan 2023 17:42:43 +0100 Subject: [PATCH 11/22] update readmes and package descriptions --- plugins/authenticator/Cargo.toml | 1 + plugins/authenticator/README.md | 2 +- plugins/authenticator/package.json | 1 + plugins/autostart/Cargo.toml | 1 + plugins/fs-extra/Cargo.toml | 1 + plugins/fs-extra/README.md | 4 +++- plugins/fs-extra/package.json | 1 + plugins/fs-watch/Cargo.toml | 1 + plugins/fs-watch/README.md | 2 +- plugins/fs-watch/package.json | 1 + plugins/localhost/Cargo.toml | 1 + plugins/log/Cargo.toml | 1 + plugins/log/package.json | 1 + plugins/persisted-scope/Cargo.toml | 1 + plugins/positioner/Cargo.toml | 1 + plugins/positioner/package.json | 1 + plugins/sql/Cargo.toml | 1 + plugins/sql/package.json | 1 + plugins/store/Cargo.toml | 1 + plugins/store/package.json | 1 + plugins/stronghold/Cargo.toml | 1 + plugins/stronghold/package.json | 1 + plugins/upload/Cargo.toml | 1 + plugins/upload/README.md | 2 +- plugins/upload/package.json | 1 + plugins/window-state/Cargo.toml | 1 + plugins/window-state/README.md | 2 -- 27 files changed, 28 insertions(+), 6 deletions(-) diff --git a/plugins/authenticator/Cargo.toml b/plugins/authenticator/Cargo.toml index af3d0851..145b5140 100644 --- a/plugins/authenticator/Cargo.toml +++ b/plugins/authenticator/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "tauri-plugin-authenticator" version = "0.1.0" +description = "Use hardware security-keys in your Tauri App." authors.workspace = true license.workspace = true edition.workspace = true diff --git a/plugins/authenticator/README.md b/plugins/authenticator/README.md index a868a3f8..542195ae 100644 --- a/plugins/authenticator/README.md +++ b/plugins/authenticator/README.md @@ -1,6 +1,6 @@ ![plugin-authenticator](banner.png) -Use Hardware Security-keys in your Tauri App. +Use hardware security-keys in your Tauri App. ## Install diff --git a/plugins/authenticator/package.json b/plugins/authenticator/package.json index 6cf8288e..e0c7725e 100644 --- a/plugins/authenticator/package.json +++ b/plugins/authenticator/package.json @@ -1,6 +1,7 @@ { "name": "tauri-plugin-authenticator-api", "version": "0.0.0", + "description": "Use hardware security-keys in your Tauri App.", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" diff --git a/plugins/autostart/Cargo.toml b/plugins/autostart/Cargo.toml index b1a65e19..e129794e 100644 --- a/plugins/autostart/Cargo.toml +++ b/plugins/autostart/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "tauri-plugin-autostart" version = "0.1.0" +description = "Automatically launch your application at startup." authors.workspace = true license.workspace = true edition.workspace = true diff --git a/plugins/fs-extra/Cargo.toml b/plugins/fs-extra/Cargo.toml index ae1c513c..79b0e7ce 100644 --- a/plugins/fs-extra/Cargo.toml +++ b/plugins/fs-extra/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "tauri-plugin-fs-extra" version = "0.1.0" +description = "Additional file system methods not included in the core API." authors.workspace = true license.workspace = true edition.workspace = true diff --git a/plugins/fs-extra/README.md b/plugins/fs-extra/README.md index f2b74924..27b2756e 100644 --- a/plugins/fs-extra/README.md +++ b/plugins/fs-extra/README.md @@ -1,4 +1,6 @@ - +![tauri-plugin-fs-extra](banner.png) + +Additional file system methods not included in the core API. ## Install diff --git a/plugins/fs-extra/package.json b/plugins/fs-extra/package.json index 8929b996..52eb1eef 100644 --- a/plugins/fs-extra/package.json +++ b/plugins/fs-extra/package.json @@ -1,6 +1,7 @@ { "name": "tauri-plugin-fs-extra-api", "version": "0.0.0", + "description": "Additional file system methods not included in the core API.", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" diff --git a/plugins/fs-watch/Cargo.toml b/plugins/fs-watch/Cargo.toml index 4c943208..89501ac8 100644 --- a/plugins/fs-watch/Cargo.toml +++ b/plugins/fs-watch/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "tauri-plugin-fs-watch" version = "0.1.0" +description = "Watch files and directories for changes." authors.workspace = true license.workspace = true edition.workspace = true diff --git a/plugins/fs-watch/README.md b/plugins/fs-watch/README.md index 4a0d65c0..9ce82739 100644 --- a/plugins/fs-watch/README.md +++ b/plugins/fs-watch/README.md @@ -1,6 +1,6 @@ ![plugin-fs-watch](banner.png) -Watch changes on files and directories through [notify](https://github.com/notify-rs/notify). +Watch files and directories for changes using [notify](https://github.com/notify-rs/notify). ## Install diff --git a/plugins/fs-watch/package.json b/plugins/fs-watch/package.json index c903f942..adf44a2c 100644 --- a/plugins/fs-watch/package.json +++ b/plugins/fs-watch/package.json @@ -1,6 +1,7 @@ { "name": "tauri-plugin-fs-watch-api", "version": "0.0.0", + "description": "Watch files and directories for changes.", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" diff --git a/plugins/localhost/Cargo.toml b/plugins/localhost/Cargo.toml index 416483b8..b7ccae7c 100644 --- a/plugins/localhost/Cargo.toml +++ b/plugins/localhost/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "tauri-plugin-localhost" version = "0.1.0" +description = "Expose your apps assets through a localhost server instead of the default custom protocol." authors.workspace = true license.workspace = true edition.workspace = true diff --git a/plugins/log/Cargo.toml b/plugins/log/Cargo.toml index 40784b22..e590222b 100644 --- a/plugins/log/Cargo.toml +++ b/plugins/log/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "tauri-plugin-log" version = "0.1.0" +description = "Configurable logging for your Tauri app." authors.workspace = true license.workspace = true edition.workspace = true diff --git a/plugins/log/package.json b/plugins/log/package.json index 9574a8fc..ff13c42d 100644 --- a/plugins/log/package.json +++ b/plugins/log/package.json @@ -1,6 +1,7 @@ { "name": "tauri-plugin-log-api", "version": "0.0.0", + "description": "Configurable logging for your Tauri app.", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" diff --git a/plugins/persisted-scope/Cargo.toml b/plugins/persisted-scope/Cargo.toml index de3c9209..7bc30228 100644 --- a/plugins/persisted-scope/Cargo.toml +++ b/plugins/persisted-scope/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "tauri-plugin-persisted-scope" version = "0.1.0" +description = "Save filesystem and asset scopes and restore them when the app is reopened." authors.workspace = true license.workspace = true edition.workspace = true diff --git a/plugins/positioner/Cargo.toml b/plugins/positioner/Cargo.toml index 97f9e5bd..08155a5d 100644 --- a/plugins/positioner/Cargo.toml +++ b/plugins/positioner/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "tauri-plugin-positioner" version = "0.2.7" +description = "Position your windows at well-known locations." authors.workspace = true license.workspace = true edition.workspace = true diff --git a/plugins/positioner/package.json b/plugins/positioner/package.json index 5ee70039..8f20982c 100644 --- a/plugins/positioner/package.json +++ b/plugins/positioner/package.json @@ -1,6 +1,7 @@ { "name": "tauri-plugin-positioner-api", "version": "0.0.0", + "description": "Position your windows at well-known locations.", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" diff --git a/plugins/sql/Cargo.toml b/plugins/sql/Cargo.toml index b86a945b..c72e237c 100644 --- a/plugins/sql/Cargo.toml +++ b/plugins/sql/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "tauri-plugin-sql" version = "0.1.0" +description = "Interface with SQL databases." authors.workspace = true license.workspace = true edition.workspace = true diff --git a/plugins/sql/package.json b/plugins/sql/package.json index 35b279ed..9ad3d1fe 100644 --- a/plugins/sql/package.json +++ b/plugins/sql/package.json @@ -1,6 +1,7 @@ { "name": "tauri-plugin-sql-api", "version": "0.0.0", + "description": "Interface with SQL databases", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" diff --git a/plugins/store/Cargo.toml b/plugins/store/Cargo.toml index 6ef15298..9fd091fc 100644 --- a/plugins/store/Cargo.toml +++ b/plugins/store/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "tauri-plugin-store" version = "0.1.0" +description = "Simple, persistent key-value store." authors.workspace = true license.workspace = true edition.workspace = true diff --git a/plugins/store/package.json b/plugins/store/package.json index cc55321f..37f6c532 100644 --- a/plugins/store/package.json +++ b/plugins/store/package.json @@ -1,6 +1,7 @@ { "name": "tauri-plugin-store-api", "version": "0.0.0", + "description": "Simple, persistent key-value store.", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" diff --git a/plugins/stronghold/Cargo.toml b/plugins/stronghold/Cargo.toml index 63835077..7abd5f07 100644 --- a/plugins/stronghold/Cargo.toml +++ b/plugins/stronghold/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "tauri-plugin-stronghold" version = "0.1.0" +description = "Store secrets and keys using the IOTA Stronghold encrypted database." authors.workspace = true license.workspace = true edition.workspace = true diff --git a/plugins/stronghold/package.json b/plugins/stronghold/package.json index b929c2c2..4892e730 100644 --- a/plugins/stronghold/package.json +++ b/plugins/stronghold/package.json @@ -1,6 +1,7 @@ { "name": "tauri-plugin-stronghold-api", "version": "0.0.0", + "description": "Store secrets and keys using the IOTA Stronghold encrypted database.", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" diff --git a/plugins/upload/Cargo.toml b/plugins/upload/Cargo.toml index 2366e50f..b06c1e32 100644 --- a/plugins/upload/Cargo.toml +++ b/plugins/upload/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "tauri-plugin-upload" version = "0.1.0" +description = "Upload files from disk to a remote server over HTTP." authors.workspace = true license.workspace = true edition.workspace = true diff --git a/plugins/upload/README.md b/plugins/upload/README.md index 12bddc7c..0ad80957 100644 --- a/plugins/upload/README.md +++ b/plugins/upload/README.md @@ -1,6 +1,6 @@ ![plugin-upload](banner.png) -Upload files from disk to a remote server over http. +Upload files from disk to a remote server over HTTP. ## Install diff --git a/plugins/upload/package.json b/plugins/upload/package.json index 8ec9afaf..711620b2 100644 --- a/plugins/upload/package.json +++ b/plugins/upload/package.json @@ -1,6 +1,7 @@ { "name": "tauri-plugin-upload-api", "version": "0.0.0", + "description": "Upload files from disk to a remote server over HTTP.", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" diff --git a/plugins/window-state/Cargo.toml b/plugins/window-state/Cargo.toml index 8593efcc..00d15f97 100644 --- a/plugins/window-state/Cargo.toml +++ b/plugins/window-state/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "tauri-plugin-window-state" version = "0.1.0" +description = "Save window positions and sizse and restore them when the app is reopened." authors.workspace = true license.workspace = true edition.workspace = true diff --git a/plugins/window-state/README.md b/plugins/window-state/README.md index 1ef7019d..bc8094f3 100644 --- a/plugins/window-state/README.md +++ b/plugins/window-state/README.md @@ -2,8 +2,6 @@ Save window positions and sizse and restore them when the app is reopened. - - ## Install There are three general methods of installation that we can recommend. From 8befcf561b708658abf1ae01cb439258b4291b76 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Fri, 6 Jan 2023 17:52:35 +0100 Subject: [PATCH 12/22] Update lib.rs --- plugins/persisted-scope/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/persisted-scope/src/lib.rs b/plugins/persisted-scope/src/lib.rs index 9fbdf4f7..0230dfdb 100644 --- a/plugins/persisted-scope/src/lib.rs +++ b/plugins/persisted-scope/src/lib.rs @@ -56,15 +56,15 @@ pub fn init() -> TauriPlugin { .unwrap_or_default(); for allowed in scope.allowed_paths { // allows the path as is - let _ = fs_scope.allow_file(allowed); + let _ = fs_scope.allow_file(&allowed); #[cfg(feature = "protocol-asset")] - let _ = asset_protocol_scope.allow_file(allowed); + let _ = asset_protocol_scope.allow_file(&allowed); } for forbidden in scope.forbidden_patterns { // forbid the path as is - let _ = fs_scope.forbid_file(forbidden); + let _ = fs_scope.forbid_file(&forbidden); #[cfg(feature = "protocol-asset")] - let _ = asset_protocol_scope.forbid_file(forbidden); + let _ = asset_protocol_scope.forbid_file(&forbidden); } } From b7325b5d1d77f20ee79d860082b3cfe9e47d6627 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Fri, 6 Jan 2023 17:58:42 +0100 Subject: [PATCH 13/22] Create renovate.json --- renovate.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 renovate.json diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..b9973fa2 --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "extends": [ + "config:base" + ], + "enabledManagers": ["cargo", "npm"] +} \ No newline at end of file From a56e9194da22bcbce023120bfd4738901ff0a5c9 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Fri, 6 Jan 2023 18:08:15 +0100 Subject: [PATCH 14/22] only run clippy on sql package --- .github/workflows/lint-rust.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint-rust.yml b/.github/workflows/lint-rust.yml index 2ab15be3..3f04eae9 100644 --- a/.github/workflows/lint-rust.yml +++ b/.github/workflows/lint-rust.yml @@ -45,13 +45,13 @@ jobs: run: cargo clippy --workspace --exclude 'tauri-plugin-sql' --all-targets --all-features -- -D warnings - name: clippy sql:sqlite - run: cargo clippy --workspace --package 'tauri-plugin-sql' --all-targets --features sqlite -- -D warnings + run: cargo clippy --package 'tauri-plugin-sql' --all-targets --features sqlite -- -D warnings - name: clippy sql:mysql - run: cargo clippy --workspace --package 'tauri-plugin-sql' --all-targets --features mysql -- -D warnings + run: cargo clippy --package 'tauri-plugin-sql' --all-targets --features mysql -- -D warnings - name: clippy sql:postgres - run: cargo clippy --workspace --package 'tauri-plugin-sql' --all-targets --features postgres -- -D warnings + run: cargo clippy --package 'tauri-plugin-sql' --all-targets --features postgres -- -D warnings fmt: runs-on: ubuntu-latest From c64b949b12383b7e607fd64db7a8ccd73c9e0943 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Fri, 6 Jan 2023 18:08:19 +0100 Subject: [PATCH 15/22] clippy --- plugins/persisted-scope/src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/persisted-scope/src/lib.rs b/plugins/persisted-scope/src/lib.rs index 0230dfdb..ef0625ba 100644 --- a/plugins/persisted-scope/src/lib.rs +++ b/plugins/persisted-scope/src/lib.rs @@ -54,17 +54,17 @@ pub fn init() -> TauriPlugin { .map_err(Error::from) .and_then(|scope| bincode::deserialize(&scope).map_err(Into::into)) .unwrap_or_default(); - for allowed in scope.allowed_paths { + for allowed in &scope.allowed_paths { // allows the path as is - let _ = fs_scope.allow_file(&allowed); + let _ = fs_scope.allow_file(allowed); #[cfg(feature = "protocol-asset")] - let _ = asset_protocol_scope.allow_file(&allowed); + let _ = asset_protocol_scope.allow_file(allowed); } - for forbidden in scope.forbidden_patterns { + for forbidden in &scope.forbidden_patterns { // forbid the path as is - let _ = fs_scope.forbid_file(&forbidden); + let _ = fs_scope.forbid_file(forbidden); #[cfg(feature = "protocol-asset")] - let _ = asset_protocol_scope.forbid_file(&forbidden); + let _ = asset_protocol_scope.forbid_file(forbidden); } } From a2f0e2eb73f780fcd4abc64d254143c36e665796 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Fri, 6 Jan 2023 18:18:16 +0100 Subject: [PATCH 16/22] fmt --- plugins/authenticator/README.md | 52 ++++++++++++++++++++----------- plugins/autostart/README.md | 12 ++++--- plugins/fs-extra/README.md | 10 +++--- plugins/fs-watch/README.md | 28 +++++++++++------ plugins/localhost/README.md | 2 ++ plugins/log/README.md | 16 +++++----- plugins/persisted-scope/README.md | 2 ++ plugins/positioner/README.md | 11 ++++--- plugins/sql/README.md | 14 +++++---- plugins/store/README.md | 12 ++++--- plugins/stronghold/README.md | 7 +++-- plugins/upload/README.md | 4 ++- plugins/websocket/README.md | 12 ++++--- plugins/window-state/README.md | 4 +++ renovate.json | 8 ++--- shared/template/README.md | 4 ++- shared/template/rollup.config.mjs | 2 +- 17 files changed, 124 insertions(+), 76 deletions(-) diff --git a/plugins/authenticator/README.md b/plugins/authenticator/README.md index 542195ae..884d81b9 100644 --- a/plugins/authenticator/README.md +++ b/plugins/authenticator/README.md @@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend. Install the Core plugin by adding the following to your `Cargo.toml` file: `src-tauri/Cargo.toml` + ```toml [dependencies] tauri-plugin-authenticator = "0.1" @@ -28,7 +29,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa pnpm add https://github.com/tauri-apps/tauri-plugin-authenticator # or npm add https://github.com/tauri-apps/tauri-plugin-authenticator -# or +# or yarn add https://github.com/tauri-apps/tauri-plugin-authenticator ``` @@ -37,6 +38,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-authenticator First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` + ```rust fn main() { tauri::Builder::default() @@ -49,37 +51,49 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { Authenticator } from 'tauri-plugin-authenticator-api' +import { Authenticator } from "tauri-plugin-authenticator-api"; -const auth = new Authenticator() -auth.init() // initialize transports +const auth = new Authenticator(); +auth.init(); // initialize transports // generate a 32-bytes long random challenge -const arr = new Uint32Array(32) -window.crypto.getRandomValues(arr) -const b64 = btoa(String.fromCharCode.apply(null, arr)) +const arr = new Uint32Array(32); +window.crypto.getRandomValues(arr); +const b64 = btoa(String.fromCharCode.apply(null, arr)); // web-safe base64 -const challenge = b64.replace(/\+/g, '-').replace(/\//g, '_') +const challenge = b64.replace(/\+/g, "-").replace(/\//g, "_"); -const domain = 'https://tauri.app' +const domain = "https://tauri.app"; // attempt to register with the security key -const json = await auth.register(challenge, domain) -const registerResult = JSON.parse(json) +const json = await auth.register(challenge, domain); +const registerResult = JSON.parse(json); // verify te registration was successfull -const r2 = await auth.verifyRegistration(challenge, app, registerResult.registerData, registerResult.clientData) -const j2 = JSON.parse(r2) +const r2 = await auth.verifyRegistration( + challenge, + app, + registerResult.registerData, + registerResult.clientData +); +const j2 = JSON.parse(r2); // sign some data -const json = await auth.sign(challenge, app, keyHandle) -const signData = JSON.parse(json) +const json = await auth.sign(challenge, app, keyHandle); +const signData = JSON.parse(json); // verify the signature again -const counter = await auth.verifySignature(challenge, app, signData.signData, clientData, keyHandle, pubkey) - -if(counter && counter>0) { - console.log('SUCCESS!') +const counter = await auth.verifySignature( + challenge, + app, + signData.signData, + clientData, + keyHandle, + pubkey +); + +if (counter && counter > 0) { + console.log("SUCCESS!"); } ``` diff --git a/plugins/autostart/README.md b/plugins/autostart/README.md index f048cd13..87e7d132 100644 --- a/plugins/autostart/README.md +++ b/plugins/autostart/README.md @@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend. Install the Core plugin by adding the following to your `Cargo.toml` file: `src-tauri/Cargo.toml` + ```toml [dependencies] tauri-plugin-autostart = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } @@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa pnpm add https://github.com/tauri-apps/tauri-plugin-autostart # or npm add https://github.com/tauri-apps/tauri-plugin-autostart -# or +# or yarn add https://github.com/tauri-apps/tauri-plugin-autostart ``` @@ -35,6 +36,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-autostart First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` + ```rust fn main() { tauri::Builder::default() @@ -47,13 +49,13 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { enable, isEnabled, disable } from 'tauri-plugin-autostart-api' +import { enable, isEnabled, disable } from "tauri-plugin-autostart-api"; -await enable() +await enable(); -console.log(`registered for autostart? ${await isEnabled()}`) +console.log(`registered for autostart? ${await isEnabled()}`); -disable() +disable(); ``` ## Contributing diff --git a/plugins/fs-extra/README.md b/plugins/fs-extra/README.md index 27b2756e..6ea6ea1c 100644 --- a/plugins/fs-extra/README.md +++ b/plugins/fs-extra/README.md @@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend. Install the Core plugin by adding the following to your `Cargo.toml` file: `src-tauri/Cargo.toml` + ```toml [dependencies] tauri-plugin-fs-extra = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } @@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa pnpm add https://github.com/tauri-apps/tauri-plugin-fs-extra # or npm add https://github.com/tauri-apps/tauri-plugin-fs-extra -# or +# or yarn add https://github.com/tauri-apps/tauri-plugin-fs-extra ``` @@ -35,6 +36,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-fs-extra First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` + ```rust fn main() { tauri::Builder::default() @@ -47,9 +49,9 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { metadata } from 'tauri-plugin-fs-extra-api' +import { metadata } from "tauri-plugin-fs-extra-api"; -await metadata('/path/to/file') +await metadata("/path/to/file"); ``` ## Contributing @@ -60,4 +62,4 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy. -MIT or MIT/Apache 2.0 where applicable. \ No newline at end of file +MIT or MIT/Apache 2.0 where applicable. diff --git a/plugins/fs-watch/README.md b/plugins/fs-watch/README.md index 9ce82739..26ee5bfc 100644 --- a/plugins/fs-watch/README.md +++ b/plugins/fs-watch/README.md @@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend. Install the Core plugin by adding the following to your `Cargo.toml` file: `src-tauri/Cargo.toml` + ```toml [dependencies] tauri-plugin-fs-watch = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } @@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa pnpm add https://github.com/tauri-apps/tauri-plugin-fs-watch # or npm add https://github.com/tauri-apps/tauri-plugin-fs-watch -# or +# or yarn add https://github.com/tauri-apps/tauri-plugin-fs-watch ``` @@ -35,6 +36,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-fs-watch First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` + ```rust fn main() { tauri::Builder::default() @@ -47,16 +49,24 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { watch, watchImmediate } from 'tauri-plugin-fs-watch-api' +import { watch, watchImmediate } from "tauri-plugin-fs-watch-api"; // can also watch an array of paths -const stopWatching = await watch('/path/to/something', { recursive: true }, event => { - const { type, payload } = event -}) - -const stopRawWatcher = await watchImmediate(['/path/a', '/path/b'], {}, event => { - const { path, operation, cookie } = event -}) +const stopWatching = await watch( + "/path/to/something", + { recursive: true }, + (event) => { + const { type, payload } = event; + } +); + +const stopRawWatcher = await watchImmediate( + ["/path/a", "/path/b"], + {}, + (event) => { + const { path, operation, cookie } = event; + } +); ``` ## Contributing diff --git a/plugins/localhost/README.md b/plugins/localhost/README.md index e5c495f1..23b07577 100644 --- a/plugins/localhost/README.md +++ b/plugins/localhost/README.md @@ -15,6 +15,7 @@ There are three general methods of installation that we can recommend. Install the Core plugin by adding the following to your `Cargo.toml` file: `src-tauri/Cargo.toml` + ```toml [dependencies] tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } @@ -26,6 +27,7 @@ portpicker = "0.1" # used in the example to pick a random free port First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` + ```rust use tauri::{utils::config::AppUrl, window::WindowBuilder, WindowUrl}; diff --git a/plugins/log/README.md b/plugins/log/README.md index 2d691449..f49c2c7b 100644 --- a/plugins/log/README.md +++ b/plugins/log/README.md @@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend. Install the Core plugin by adding the following to your `Cargo.toml` file: `src-tauri/Cargo.toml` + ```toml [dependencies] tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } @@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa pnpm add https://github.com/tauri-apps/tauri-plugin-log # or npm add https://github.com/tauri-apps/tauri-plugin-log -# or +# or yarn add https://github.com/tauri-apps/tauri-plugin-log ``` @@ -35,6 +36,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-log First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` + ```rust use tauri_plugin_log::{LogTarget}; @@ -53,17 +55,17 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { trace, info, error, attachConsole } from 'tauri-plugin-log-api' +import { trace, info, error, attachConsole } from "tauri-plugin-log-api"; // with LogTarget::Webview enabled this function will print logs to the browser console -const detach = await attachConsole() +const detach = await attachConsole(); -trace("Trace") -info("Info") -error("Error") +trace("Trace"); +info("Info"); +error("Error"); // detach the browser console from the log stream -detach() +detach(); ``` To log from rust code, add the log crate to your `Cargo.toml`: diff --git a/plugins/persisted-scope/README.md b/plugins/persisted-scope/README.md index a856a777..43dd5909 100644 --- a/plugins/persisted-scope/README.md +++ b/plugins/persisted-scope/README.md @@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend. Install the Core plugin by adding the following to your `Cargo.toml` file: `src-tauri/Cargo.toml` + ```toml [dependencies] tauri-plugin-persisted-scope = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } @@ -23,6 +24,7 @@ tauri-plugin-persisted-scope = { git = "https://github.com/tauri-apps/plugins-wo First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` + ```rust fn main() { tauri::Builder::default() diff --git a/plugins/positioner/README.md b/plugins/positioner/README.md index 861043cd..54332ddc 100644 --- a/plugins/positioner/README.md +++ b/plugins/positioner/README.md @@ -15,6 +15,7 @@ There are three general methods of installation that we can recommend. Install the Core plugin by adding the following to your `Cargo.toml` file: `src-tauri/Cargo.toml` + ```toml [dependencies] tauri-plugin-positioner = "1.0" @@ -30,7 +31,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa pnpm add tauri-plugin-positioner # or npm add tauri-plugin-positioner -# or +# or yarn add tauri-plugin-positioner ``` @@ -40,7 +41,7 @@ Or through git: pnpm add https://github.com/tauri-apps/tauri-plugin-positioner # or npm add https://github.com/tauri-apps/tauri-plugin-positioner -# or +# or yarn add https://github.com/tauri-apps/tauri-plugin-positioner ``` @@ -49,6 +50,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-positioner First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` + ```rust fn main() { tauri::Builder::default() @@ -65,9 +67,9 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { move_window, Position } from 'tauri-plugin-positioner-api' +import { move_window, Position } from "tauri-plugin-positioner-api"; -move_window(Position.TopRight) +move_window(Position.TopRight); ``` If you only intend on moving the window from rust code, you can import the Window trait extension instead of registering the plugin: @@ -88,4 +90,3 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu Code: (c) 2021 - Jonas Kruckenberg. 2021 - Present - The Tauri Programme within The Commons Conservancy. MIT or MIT/Apache 2.0 where applicable. - diff --git a/plugins/sql/README.md b/plugins/sql/README.md index ee7ef740..2b7c6f9b 100644 --- a/plugins/sql/README.md +++ b/plugins/sql/README.md @@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend. Install the Core plugin by adding the following to your `Cargo.toml` file: `src-tauri/Cargo.toml` + ```toml [dependencies.tauri-plugin-sql] git = "https://github.com/tauri-apps/plugins-workspace" @@ -28,7 +29,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa pnpm add https://github.com/tauri-apps/tauri-plugin-sql # or npm add https://github.com/tauri-apps/tauri-plugin-sql -# or +# or yarn add https://github.com/tauri-apps/tauri-plugin-sql ``` @@ -37,6 +38,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-sql First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` + ```rust fn main() { tauri::Builder::default() @@ -49,16 +51,16 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import Database from 'tauri-plugin-sql-api' +import Database from "tauri-plugin-sql-api"; // sqlite. The path is relative to `tauri::api::path::BaseDirectory::App`. -const db = await Database.load('sqlite:test.db') +const db = await Database.load("sqlite:test.db"); // mysql -const db = await Database.load('mysql://user:pass@host/database') +const db = await Database.load("mysql://user:pass@host/database"); // postgres -const db = await Database.load('postgres://postgres:password@localhost/test') +const db = await Database.load("postgres://postgres:password@localhost/test"); -await db.execute('INSERT INTO ...') +await db.execute("INSERT INTO ..."); ``` ## Contributing diff --git a/plugins/store/README.md b/plugins/store/README.md index 4276872d..0e1eb29a 100644 --- a/plugins/store/README.md +++ b/plugins/store/README.md @@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend. Install the Core plugin by adding the following to your `Cargo.toml` file: `src-tauri/Cargo.toml` + ```toml [dependencies] tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } @@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa pnpm add https://github.com/tauri-apps/tauri-plugin-store # or npm add https://github.com/tauri-apps/tauri-plugin-store -# or +# or yarn add https://github.com/tauri-apps/tauri-plugin-store ``` @@ -35,6 +36,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-store First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` + ```rust fn main() { tauri::Builder::default() @@ -47,13 +49,13 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { Store } from 'tauri-plugin-store-api'; +import { Store } from "tauri-plugin-store-api"; -const store = new Store('.settings.dat'); +const store = new Store(".settings.dat"); -await store.set('some-key', { value: 5 }); +await store.set("some-key", { value: 5 }); -const val = await store.get('some-key'); +const val = await store.get("some-key"); assert(val, { value: 5 }); ``` diff --git a/plugins/stronghold/README.md b/plugins/stronghold/README.md index 3831aaa8..bc79b46c 100644 --- a/plugins/stronghold/README.md +++ b/plugins/stronghold/README.md @@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend. Install the Core plugin by adding the following to your `Cargo.toml` file: `src-tauri/Cargo.toml` + ```toml [dependencies] tauri-plugin-stronghold = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } @@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa pnpm add https://github.com/tauri-apps/tauri-plugin-stronghold # or npm add https://github.com/tauri-apps/tauri-plugin-stronghold -# or +# or yarn add https://github.com/tauri-apps/tauri-plugin-stronghold ``` @@ -35,6 +36,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-stronghold First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` + ```rust fn main() { tauri::Builder::default() @@ -51,7 +53,7 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { Stronghold, Location } from 'tauri-plugin-stronghold-api' +import { Stronghold, Location } from "tauri-plugin-stronghold-api"; // TODO ``` @@ -65,4 +67,3 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy. MIT or MIT/Apache 2.0 where applicable. - diff --git a/plugins/upload/README.md b/plugins/upload/README.md index 0ad80957..1168a362 100644 --- a/plugins/upload/README.md +++ b/plugins/upload/README.md @@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend. Install the Core plugin by adding the following to your `Cargo.toml` file: `src-tauri/Cargo.toml` + ```toml [dependencies] tauri-plugin-upload = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } @@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa pnpm add https://github.com/tauri-apps/tauri-plugin-upload # or npm add https://github.com/tauri-apps/tauri-plugin-upload -# or +# or yarn add https://github.com/tauri-apps/tauri-plugin-upload ``` @@ -35,6 +36,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-upload First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` + ```rust fn main() { tauri::Builder::default() diff --git a/plugins/websocket/README.md b/plugins/websocket/README.md index 9d1abd6c..954a650f 100644 --- a/plugins/websocket/README.md +++ b/plugins/websocket/README.md @@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend. Install the Core plugin by adding the following to your `Cargo.toml` file: `src-tauri/Cargo.toml` + ```toml [dependencies] tauri-plugin-websocket = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } @@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa pnpm add https://github.com/tauri-apps/tauri-plugin-websocket # or npm add https://github.com/tauri-apps/tauri-plugin-websocket -# or +# or yarn add https://github.com/tauri-apps/tauri-plugin-websocket ``` @@ -35,6 +36,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-websocket First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` + ```rust fn main() { tauri::Builder::default() @@ -47,13 +49,13 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { WebSocket } from 'tauri-plugin-websocket-api' +import { WebSocket } from "tauri-plugin-websocket-api"; -const ws = await WebSocket.connect('wss://example.com') +const ws = await WebSocket.connect("wss://example.com"); -await ws.send('Hello World') +await ws.send("Hello World"); -await ws.disconnect() +await ws.disconnect(); ``` ## Contributing diff --git a/plugins/window-state/README.md b/plugins/window-state/README.md index bc8094f3..de309e73 100644 --- a/plugins/window-state/README.md +++ b/plugins/window-state/README.md @@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend. Install the Core plugin by adding the following to your `Cargo.toml` file: `src-tauri/Cargo.toml` + ```toml [dependencies] tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } @@ -23,6 +24,7 @@ tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-works First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` + ```rust fn main() { tauri::Builder::default() @@ -35,6 +37,7 @@ fn main() { Afterwards all windows will remember their state when the app is being closed and will restore to their previous state on the next launch. Optionally you can also tell the plugin to save the state of all open window to disk my using the `save_window_state()` method exposed by the `AppHandleExt` trait: + ```rust use tauri_plugin_window_state::AppHandleExt; @@ -43,6 +46,7 @@ app.save_window_state(); // will save the state of all open windows to disk ``` To manually restore a windows state from disk you can call the `restore_state()` method exposed by the `WindowExt` trait: + ```rust use tauri_plugin_window_state::{WindowExt, ShowMode}; diff --git a/renovate.json b/renovate.json index b9973fa2..4dac52b1 100644 --- a/renovate.json +++ b/renovate.json @@ -1,6 +1,4 @@ { - "extends": [ - "config:base" - ], - "enabledManagers": ["cargo", "npm"] -} \ No newline at end of file + "extends": ["config:base"], + "enabledManagers": ["cargo", "npm"] +} diff --git a/shared/template/README.md b/shared/template/README.md index 5823ab98..0a059e4f 100644 --- a/shared/template/README.md +++ b/shared/template/README.md @@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend. Install the Core plugin by adding the following to your `Cargo.toml` file: `src-tauri/Cargo.toml` + ```toml [dependencies] = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } @@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa pnpm add # or npm add -# or +# or yarn add ``` @@ -35,6 +36,7 @@ yarn add First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` + ```rust fn main() { tauri::Builder::default() diff --git a/shared/template/rollup.config.mjs b/shared/template/rollup.config.mjs index 35002e05..96840adc 100644 --- a/shared/template/rollup.config.mjs +++ b/shared/template/rollup.config.mjs @@ -3,7 +3,7 @@ import { readFileSync } from "fs"; import { createConfig } from "../rollup.config.mjs"; export default createConfig({ - input: 'guest-js/index.ts', + input: "guest-js/index.ts", pkg: JSON.parse( readFileSync(new URL("./package.json", import.meta.url), "utf8") ), From 800e11de2224b1129af71448de352f10581981fa Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Sat, 7 Jan 2023 10:32:45 +0100 Subject: [PATCH 17/22] Update .prettierignore --- .prettierignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.prettierignore b/.prettierignore index 2c6d35b6..13134b1f 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,5 @@ target node_modules -dist \ No newline at end of file +dist +pnpm-lock.yaml +Cargo.lock \ No newline at end of file From a0d0cf4fbe629d133e1536996f2b996bbb8f429d Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Sat, 7 Jan 2023 12:59:42 +0100 Subject: [PATCH 18/22] Update sync.yml --- .github/workflows/sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index aabf8d93..8c988701 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -33,5 +33,5 @@ jobs: - name: Sync run: .github/sync-to-mirrors.sh env: - BUILD_BASE: ./plugins + BUILD_BASE: ${GITHUB_WORKSPACE}/plugins API_TOKEN_GITHUB: ${{ secrets.ORG_TAURI_BOT_PAT }} From 43186889ef552c12a6eaba73dc223f1d7e470205 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Sat, 7 Jan 2023 13:01:19 +0100 Subject: [PATCH 19/22] Update sync.yml --- .github/workflows/sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 8c988701..6921b832 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -33,5 +33,5 @@ jobs: - name: Sync run: .github/sync-to-mirrors.sh env: - BUILD_BASE: ${GITHUB_WORKSPACE}/plugins + BUILD_BASE: ${{ env.GITHUB_WORKSPACE }}/plugins API_TOKEN_GITHUB: ${{ secrets.ORG_TAURI_BOT_PAT }} From 6566563a58c9c9f47ce487a719e4e43079a6e222 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Sat, 7 Jan 2023 13:03:02 +0100 Subject: [PATCH 20/22] Update sync.yml --- .github/workflows/sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 6921b832..51521aab 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -33,5 +33,5 @@ jobs: - name: Sync run: .github/sync-to-mirrors.sh env: - BUILD_BASE: ${{ env.GITHUB_WORKSPACE }}/plugins + BUILD_BASE: ${{ github.workspace }}/plugins API_TOKEN_GITHUB: ${{ secrets.ORG_TAURI_BOT_PAT }} From 2d7bbc8925df6b5bd226eb23f8a91ea7e1b772b6 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Sat, 7 Jan 2023 13:07:01 +0100 Subject: [PATCH 21/22] Update mirrors.txt --- plugins/mirrors.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mirrors.txt b/plugins/mirrors.txt index 819c7a00..4ad29c51 100644 --- a/plugins/mirrors.txt +++ b/plugins/mirrors.txt @@ -11,4 +11,4 @@ store stronghold upload websocket -window-state \ No newline at end of file +window-state From 66dc508f3497003af4c7e2ede01c50a86b022f12 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Sat, 7 Jan 2023 15:15:54 +0100 Subject: [PATCH 22/22] ci: fix path pattern. upgrade rust-cache action (#68) --- .github/workflows/lint-rust.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint-rust.yml b/.github/workflows/lint-rust.yml index 3f04eae9..da353a56 100644 --- a/.github/workflows/lint-rust.yml +++ b/.github/workflows/lint-rust.yml @@ -6,14 +6,14 @@ on: - dev paths: - ".github/workflows/lint-rust.yml" - - "plugins/src/**" + - "plugins/*/src/**" - "**/Cargo.toml" pull_request: branches: - dev paths: - ".github/workflows/lint-rust.yml" - - "plugins/src/**" + - "plugins/*/src/**" - "**/Cargo.toml" concurrency: @@ -39,7 +39,7 @@ jobs: with: components: clippy - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - name: clippy run: cargo clippy --workspace --exclude 'tauri-plugin-sql' --all-targets --all-features -- -D warnings