cli/lib/utils/get_default_tsconfig_path.rs
1//! Upstream source: `../nest-cli/lib/utils/get-default-tsconfig-path.ts`.
2
3use std::path::Path;
4
5pub const TSCONFIG_BUILD_JSON: &str = "tsconfig.build.json";
6pub const TSCONFIG_JSON: &str = "tsconfig.json";
7
8pub fn get_default_tsconfig_path() -> &'static str {
9 get_default_tsconfig_path_in(".")
10}
11
12pub fn get_default_tsconfig_path_in(directory: impl AsRef<Path>) -> &'static str {
13 if directory.as_ref().join(TSCONFIG_BUILD_JSON).exists() {
14 TSCONFIG_BUILD_JSON
15 } else {
16 TSCONFIG_JSON
17 }
18}