@docusaurus/core 0.0.0-5585 → 0.0.0-5588

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/beforeCli.mjs +25 -9
  2. package/package.json +10 -10
package/bin/beforeCli.mjs CHANGED
@@ -10,6 +10,7 @@
10
10
  import fs from 'fs-extra';
11
11
  import path from 'path';
12
12
  import {createRequire} from 'module';
13
+ import shell from 'shelljs';
13
14
  import logger from '@docusaurus/logger';
14
15
  import semver from 'semver';
15
16
  import updateNotifier from 'update-notifier';
@@ -105,18 +106,33 @@ export default async function beforeCli() {
105
106
  .map((p) => p.concat('@latest'))
106
107
  .join(' ');
107
108
 
109
+ const getYarnVersion = async () => {
110
+ if (!(await fs.pathExists(path.resolve('yarn.lock')))) {
111
+ return undefined;
112
+ }
113
+
114
+ const yarnVersionResult = shell.exec('yarn --version', {silent: true});
115
+ if (yarnVersionResult?.code === 0) {
116
+ const majorVersion = parseInt(
117
+ yarnVersionResult.stdout?.trim().split('.')[0] ?? '',
118
+ 10,
119
+ );
120
+ if (!Number.isNaN(majorVersion)) {
121
+ return majorVersion;
122
+ }
123
+ }
124
+
125
+ return undefined;
126
+ };
127
+
108
128
  const getUpgradeCommand = async () => {
109
- const isYarnUsed = await fs.pathExists(path.resolve('yarn.lock'));
110
- if (!isYarnUsed) {
129
+ const yarnVersion = await getYarnVersion();
130
+ if (!yarnVersion) {
111
131
  return `npm i ${siteDocusaurusPackagesForUpdate}`;
112
132
  }
113
-
114
- const isYarnClassicUsed = !(await fs.pathExists(
115
- path.resolve('.yarnrc.yml'),
116
- ));
117
- return isYarnClassicUsed
118
- ? `yarn upgrade ${siteDocusaurusPackagesForUpdate}`
119
- : `yarn up ${siteDocusaurusPackagesForUpdate}`;
133
+ return yarnVersion >= 2
134
+ ? `yarn up ${siteDocusaurusPackagesForUpdate}`
135
+ : `yarn upgrade ${siteDocusaurusPackagesForUpdate}`;
120
136
  };
121
137
 
122
138
  /** @type {import('boxen').Options} */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@docusaurus/core",
3
3
  "description": "Easy to Maintain Open Source Documentation Websites",
4
- "version": "0.0.0-5585",
4
+ "version": "0.0.0-5588",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -43,13 +43,13 @@
43
43
  "@babel/runtime": "^7.21.0",
44
44
  "@babel/runtime-corejs3": "^7.21.0",
45
45
  "@babel/traverse": "^7.21.2",
46
- "@docusaurus/cssnano-preset": "0.0.0-5585",
47
- "@docusaurus/logger": "0.0.0-5585",
48
- "@docusaurus/mdx-loader": "0.0.0-5585",
46
+ "@docusaurus/cssnano-preset": "0.0.0-5588",
47
+ "@docusaurus/logger": "0.0.0-5588",
48
+ "@docusaurus/mdx-loader": "0.0.0-5588",
49
49
  "@docusaurus/react-loadable": "5.5.2",
50
- "@docusaurus/utils": "0.0.0-5585",
51
- "@docusaurus/utils-common": "0.0.0-5585",
52
- "@docusaurus/utils-validation": "0.0.0-5585",
50
+ "@docusaurus/utils": "0.0.0-5588",
51
+ "@docusaurus/utils-common": "0.0.0-5588",
52
+ "@docusaurus/utils-validation": "0.0.0-5588",
53
53
  "@slorber/static-site-generator-webpack-plugin": "^4.0.7",
54
54
  "@svgr/webpack": "^6.5.1",
55
55
  "autoprefixer": "^10.4.13",
@@ -106,8 +106,8 @@
106
106
  "webpackbar": "^5.0.2"
107
107
  },
108
108
  "devDependencies": {
109
- "@docusaurus/module-type-aliases": "0.0.0-5585",
110
- "@docusaurus/types": "0.0.0-5585",
109
+ "@docusaurus/module-type-aliases": "0.0.0-5588",
110
+ "@docusaurus/types": "0.0.0-5588",
111
111
  "@types/detect-port": "^1.3.2",
112
112
  "@types/react-dom": "^18.0.11",
113
113
  "@types/react-router-config": "^5.0.6",
@@ -127,5 +127,5 @@
127
127
  "engines": {
128
128
  "node": ">=16.14"
129
129
  },
130
- "gitHead": "41eb1a3ac96d57512aad78977fb2a07703283bee"
130
+ "gitHead": "cbf5cbb2c0296c74a1d612685e941f7af6dc804f"
131
131
  }