diff --git a/node_modules/@tauri-apps/api b/node_modules/@tauri-apps/api new file mode 120000 index 0000000..fcf8424 --- /dev/null +++ b/node_modules/@tauri-apps/api @@ -0,0 +1 @@ +../../../../node_modules/.pnpm/@tauri-apps+api@2.0.0-rc.4/node_modules/@tauri-apps/api \ No newline at end of file diff --git a/package.json b/package.json index 9d01aab..041ee6e 100644 --- a/package.json +++ b/package.json @@ -1,25 +1,29 @@ { - "authors": [ - "Tauri Programme within The Commons Conservancy" - ], - "dependencies": { - "@tauri-apps/api": "^2.0.0-rc.4" - }, - "exports": { - "import": "./dist-js/index.js", - "require": "./dist-js/index.cjs", - "types": "./dist-js/index.d.ts" - }, - "files": [ - "dist-js", - "README.md", - "LICENSE" - ], - "main": "./dist-js/index.cjs", - "module": "./dist-js/index.js", - "name": "@tauri-apps/plugin-process", - "scripts": { - "build": "rollup -c" - }, - "types": "./dist-js/index.d.ts" + "name": "@tauri-apps/plugin-process", + "version": "2.0.0-rc.1", + "license": "MIT or APACHE-2.0", + "authors": [ + "Tauri Programme within The Commons Conservancy" + ], + "repository": "https://github.com/tauri-apps/plugins-workspace", + "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" + }, + "scripts": { + "build": "rollup -c" + }, + "files": [ + "dist-js", + "README.md", + "LICENSE" + ], + "dependencies": { + "@tauri-apps/api": "^2.0.0-rc.4" + } } diff --git a/src/commands.rs b/src/commands.rs new file mode 100644 index 0000000..2c27a3d --- /dev/null +++ b/src/commands.rs @@ -0,0 +1,15 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use tauri::{AppHandle, Runtime}; + +#[tauri::command] +pub fn exit(app: AppHandle, code: i32) { + app.exit(code) +} + +#[tauri::command] +pub fn restart(app: AppHandle) { + app.restart() +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..e0e948f --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,25 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/process/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/process) +//! +//! This plugin provides APIs to access the current process. To spawn child processes, see the [`shell`](https://github.com/tauri-apps/tauri-plugin-shell) plugin. + +#![doc( + html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png", + html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png" +)] + +use tauri::{ + plugin::{Builder, TauriPlugin}, + Runtime, +}; + +mod commands; + +pub fn init() -> TauriPlugin { + Builder::new("process") + .invoke_handler(tauri::generate_handler![commands::exit, commands::restart]) + .build() +}