mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
26 lines
596 B
TypeScript
26 lines
596 B
TypeScript
import { env } from '../index';
|
|
import { error } from './log';
|
|
|
|
function getCLILib() {
|
|
if (!env.nativescriptLibPath) {
|
|
throw error(`
|
|
Cannot find NativeScript CLI path. Make sure --env.nativescriptLibPath is passed
|
|
`);
|
|
}
|
|
|
|
return require(env.nativescriptLibPath);
|
|
}
|
|
|
|
/**
|
|
* Utility to get a value from the nativescript.config.ts file.
|
|
*
|
|
* @param {string} key The key to get from the config. Supports dot-notation.
|
|
*/
|
|
export function getValue<T = any>(key: string): T {
|
|
const lib = getCLILib();
|
|
|
|
return (lib.projectConfigService as { getValue(key: string): T }).getValue(
|
|
key
|
|
);
|
|
}
|