File tree Expand file tree Collapse file tree 1 file changed +29
-11
lines changed
packages/react-scripts/scripts Expand file tree Collapse file tree 1 file changed +29
-11
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,24 @@ module.exports = function(
136136 return ;
137137 }
138138
139+ // modifies README.md commands based on user used package manager.
140+ if ( useYarn ) {
141+ try {
142+ const readme = fs . readFileSync ( path . join ( appPath , 'README.md' ) , 'utf8' ) ;
143+ fs . writeFileSync (
144+ path . join ( appPath , 'README.md' ) ,
145+ readme
146+ . replace ( / n p m s t a r t / g, 'yarn start' )
147+ . replace ( / n p m t e s t / g, 'yarn test' )
148+ . replace ( / n p m r u n b u i l d / g, 'yarn build' )
149+ . replace ( / n p m r u n e j e c t / g, 'yarn eject' ) ,
150+ 'utf8'
151+ ) ;
152+ } catch ( err ) {
153+ // Silencing the error. As it fall backs to using default npm commands.
154+ }
155+ }
156+
139157 // Rename gitignore after the fact to prevent npm from renaming it to .npmignore
140158 // See: https://github.com/npm/npm/issues/1862
141159 try {
@@ -205,17 +223,17 @@ module.exports = function(
205223 console . log ( 'Initialized a git repository.' ) ;
206224 }
207225
208- // wptheme intercept -- stop the standard create-react-app init here... wptheme will take over and display the final message.
209- return initWpTheme (
210- appPath ,
211- appName ,
212- verbose ,
213- originalDirectory ,
214- template ,
215- readmeExists ,
216- useTypeScript ,
217- useYarn
218- ) ;
226+ // wptheme intercept -- stop the standard create-react-app init here... wptheme will take over and display the final message.
227+ return initWpTheme (
228+ appPath ,
229+ appName ,
230+ verbose ,
231+ originalDirectory ,
232+ template ,
233+ readmeExists ,
234+ useTypeScript ,
235+ useYarn
236+ ) ;
219237
220238 // Display the most elegant way to cd.
221239 // This needs to handle an undefined originalDirectory for
You can’t perform that action at this time.
0 commit comments