export lazy current config

This commit is contained in:
Evan Almloff committed 2023-11-14 15:34:06 -06:00
1 parent 5dc3486c53
commit 06be18a591
22 files changed
+486 -1068

No files matched your search

+1 -1
View File
@@ -88,7 +88,7 @@ impl Autoformat {
///
/// Doesn't do mod-descending, so it will still try to format unreachable files. TODO.
async fn autoformat_project(check: bool) -> Result<()> {
let crate_config = crate::CrateConfig::new(None)?;
let crate_config = dioxus_cli_config::CrateConfig::new(None)?;
let mut files_to_format = vec![];
collect_rs_files(&crate_config.crate_dir, &mut files_to_format);
+1 -1
View File
@@ -14,7 +14,7 @@ pub struct Build {
impl Build {
pub fn build(self, bin: Option<PathBuf>) -> Result<()> {
let mut crate_config = crate::CrateConfig::new(bin)?;
let mut crate_config = dioxus_cli_config::CrateConfig::new(bin)?;
// change the release state.
crate_config.with_release(self.build.release);
+5 -4
View File
@@ -1,4 +1,5 @@
use core::panic;
use dioxus_cli_config::ExecutableType;
use std::{fs::create_dir_all, str::FromStr};
use tauri_bundler::{BundleSettings, PackageSettings, SettingsBuilder};
@@ -62,7 +63,7 @@ impl From<PackageType> for tauri_bundler::PackageType {
impl Bundle {
pub fn bundle(self, bin: Option<PathBuf>) -> Result<()> {
let mut crate_config = crate::CrateConfig::new(bin)?;
let mut crate_config = dioxus_cli_config::CrateConfig::new(bin)?;
// change the release state.
crate_config.with_release(self.build.release);
@@ -83,9 +84,9 @@ impl Bundle {
let package = crate_config.manifest.package.unwrap();
let mut name: PathBuf = match &crate_config.executable {
crate::ExecutableType::Binary(name)
| crate::ExecutableType::Lib(name)
| crate::ExecutableType::Example(name) => name,
ExecutableType::Binary(name)
| ExecutableType::Lib(name)
| ExecutableType::Example(name) => name,
}
.into();
if cfg!(windows) {
+1 -1
View File
@@ -47,7 +47,7 @@ async fn check_file_and_report(path: PathBuf) -> Result<()> {
///
/// Doesn't do mod-descending, so it will still try to check unreachable files. TODO.
async fn check_project_and_report() -> Result<()> {
let crate_config = crate::CrateConfig::new(None)?;
let crate_config = dioxus_cli_config::CrateConfig::new(None)?;
let mut files_to_check = vec![];
collect_rs_files(&crate_config.crate_dir, &mut files_to_check);
+1 -1
View File
@@ -7,7 +7,7 @@ pub struct Clean {}
impl Clean {
pub fn clean(self, bin: Option<PathBuf>) -> Result<()> {
let crate_config = crate::CrateConfig::new(bin)?;
let crate_config = dioxus_cli_config::CrateConfig::new(bin)?;
let output = Command::new("cargo")
.arg("clean")
+4 -1
View File
@@ -50,7 +50,10 @@ impl Config {
log::info!("🚩 Init config file completed.");
}
Config::FormatPrint {} => {
println!("{:#?}", crate::CrateConfig::new(None)?.dioxus_config);
println!(
"{:#?}",
dioxus_cli_config::CrateConfig::new(None)?.dioxus_config
);
}
Config::CustomHtml {} => {
let html_path = crate_root.join("index.html");
+2 -1
View File
@@ -15,9 +15,10 @@ use crate::{
cfg::{ConfigOptsBuild, ConfigOptsServe},
custom_error,
error::Result,
gen_page, server, CrateConfig, Error,
gen_page, server, Error,
};
use clap::{Parser, Subcommand};
use dioxus_cli_config::CrateConfig;
use html_parser::Dom;
use serde::Deserialize;
use std::{
+1 -1
View File
@@ -13,7 +13,7 @@ pub struct Serve {
impl Serve {
pub async fn serve(self, bin: Option<PathBuf>) -> Result<()> {
let mut crate_config = crate::CrateConfig::new(bin)?;
let mut crate_config = dioxus_cli_config::CrateConfig::new(bin)?;
// change the relase state.
crate_config.with_hot_reload(self.serve.hot_reload);