Skip to content

Commit 2516504

Browse files
committed
chore: Minor refactor of getReadmeFile code
1 parent 0c48198 commit 2516504

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/commands/readme.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@ const getReadmeFile = require('../get-readme-file');
1313
module.exports.command = 'readme [input..]';
1414
module.exports.description = 'inject documentation into your README.md';
1515

16-
let defaultReadmeFile = 'README.md';
17-
try {
18-
defaultReadmeFile = getReadmeFile('.');
19-
} catch (err) {
20-
// ignore and use default README.md
21-
}
16+
const defaultReadmeFile = getReadmeFile('.');
2217

2318
/**
2419
* Add yargs parsing for the readme command

src/get-readme-file.js

+2
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ module.exports = function findReadme(dir: string) {
2222
if (readmeFile) {
2323
return path.join(fs.realpathSync(dir), readmeFile);
2424
}
25+
26+
return 'README.md';
2527
};

0 commit comments

Comments
 (0)