File tree 1 file changed +15
-5
lines changed
1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -104,10 +104,20 @@ export default async function beforeCli() {
104
104
. filter ( ( p ) => p . startsWith ( '@docusaurus' ) )
105
105
. map ( ( p ) => p . concat ( '@latest' ) )
106
106
. join ( ' ' ) ;
107
- const isYarnUsed = await fs . pathExists ( path . resolve ( 'yarn.lock' ) ) ;
108
- const upgradeCommand = isYarnUsed
109
- ? `yarn upgrade ${ siteDocusaurusPackagesForUpdate } `
110
- : `npm i ${ siteDocusaurusPackagesForUpdate } ` ;
107
+
108
+ const getUpgradeCommand = async ( ) => {
109
+ const isYarnUsed = await fs . pathExists ( path . resolve ( 'yarn.lock' ) ) ;
110
+ if ( ! isYarnUsed ) {
111
+ return `npm i ${ siteDocusaurusPackagesForUpdate } ` ;
112
+ }
113
+
114
+ const isYarnClassicUsed = ! ( await fs . pathExists (
115
+ path . resolve ( '.yarnrc.yml' ) ,
116
+ ) ) ;
117
+ return isYarnClassicUsed
118
+ ? `yarn upgrade ${ siteDocusaurusPackagesForUpdate } `
119
+ : `yarn up ${ siteDocusaurusPackagesForUpdate } ` ;
120
+ } ;
111
121
112
122
/** @type {import('boxen').Options } */
113
123
const boxenOptions = {
@@ -124,7 +134,7 @@ export default async function beforeCli() {
124
134
) } → ${ logger . green ( `${ notifier . update . latest } ` ) }
125
135
126
136
To upgrade Docusaurus packages with the latest version, run the following command:
127
- ${ logger . code ( upgradeCommand ) } ` ,
137
+ ${ logger . code ( await getUpgradeCommand ( ) ) } ` ,
128
138
boxenOptions ,
129
139
) ;
130
140
You can’t perform that action at this time.
0 commit comments