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
1 parent
f70961d
commit 0c48198
Showing
4 changed files
with
29 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* @flow */ | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
module.exports = function findReadme(dir: string) { | ||
const readmeFilenames = [ | ||
'README', | ||
'README.markdown', | ||
'README.md', | ||
'README.txt', | ||
'Readme.md', | ||
'readme.markdown', | ||
'readme.md', | ||
'readme.txt' | ||
]; | ||
|
||
const readmeFile = fs.readdirSync(dir).find(function(filename) { | ||
return readmeFilenames.indexOf(filename) >= 0; | ||
}); | ||
|
||
if (readmeFile) { | ||
return path.join(fs.realpathSync(dir), readmeFile); | ||
} | ||
}; |
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