Skip to content

Commit

Permalink
🚚 - Rename bsconfig -> config
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandpeelen committed Nov 18, 2024
1 parent 29d1e4e commit b66376a
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 108 deletions.
6 changes: 3 additions & 3 deletions src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ pub struct CompilerArgs {
pub fn get_compiler_args(path: &str, rescript_version: Option<String>, bsc_path: Option<String>) -> String {
let filename = &helpers::get_abs_path(path);
let package_root = helpers::get_abs_path(
&helpers::get_nearest_bsconfig(&std::path::PathBuf::from(path)).expect("Couldn't find package root"),
&helpers::get_nearest_config(&std::path::PathBuf::from(path)).expect("Couldn't find package root"),
);
let workspace_root = get_workspace_root(&package_root).map(|p| helpers::get_abs_path(&p));
let root_rescript_config =
packages::read_bsconfig(&workspace_root.to_owned().unwrap_or(package_root.to_owned()));
let rescript_config = packages::read_bsconfig(&package_root);
packages::read_config(&workspace_root.to_owned().unwrap_or(package_root.to_owned()));
let rescript_config = packages::read_config(&package_root);
let rescript_version = if let Some(rescript_version) = rescript_version {
rescript_version
} else {
Expand Down
1 change: 1 addition & 0 deletions src/build/build_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ impl BuildState {
deps_initialized: false,
}
}

pub fn insert_module(&mut self, module_name: &str, module: Module) {
self.modules.insert(module_name.to_owned(), module);
self.module_names.insert(module_name.to_owned());
Expand Down
2 changes: 1 addition & 1 deletion src/build/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub fn clean_mjs_files(build_state: &BuildState) {
.join(&source_file.implementation.path)
.to_string_lossy()
.to_string(),
root_package.bsconfig.get_suffix(),
root_package.config.get_suffix(),
))
}
_ => None,
Expand Down
18 changes: 9 additions & 9 deletions src/build/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod dependency_cycle;
use super::build_types::*;
use super::logs;
use super::packages;
use crate::bsconfig;
use crate::config;
use crate::helpers;
use ahash::{AHashMap, AHashSet};
use console::style;
Expand Down Expand Up @@ -359,8 +359,8 @@ pub fn compile(
}

pub fn compiler_args(
config: &bsconfig::Config,
root_config: &bsconfig::Config,
config: &config::Config,
root_config: &config::Config,
ast_path: &str,
version: &str,
file_path: &str,
Expand All @@ -374,11 +374,11 @@ pub fn compiler_args(
) -> Vec<String> {
let normal_deps = config.bs_dependencies.as_ref().unwrap_or(&vec![]).to_owned();

let bsc_flags = bsconfig::flatten_flags(&config.bsc_flags);
let bsc_flags = config::flatten_flags(&config.bsc_flags);
// don't compile dev-deps yet
// let dev_deps = source
// .package
// .bsconfig
// .config
// .bs_dev_dependencies
// .as_ref()
// .unwrap_or(&vec![])
Expand Down Expand Up @@ -442,10 +442,10 @@ pub fn compiler_args(
};

let warn_error = match warnings.error {
Some(bsconfig::Error::Catchall(true)) => {
Some(config::Error::Catchall(true)) => {
vec!["-warn-error".to_string(), "A".to_string()]
}
Some(bsconfig::Error::Qualified(errors)) => {
Some(config::Error::Qualified(errors)) => {
vec!["-warn-error".to_string(), errors.to_string()]
}
_ => vec![],
Expand Down Expand Up @@ -532,8 +532,8 @@ fn compile_file(
let module_name = helpers::file_path_to_module_name(implementation_file_path, &package.namespace);
let has_interface = module.get_interface().is_some();
let to_mjs_args = compiler_args(
&package.bsconfig,
&root_package.bsconfig,
&package.config,
&root_package.config,
ast_path,
version,
implementation_file_path,
Expand Down
Loading

0 comments on commit b66376a

Please sign in to comment.