Files
NativeScript/packages/webpack5/src/helpers/config.ts
Igor Randjelovic de5f67f7c8 chore: add JSDocs
2020-12-08 12:07:42 +01:00

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
);
}