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

Plugin Injects IIFE (For Tests?!?) #6

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2,603 changes: 1,204 additions & 1,399 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"preview": "vite preview",
"tauri": "tauri"
},
"workspaces": [
"plugins/*"
],
"dependencies": {
"@tauri-apps/api": "^2.0.0-beta <2.0.0",
"@tauri-apps/plugin-os": "^2.0.0-beta <2.0.0",
Expand Down
18 changes: 18 additions & 0 deletions plugins/tauri-plugin-test-harness/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/.vs
.DS_Store
.Thumbs.db
*.sublime*
.idea/
debug.log
package-lock.json
.vscode/settings.json
yarn.lock

/.tauri
/target
Cargo.lock
node_modules/

dist-js
dist
api-iife.js
17 changes: 17 additions & 0 deletions plugins/tauri-plugin-test-harness/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "tauri-plugin-test-harness"
version = "0.0.0"
authors = [ "You" ]
description = ""
edition = "2021"
rust-version = "1.70"
exclude = ["/examples", "/webview-dist", "/webview-src", "/node_modules"]
links = "tauri-plugin-test-harness"

[dependencies]
tauri = { version = "2.0.0-beta.23" }
serde = "1.0"
thiserror = "1.0"

[build-dependencies]
tauri-plugin = { version = "2.0.0-beta.18", features = ["build"] }
1 change: 1 addition & 0 deletions plugins/tauri-plugin-test-harness/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Tauri Plugin test-harness
9 changes: 9 additions & 0 deletions plugins/tauri-plugin-test-harness/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const COMMANDS: &[&str] = &["ping"];

fn main() {
tauri_plugin::Builder::new(COMMANDS)
.global_api_script_path("./api-iife.js")
.android_path("android")
.ios_path("ios")
.build();
}
7 changes: 7 additions & 0 deletions plugins/tauri-plugin-test-harness/guest-js/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
console.log("see this in every webview window");

// if (window?.__TAURI__) {
// @ts-expect-error
const windowLabel = window.__TAURI__.webview.getCurrent().label;
console.log(windowLabel);
// }
33 changes: 33 additions & 0 deletions plugins/tauri-plugin-test-harness/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "tauri-plugin-test-harness-api",
"version": "0.0.0",
"author": "You",
"description": "",
"type": "module",
"types": "./dist-js/index.d.ts",
"main": "./dist-js/index.cjs",
"module": "./dist-js/index.js",
"exports": {
"types": "./dist-js/index.d.ts",
"import": "./dist-js/index.js",
"require": "./dist-js/index.cjs"
},
"files": [
"dist-js",
"README.md"
],
"scripts": {
"build": "rollup -c"
},
"dependencies": {
"@tauri-apps/api": ">=2.0.0-beta.6"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"rollup": "^4.9.6",
"typescript": "^5.3.3",
"tslib": "^2.6.2"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Automatically generated - DO NOT EDIT!

"$schema" = "../../schemas/schema.json"

[[permission]]
identifier = "allow-ping"
description = "Enables the ping command without any pre-configured scope."
commands.allow = ["ping"]

[[permission]]
identifier = "deny-ping"
description = "Denies the ping command without any pre-configured scope."
commands.deny = ["ping"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## Default Permission

Default permissions for the plugin

- `allow-ping`

### Permission Table

<table>
<tr>
<th>Identifier</th>
<th>Description</th>
</tr>


<tr>
<td>

`test-harness:allow-ping`

</td>
<td>

Enables the ping command without any pre-configured scope.

</td>
</tr>

<tr>
<td>

`test-harness:deny-ping`

</td>
<td>

Denies the ping command without any pre-configured scope.

</td>
</tr>
</table>
3 changes: 3 additions & 0 deletions plugins/tauri-plugin-test-harness/permissions/default.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[default]
description = "Default permissions for the plugin"
permissions = ["allow-ping"]
Loading