Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions packages/react-scripts/scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,24 @@ module.exports = function(
return;
}

// modifies README.md commands based on user used package manager.
if (useYarn) {
try {
const readme = fs.readFileSync(path.join(appPath, 'README.md'), 'utf8');
fs.writeFileSync(
path.join(appPath, 'README.md'),
readme
.replace(/npm start/g, 'yarn start')
.replace(/npm test/g, 'yarn test')
.replace(/npm run build/g, 'yarn build')
.replace(/npm run eject/g, 'yarn eject'),
'utf8'
);
} catch (err) {
// Silencing the error. As it fall backs to using default npm commands.
}
}

// Rename gitignore after the fact to prevent npm from renaming it to .npmignore
// See: https://github.com/npm/npm/issues/1862
try {
Expand Down