@docusaurus/core 0.0.0-4564 → 0.0.0-4568

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/lib/commands/clear.js +21 -9
  2. package/package.json +10 -10
@@ -11,21 +11,33 @@ const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
11
11
  const path_1 = (0, tslib_1.__importDefault)(require("path"));
12
12
  const logger_1 = (0, tslib_1.__importDefault)(require("@docusaurus/logger"));
13
13
  const utils_1 = require("@docusaurus/utils");
14
- async function removePath(fsPath) {
14
+ async function removePath(entry) {
15
+ if (!(await fs_extra_1.default.pathExists(entry.path))) {
16
+ return;
17
+ }
15
18
  try {
16
- fs_extra_1.default.remove(path_1.default.join(fsPath));
17
- logger_1.default.success `Removed the path=${fsPath} directory.`;
19
+ await fs_extra_1.default.remove(entry.path);
20
+ logger_1.default.success `Removed the ${entry.description} at path=${entry.path}.`;
18
21
  }
19
22
  catch (e) {
20
- logger_1.default.error `Could not remove path=${fsPath} directory.
23
+ logger_1.default.error `Could not remove the ${entry.description} at path=${entry.path}.
21
24
  ${e}`;
22
25
  }
23
26
  }
24
27
  async function clear(siteDir) {
25
- return Promise.all([
26
- removePath(path_1.default.join(siteDir, utils_1.GENERATED_FILES_DIR_NAME)),
27
- removePath(path_1.default.join(siteDir, utils_1.DEFAULT_BUILD_DIR_NAME)),
28
- removePath(path_1.default.join(siteDir, 'node_modules', '.cache')),
29
- ]);
28
+ const generatedFolder = {
29
+ path: path_1.default.join(siteDir, utils_1.GENERATED_FILES_DIR_NAME),
30
+ description: 'generated folder',
31
+ };
32
+ const buildFolder = {
33
+ path: path_1.default.join(siteDir, utils_1.DEFAULT_BUILD_DIR_NAME),
34
+ description: 'build output folder',
35
+ };
36
+ // In Yarn PnP, cache is stored in `.yarn/.cache` because n_m doesn't exist
37
+ const cacheFolders = ['node_modules', '.yarn'].map((p) => ({
38
+ path: path_1.default.join(siteDir, p, '.cache'),
39
+ description: 'Webpack persistent cache folder',
40
+ }));
41
+ return Promise.all([generatedFolder, buildFolder, ...cacheFolders].map(removePath));
30
42
  }
31
43
  exports.default = clear;
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-4564",
4
+ "version": "0.0.0-4568",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -41,13 +41,13 @@
41
41
  "@babel/runtime": "^7.16.3",
42
42
  "@babel/runtime-corejs3": "^7.16.3",
43
43
  "@babel/traverse": "^7.16.3",
44
- "@docusaurus/cssnano-preset": "0.0.0-4564",
45
- "@docusaurus/logger": "0.0.0-4564",
46
- "@docusaurus/mdx-loader": "0.0.0-4564",
44
+ "@docusaurus/cssnano-preset": "0.0.0-4568",
45
+ "@docusaurus/logger": "0.0.0-4568",
46
+ "@docusaurus/mdx-loader": "0.0.0-4568",
47
47
  "@docusaurus/react-loadable": "5.5.2",
48
- "@docusaurus/utils": "0.0.0-4564",
49
- "@docusaurus/utils-common": "0.0.0-4564",
50
- "@docusaurus/utils-validation": "0.0.0-4564",
48
+ "@docusaurus/utils": "0.0.0-4568",
49
+ "@docusaurus/utils-common": "0.0.0-4568",
50
+ "@docusaurus/utils-validation": "0.0.0-4568",
51
51
  "@slorber/static-site-generator-webpack-plugin": "^4.0.0",
52
52
  "@svgr/webpack": "^6.0.0",
53
53
  "autoprefixer": "^10.3.5",
@@ -104,8 +104,8 @@
104
104
  "webpackbar": "^5.0.2"
105
105
  },
106
106
  "devDependencies": {
107
- "@docusaurus/module-type-aliases": "0.0.0-4564",
108
- "@docusaurus/types": "0.0.0-4564",
107
+ "@docusaurus/module-type-aliases": "0.0.0-4568",
108
+ "@docusaurus/types": "0.0.0-4568",
109
109
  "@types/copy-webpack-plugin": "^10.1.0",
110
110
  "@types/detect-port": "^1.3.0",
111
111
  "@types/mini-css-extract-plugin": "^2.5.1",
@@ -127,5 +127,5 @@
127
127
  "engines": {
128
128
  "node": ">=14"
129
129
  },
130
- "gitHead": "b1bfcd51a03aad7a8e55c55802fa62f79606b071"
130
+ "gitHead": "076db4b066be58198eab7965c1a68eea66c17571"
131
131
  }