mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
chore(cli): remove unused code (#1267)
This commit is contained in:
committed by
GitHub
parent
4963d00e5d
commit
f656799705
@@ -10,13 +10,7 @@ use crate::helpers::{
|
||||
manifest::rewrite_manifest,
|
||||
Logger, TauriScript,
|
||||
};
|
||||
use std::{
|
||||
env::{set_current_dir, set_var},
|
||||
fs::File,
|
||||
io::Write,
|
||||
path::PathBuf,
|
||||
process::Command,
|
||||
};
|
||||
use std::{env::set_current_dir, fs::File, io::Write, path::PathBuf, process::Command};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Build {
|
||||
@@ -54,8 +48,6 @@ impl Build {
|
||||
pub fn run(self) -> crate::Result<()> {
|
||||
let logger = Logger::new("tauri:build");
|
||||
let config = get_config(self.config.as_deref())?;
|
||||
let config_guard = config.lock().unwrap();
|
||||
let config_ = config_guard.as_ref().unwrap();
|
||||
|
||||
let mut settings_builder = SettingsBuilder::new().features(vec!["embedded-server".to_string()]);
|
||||
if !self.debug {
|
||||
@@ -87,10 +79,7 @@ impl Build {
|
||||
|
||||
let tauri_path = tauri_dir();
|
||||
set_current_dir(&tauri_path)?;
|
||||
set_var("TAURI_DIR", &tauri_path);
|
||||
set_var("TAURI_DIST_DIR", tauri_path.join(&config_.build.dist_dir));
|
||||
|
||||
drop(config_guard);
|
||||
rewrite_manifest(config.clone())?;
|
||||
|
||||
let config_guard = config.lock().unwrap();
|
||||
|
||||
@@ -10,7 +10,7 @@ use once_cell::sync::OnceCell;
|
||||
use shared_child::SharedChild;
|
||||
|
||||
use std::{
|
||||
env::{set_current_dir, set_var},
|
||||
env::set_current_dir,
|
||||
ffi::OsStr,
|
||||
fs::{create_dir_all, File},
|
||||
io::Write,
|
||||
@@ -100,27 +100,6 @@ impl Dev {
|
||||
.dev_path
|
||||
.to_string();
|
||||
|
||||
let dev_path = if dev_path.starts_with("http") {
|
||||
dev_path
|
||||
} else {
|
||||
let absolute_dev_path = tauri_dir()
|
||||
.join(&config.lock().unwrap().as_ref().unwrap().build.dev_path)
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
(*config.lock().unwrap()).as_mut().unwrap().build.dev_path = absolute_dev_path.to_string();
|
||||
absolute_dev_path
|
||||
};
|
||||
|
||||
set_var("TAURI_DIR", &tauri_path);
|
||||
set_var(
|
||||
"TAURI_DIST_DIR",
|
||||
tauri_path.join(&config.lock().unwrap().as_ref().unwrap().build.dist_dir),
|
||||
);
|
||||
set_var(
|
||||
"TAURI_CONFIG",
|
||||
serde_json::to_string(&*config.lock().unwrap())?,
|
||||
);
|
||||
|
||||
rewrite_manifest(config.clone())?;
|
||||
|
||||
// __tauri.js
|
||||
@@ -175,9 +154,7 @@ impl Dev {
|
||||
if let Some(event_path) = event_path {
|
||||
if event_path.file_name() == Some(OsStr::new("tauri.conf.json")) {
|
||||
reload_config(merge_config.as_deref())?;
|
||||
(*config.lock().unwrap()).as_mut().unwrap().build.dev_path = dev_path.to_string();
|
||||
rewrite_manifest(config.clone())?;
|
||||
set_var("TAURI_CONFIG", serde_json::to_string(&*config)?);
|
||||
} else {
|
||||
// When tauri.conf.json is changed, rewrite_manifest will be called
|
||||
// which will trigger the watcher again
|
||||
|
||||
@@ -7,6 +7,7 @@ mod config_definition;
|
||||
pub use config_definition::*;
|
||||
|
||||
use std::{
|
||||
env::set_var,
|
||||
fs::File,
|
||||
io::BufReader,
|
||||
process::exit,
|
||||
@@ -57,6 +58,7 @@ fn get_internal(merge_config: Option<&str>, reload: bool) -> crate::Result<Confi
|
||||
}
|
||||
|
||||
let config = serde_json::from_value(config)?;
|
||||
set_var("TAURI_CONFIG", serde_json::to_string(&config)?);
|
||||
*config_handle().lock().unwrap() = Some(config);
|
||||
|
||||
Ok(config_handle().clone())
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
"build": {
|
||||
"distDir": "../public",
|
||||
"devPath": "http://localhost:5000",
|
||||
"withGlobalTauri": true
|
||||
"beforeDevCommand": "yarn dev",
|
||||
"beforeBuildCommand": "yarn build"
|
||||
},
|
||||
"tauri": {
|
||||
"cli": {
|
||||
|
||||
Reference in New Issue
Block a user