Skip to content

Commit

Permalink
Refactor(tauri): move tauri-api and tauri-updater to tauri (#1455)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
  • Loading branch information
chippers and lucasfernog committed Apr 12, 2021
1 parent 7fab1c0 commit a6def70
Show file tree
Hide file tree
Showing 80 changed files with 859 additions and 4,754 deletions.
1 change: 0 additions & 1 deletion .changes/api-path-cwd.md
@@ -1,5 +1,4 @@
---
"api": minor
"tauri-api": minor
---
Add current working directory to the path api module.
1 change: 0 additions & 1 deletion .changes/config-refactor.md
@@ -1,6 +1,5 @@
---
"tauri-utils": minor
"tauri-api": minor
"tauri": minor
---

Expand Down
34 changes: 19 additions & 15 deletions .changes/config.json
Expand Up @@ -156,12 +156,18 @@
"tauri-cli": {
"path": "./cli/core",
"manager": "rust",
"dependencies": ["api", "tauri-bundler", "tauri"]
"dependencies": [
"api",
"tauri-bundler",
"tauri"
]
},
"tauri.js": {
"path": "./cli/tauri.js",
"manager": "javascript",
"dependencies": ["tauri-cli"],
"dependencies": [
"tauri-cli"
],
"assets": [
{
"path": "./cli/tauri.js/tauri-${ pkgFile.version }.tgz",
Expand All @@ -172,25 +178,20 @@
"create-tauri-app": {
"path": "./cli/create-tauri-app",
"manager": "javascript",
"dependencies": ["tauri.js"]
"dependencies": [
"tauri.js"
]
},
"tauri-utils": {
"path": "./core/tauri-utils",
"manager": "rust"
},
"tauri-api": {
"path": "./core/tauri-api",
"manager": "rust",
"dependencies": ["tauri-utils"]
},
"tauri-macros": {
"path": "./core/tauri-macros",
"manager": "rust",
"dependencies": ["tauri-utils"]
},
"tauri-updater": {
"path": "./core/tauri-updater",
"manager": "rust"
"dependencies": [
"tauri-utils"
]
},
"tauri-build": {
"path": "./core/tauri-build",
Expand All @@ -203,7 +204,10 @@
"tauri": {
"path": "./core/tauri",
"manager": "rust",
"dependencies": ["api", "tauri-api", "tauri-macros", "tauri-updater"]
"dependencies": [
"api",
"tauri-macros"
]
}
}
}
}
2 changes: 1 addition & 1 deletion .changes/correct-http-api-types.md
@@ -1,5 +1,5 @@
---
"tauri-api": patch
"tauri": patch
---

Align HTTP API types with the [documentation](https://tauri.studio/en/docs/api/js#http).
2 changes: 1 addition & 1 deletion .changes/dialog-api.md
@@ -1,5 +1,5 @@
---
"tauri-api": minor
"tauri": minor
---

The `message` and `ask` dialogs now use `tinyfiledialogs-rs` instead of `tauri-dialog-rs`.
1 change: 0 additions & 1 deletion .changes/event-unlisten-js.md
@@ -1,5 +1,4 @@
---
"tauri-api": minor
"tauri": minor
---

Expand Down
2 changes: 1 addition & 1 deletion .changes/file-dialog-refactor.md
@@ -1,5 +1,5 @@
---
"tauri-api": minor
"tauri": minor
"api": minor
---

Expand Down
1 change: 0 additions & 1 deletion .changes/http-api-refactor.md
@@ -1,6 +1,5 @@
---
"api": minor
"tauri-api": minor
"tauri": minor
---

Expand Down
1 change: 0 additions & 1 deletion .changes/js-app-metadata.md
@@ -1,5 +1,4 @@
---
"tauri-api": minor
"tauri": minor
---

Expand Down
2 changes: 1 addition & 1 deletion .changes/js-event-once.md
@@ -1,5 +1,5 @@
---
"tauri-api": minor
"tauri": minor
---

The event listener `once` kind was moved to a dedicated function.
2 changes: 1 addition & 1 deletion .changes/json-parse-rpc.md
@@ -1,5 +1,5 @@
---
"tauri-api": patch
"tauri": patch
---

Use ``JSON.parse(String.raw`{arg}`)`` for communicating serialized JSON objects and arrays < 1 GB to the Webview from Rust.
Expand Down
2 changes: 0 additions & 2 deletions .changes/license.md
Expand Up @@ -4,9 +4,7 @@
"tauri-cli": patch
"tauri.js": patch
"tauri-utils": patch
"tauri-api": patch
"tauri-macros": patch
"tauri-updater": patch
"tauri-build": patch
"tauri-codegen": patch
"tauri": patch
Expand Down
2 changes: 0 additions & 2 deletions .changes/readme.md
Expand Up @@ -15,9 +15,7 @@ Use the following format:
"tauri-cli": patch
"tauri.js": patch
"tauri-utils": patch
"tauri-api": patch
"tauri-macros": patch
"tauri-updater": patch
"tauri-build": patch
"tauri-codegen": patch
"tauri": patch
Expand Down
1 change: 0 additions & 1 deletion .changes/shortcut-api.md
@@ -1,6 +1,5 @@
---
"api": minor
"tauri-api": minor
"tauri": minor
---

Expand Down
1 change: 0 additions & 1 deletion .changes/updater-alpha.md
@@ -1,5 +1,4 @@
---
"tauri-updater": minor
"tauri-cli": minor
"tauri-bundler": minor
"tauri": minor
Expand Down
6 changes: 1 addition & 5 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Expand Up @@ -19,8 +19,4 @@

/cli/tauri.js/ @tauri-apps/js-cli

/tauri-update/ @tauri-apps/core

/tauri-api/ @tauri-apps/core

/tauri/ @tauri-apps/core
/core/** @tauri-apps/core
1 change: 0 additions & 1 deletion .github/CONTRIBUTING.md
Expand Up @@ -53,7 +53,6 @@ Some Tauri packages will be automatically built when running one of the examples
### Packages Overview

- The JS API (`/api`) contains JS bindings to the builtin Rust functions in the Rust API.
- The Rust API (`/core/tauri-api`) contains the Rust functions used by the JS API.
- Tauri.js (`/cli/tauri.js`) is the primary CLI for creating and developing Tauri apps.
- The Rust CLI (`/cli/core`) is a new version of the CLI that will replace Tauri.js, but now it only supports build and dev commands. Tauri.js will automatically use the Rust CLI for these commands.
- Tauri Bundler (`/cli/tauri-bundler`) is used by the Rust CLI to package executables into installers.
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/artifacts-updater.yml
Expand Up @@ -8,7 +8,6 @@ on:
paths:
- '.github/workflows/artifacts-updater.yml'
- 'core/tauri/**'
- 'core/tauri-updater/**'
- 'cli/core/**'
- 'cli/tauri-bundler/**'
- 'examples/updater/**'
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/covector-version-or-publish.yml
Expand Up @@ -112,10 +112,6 @@ jobs:
registryName: tauri-bundler
- name: tauri-utils
registryName: tauri-utils
- name: tauri-api
registryName: tauri-api
- name: tauri-updater
registryName: tauri-updater
- name: tauri-core
registryName: tauri

Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Expand Up @@ -2,7 +2,6 @@
members = [
# core
"core/tauri",
"core/tauri-api",
"core/tauri-macros",
"core/tauri-utils",
"core/tauri-build",
Expand Down
2 changes: 0 additions & 2 deletions README.md
Expand Up @@ -24,10 +24,8 @@ Tauri Apps
|-----------|---------|------|-----|-----|-----|
| [**tauri.js CLI**](https://github.com/tauri-apps/tauri/tree/dev/cli/tauri.js) | create, develop and build apps | [![](https://img.shields.io/npm/v/tauri.svg)](https://www.npmjs.com/package/tauri) ||||
| [**tauri core**](https://github.com/tauri-apps/tauri/tree/dev/tauri) | binding to the low level WEBVIEW | [![](https://img.shields.io/crates/v/tauri.svg)](https://crates.io/crates/tauri)||||
| [**tauri api**](https://github.com/tauri-apps/tauri/tree/dev/tauri-api) | interface with the underlying OS | [![](https://img.shields.io/crates/v/tauri-api.svg)](https://crates.io/crates/tauri-api) ||||
| [**tauri bundler**](https://github.com/tauri-apps/tauri/tree/dev/cli/tauri-bundler) | manufacture the final binaries | [![](https://img.shields.io/crates/v/tauri-bundler.svg)](https://crates.io/crates/tauri-bundler) ||||
| [**tauri utils**](https://github.com/tauri-apps/tauri/tree/dev/tauri-utils) | common tools for tauri| [![](https://img.shields.io/crates/v/tauri-utils.svg)](https://crates.io/crates/tauri-utils) ||||
| [**tauri updater**](https://github.com/tauri-apps/tauri/tree/dev/tauri-updater) [WIP] | update the userland app | [![](https://img.shields.io/crates/v/tauri-updater.svg)](https://crates.io/crates/tauri-updater) | | | |


## Introduction
Expand Down
1 change: 0 additions & 1 deletion core/tauri-api/.license_template

This file was deleted.

48 changes: 0 additions & 48 deletions core/tauri-api/CHANGELOG.md

This file was deleted.

54 changes: 0 additions & 54 deletions core/tauri-api/Cargo.toml

This file was deleted.

2 changes: 1 addition & 1 deletion core/tauri-build/src/codegen/context.rs
Expand Up @@ -98,7 +98,7 @@ impl CodegenContext {
config_parent,
// it's very hard to have a build script for unit tests, so assume this is always called from
// outside the tauri crate, making the ::tauri root valid.
context_path: quote::quote!(::tauri::Context),
root: quote::quote!(::tauri::Context),
})?;

// get the full output file path
Expand Down
2 changes: 1 addition & 1 deletion core/tauri-codegen/Cargo.toml
Expand Up @@ -15,7 +15,7 @@ proc-macro2 = "1"
quote = "1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tauri-api = { path = "../tauri-api", features = ["build"] }
tauri-utils = { path = "../tauri-utils", features = ["build"] }
thiserror = "1"
walkdir = "2"
zstd = "0.7"
10 changes: 5 additions & 5 deletions core/tauri-codegen/src/context.rs
Expand Up @@ -6,14 +6,14 @@ use crate::embedded_assets::{EmbeddedAssets, EmbeddedAssetsError};
use proc_macro2::TokenStream;
use quote::quote;
use std::path::PathBuf;
use tauri_api::config::Config;
use tauri_utils::config::Config;

/// Necessary data needed by [`context_codegen`] to generate code for a Tauri application context.
pub struct ContextData {
pub dev: bool,
pub config: Config,
pub config_parent: PathBuf,
pub context_path: TokenStream,
pub root: TokenStream,
}

/// Build a `tauri::Context` for including in application code.
Expand All @@ -22,7 +22,7 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
dev,
config,
config_parent,
context_path,
root,
} = data;
let assets_path = if dev {
// if dev_path is a dev server, we don't have any assets to embed
Expand Down Expand Up @@ -51,11 +51,11 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
};

// double braces are purposeful to force the code into a block expression
Ok(quote!(#context_path {
Ok(quote!(#root::Context {
config: #config,
assets: #assets,
default_window_icon: #default_window_icon,
package_info: ::tauri::api::PackageInfo {
package_info: #root::api::PackageInfo {
name: env!("CARGO_PKG_NAME"),
version: env!("CARGO_PKG_VERSION")
}
Expand Down

0 comments on commit a6def70

Please sign in to comment.