mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
refactor: simplify project file lookup
This commit is contained in:
@ -19,7 +19,15 @@ interface IPackageJson {
|
||||
* Utility function to get the contents of the project package.json
|
||||
*/
|
||||
export function getPackageJson() {
|
||||
const packageJsonPath = resolve(getProjectRootPath(), 'package.json');
|
||||
|
||||
return require(packageJsonPath) as IPackageJson;
|
||||
return require(
|
||||
getProjectFilePath('package.json')
|
||||
) as IPackageJson;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility to get project files relative to the project root.
|
||||
* @param filePath path to get
|
||||
*/
|
||||
export function getProjectFilePath(filePath: string): string {
|
||||
return resolve(getProjectRootPath(), filePath);
|
||||
}
|
||||
|
Reference in New Issue
Block a user