Skip to content

Commit

Permalink
refactor(core): move os endpoints to a dedicated plugin (#6902)
Browse files Browse the repository at this point in the history
Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
  • Loading branch information
lucasfernog and FabianLars authored May 8, 2023
1 parent 3245d14 commit 29ce9ce
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 304 deletions.
6 changes: 6 additions & 0 deletions .changes/move-os.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"api": patch
"tauri": patch
---

Moved the `os` feature to its own plugin in the plugins-workspace repository.
3 changes: 1 addition & 2 deletions core/tauri/Cargo.toml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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.

0 comments on commit 29ce9ce

Please sign in to comment.