Skip to content
This repository was archived by the owner on Aug 26, 2021. It is now read-only.

Commit 71116d3

Browse files
author
Adam A. Zerella
committed
Added FileExists functions to helper.js
1 parent 226a048 commit 71116d3

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

scripts/generate-readme/src/helper.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const IsDirectory = ( source ) => {
1111
return Fs.lstatSync( source ).isDirectory();
1212
}
1313

14-
1514
/**
1615
* GetFolder - Gets all the folders inside a location
1716
*
@@ -26,4 +25,22 @@ const GetFolders = async ( folderLocation ) => {
2625
}
2726

2827

29-
module.exports.GetFolders = GetFolders;
28+
/**
29+
* Return true if a component folder location has a `jquery.js` file.
30+
*
31+
* @param {string} folderLocation - Component folder location.
32+
*/
33+
const FileExists = async ( fileLocation ) => {
34+
try {
35+
return ( await Fsp.stat( fileLocation ) ).isFile()
36+
}
37+
catch( error ) {
38+
console.error( error );
39+
}
40+
return false;
41+
}
42+
43+
44+
45+
module.exports.GetFolders = GetFolders;
46+
module.exports.FileExists = FileExists;

0 commit comments

Comments
 (0)