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

refactor(core): move os endpoints to a dedicated plugin #6902

Merged
merged 3 commits into from May 8, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changes/move-os.md
@@ -0,0 +1,7 @@
---
"api": patch
"tauri": patch
"tauri-utils": patch
lucasfernog marked this conversation as resolved.
Show resolved Hide resolved
---

Moved the `os` feature to its own plugin in the plugins-workspace repository.
3 changes: 1 addition & 2 deletions core/tauri/Cargo.toml
Expand Up @@ -66,7 +66,6 @@ bytes = { version = "1", features = [ "serde" ] }
raw-window-handle = "0.5"
minisign-verify = { version = "0.2", optional = true }
time = { version = "0.3", features = [ "parsing", "formatting" ], optional = true }
os_info = { version = "3", optional = true }
glob = "0.3"
data-url = { version = "0.2", optional = true }
serialize-to-javascript = "=0.1.1"
Expand Down Expand Up @@ -198,7 +197,7 @@ global-shortcut-all = [ ]
http-all = [ "http-request" ]
http-request = [ ]
notification-all = [ ]
os-all = [ "os_info" ]
os-all = [ ]
path-all = [ ]
process-all = [ "process-relaunch", "process-exit" ]
process-exit = [ ]
Expand Down
6 changes: 2 additions & 4 deletions core/tauri/scripts/bundle.global.js

Large diffs are not rendered by default.

11 changes: 0 additions & 11 deletions core/tauri/src/endpoints.rs
Expand Up @@ -13,8 +13,6 @@ use serde_json::Value as JsonValue;
use std::sync::Arc;

mod event;
#[cfg(os_any)]
mod operating_system;
#[cfg(process_any)]
mod process;
mod window;
Expand Down Expand Up @@ -55,8 +53,6 @@ impl<T: Serialize> From<T> for InvokeResponse {
enum Module {
#[cfg(process_any)]
Process(process::Cmd),
#[cfg(os_any)]
Os(operating_system::Cmd),
Window(Box<window::Cmd>),
Event(event::Cmd),
}
Expand All @@ -82,13 +78,6 @@ impl Module {
.and_then(|r| r.json)
.map_err(InvokeError::from_anyhow)
}),
#[cfg(os_any)]
Self::Os(cmd) => resolver.respond_async(async move {
cmd
.run(context)
.and_then(|r| r.json)
.map_err(InvokeError::from_anyhow)
}),
Self::Window(cmd) => resolver.respond_async(async move {
cmd
.run(context)
Expand Down
115 changes: 0 additions & 115 deletions core/tauri/src/endpoints/operating_system.rs

This file was deleted.

6 changes: 1 addition & 5 deletions examples/api/src/App.svelte
@@ -1,7 +1,6 @@
<script>
import { writable } from 'svelte/store'
import { appWindow, getCurrent } from '@tauri-apps/api/window'
import * as os from '@tauri-apps/api/os'

import Welcome from './views/Welcome.svelte'
import Cli from './views/Cli.svelte'
Expand Down Expand Up @@ -154,10 +153,7 @@
document.addEventListener('mousemove', moveHandler)
}

let isWindows
onMount(async () => {
isWindows = (await os.platform()) === 'win32'
})
const isWindows = navigator.appVersion.includes('Win')

// mobile
let isSideBarOpen = false
Expand Down
2 changes: 1 addition & 1 deletion tooling/api/docs/js-api.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions tooling/api/src/index.ts
Expand Up @@ -19,9 +19,8 @@ import * as process from './process'
import * as tauri from './tauri'
import * as updater from './updater'
import * as window from './window'
import * as os from './os'

/** @ignore */
const invoke = tauri.invoke

export { invoke, event, path, process, tauri, updater, window, os }
export { invoke, event, path, process, tauri, updater, window }
164 changes: 0 additions & 164 deletions tooling/api/src/os.ts

This file was deleted.