diff --git a/lib/path-utils.js b/lib/path-utils.js index 3af9f6e..de1d6a5 100644 --- a/lib/path-utils.js +++ b/lib/path-utils.js @@ -20,6 +20,15 @@ export function posixifyPathNormalized(givenPath) { return posixifyPath(givenPath).replace(/[/\\]$/, "") } +/** + * Parse and globy the `.gitingore` file that exists in a directry + * @param {string} gitIgnoreDirectory The given directory that has the `.gitignore` file + * @returns {Promise>} an array of glob patterns + */ +export async function globifyGitIgnoreFile(gitIgnoreDirectory) { + return globifyGitIgnore(await readFile(path.join(gitIgnoreDirectory, ".gitignore"), "utf-8"), gitIgnoreDirectory) +} + /** * Read `.gitingore` file from a directry * @param {string} gitIgnoreContent the content of the gitignore file