mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +02:00
fix(core): Correct yarn upgrade command for yarn 2.x (#8908)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
d220f481a7
commit
41a52161fd
1 changed files with 15 additions and 5 deletions
|
@ -104,10 +104,20 @@ export default async function beforeCli() {
|
||||||
.filter((p) => p.startsWith('@docusaurus'))
|
.filter((p) => p.startsWith('@docusaurus'))
|
||||||
.map((p) => p.concat('@latest'))
|
.map((p) => p.concat('@latest'))
|
||||||
.join(' ');
|
.join(' ');
|
||||||
const isYarnUsed = await fs.pathExists(path.resolve('yarn.lock'));
|
|
||||||
const upgradeCommand = isYarnUsed
|
const getUpgradeCommand = async () => {
|
||||||
? `yarn upgrade ${siteDocusaurusPackagesForUpdate}`
|
const isYarnUsed = await fs.pathExists(path.resolve('yarn.lock'));
|
||||||
: `npm i ${siteDocusaurusPackagesForUpdate}`;
|
if (!isYarnUsed) {
|
||||||
|
return `npm i ${siteDocusaurusPackagesForUpdate}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const isYarnClassicUsed = !(await fs.pathExists(
|
||||||
|
path.resolve('.yarnrc.yml'),
|
||||||
|
));
|
||||||
|
return isYarnClassicUsed
|
||||||
|
? `yarn upgrade ${siteDocusaurusPackagesForUpdate}`
|
||||||
|
: `yarn up ${siteDocusaurusPackagesForUpdate}`;
|
||||||
|
};
|
||||||
|
|
||||||
/** @type {import('boxen').Options} */
|
/** @type {import('boxen').Options} */
|
||||||
const boxenOptions = {
|
const boxenOptions = {
|
||||||
|
@ -124,7 +134,7 @@ export default async function beforeCli() {
|
||||||
)} → ${logger.green(`${notifier.update.latest}`)}
|
)} → ${logger.green(`${notifier.update.latest}`)}
|
||||||
|
|
||||||
To upgrade Docusaurus packages with the latest version, run the following command:
|
To upgrade Docusaurus packages with the latest version, run the following command:
|
||||||
${logger.code(upgradeCommand)}`,
|
${logger.code(await getUpgradeCommand())}`,
|
||||||
boxenOptions,
|
boxenOptions,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue