nestrs-cli-rs 0.1.0

Rust port of the Nest CLI for the nestrs organization.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Upstream source: `../nest-cli/lib/utils/get-default-tsconfig-path.ts`.

use std::path::Path;

pub const TSCONFIG_BUILD_JSON: &str = "tsconfig.build.json";
pub const TSCONFIG_JSON: &str = "tsconfig.json";

pub fn get_default_tsconfig_path() -> &'static str {
    get_default_tsconfig_path_in(".")
}

pub fn get_default_tsconfig_path_in(directory: impl AsRef<Path>) -> &'static str {
    if directory.as_ref().join(TSCONFIG_BUILD_JSON).exists() {
        TSCONFIG_BUILD_JSON
    } else {
        TSCONFIG_JSON
    }
}