Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use installing package manager in README #7687

Merged
merged 3 commits into from Oct 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions packages/react-scripts/scripts/init.js
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