Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
163 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
|
||
/** | ||
* @func resolveFileInPackage | ||
* Resolves a file inside a package | ||
*/ | ||
const resolveFileInPackage = (packageName, ...pathElements) => { | ||
return require.resolve(path.join(packageName, ...pathElements)); | ||
}; | ||
|
||
/** | ||
* @func resolveDirInPackage | ||
* Resolves a file inside a package | ||
*/ | ||
const resolveDirInPackage = (packageName, ...pathElements) => { | ||
return path.dirname(resolveFileInPackage(packageName, ...pathElements)); | ||
}; | ||
|
||
/** | ||
* @func resolvePackageFolder | ||
* Resolves the location of a package on disc | ||
*/ | ||
const resolvePackageFolder = packageName => { | ||
return path.dirname(resolveFileInPackage(packageName, 'package.json')); | ||
}; | ||
|
||
module.exports = { | ||
resolveFileInPackage, | ||
resolveDirInPackage, | ||
resolvePackageFolder, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.