@docusaurus/core 0.0.0-4937 → 0.0.0-4940

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/build.js +14 -5
  2. package/package.json +10 -10
@@ -88,7 +88,7 @@ async function buildLocale({ siteDir, locale, cliOptions, forceTerminate, isLast
88
88
  localizePath: cliOptions.locale ? false : undefined,
89
89
  });
90
90
  // Apply user webpack config.
91
- const { outDir, generatedFilesDir, plugins, siteConfig: { baseUrl, onBrokenLinks, staticDirectories }, routes, } = props;
91
+ const { outDir, generatedFilesDir, plugins, siteConfig: { baseUrl, onBrokenLinks, staticDirectories: staticDirectoriesOption, }, routes, } = props;
92
92
  const clientManifestPath = path_1.default.join(generatedFilesDir, 'client-manifest.json');
93
93
  let clientConfig = (0, webpack_merge_1.default)(await (0, client_1.default)(props, cliOptions.minify), {
94
94
  plugins: [
@@ -114,14 +114,23 @@ async function buildLocale({ siteDir, locale, cliOptions, forceTerminate, isLast
114
114
  headTags[staticPagePath] = tags;
115
115
  },
116
116
  });
117
+ // The staticDirectories option can contain empty directories, or non-existent
118
+ // directories (e.g. user deleted `static`). Instead of issuing an error, we
119
+ // just silently filter them out, because user could have never configured it
120
+ // in the first place (the default option should always "work").
121
+ const staticDirectories = (await Promise.all(staticDirectoriesOption.map(async (dir) => {
122
+ const staticDir = path_1.default.resolve(siteDir, dir);
123
+ if ((await fs_extra_1.default.pathExists(staticDir)) &&
124
+ (await fs_extra_1.default.readdir(staticDir)).length > 0) {
125
+ return staticDir;
126
+ }
127
+ return '';
128
+ }))).filter(Boolean);
117
129
  if (staticDirectories.length > 0) {
118
- await Promise.all(staticDirectories.map((dir) => fs_extra_1.default.ensureDir(dir)));
119
130
  serverConfig = (0, webpack_merge_1.default)(serverConfig, {
120
131
  plugins: [
121
132
  new copy_webpack_plugin_1.default({
122
- patterns: staticDirectories
123
- .map((dir) => path_1.default.resolve(siteDir, dir))
124
- .map((dir) => ({ from: dir, to: outDir })),
133
+ patterns: staticDirectories.map((dir) => ({ from: dir, to: outDir })),
125
134
  }),
126
135
  ],
127
136
  });
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-4937",
4
+ "version": "0.0.0-4940",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -41,13 +41,13 @@
41
41
  "@babel/runtime": "^7.17.9",
42
42
  "@babel/runtime-corejs3": "^7.17.9",
43
43
  "@babel/traverse": "^7.17.10",
44
- "@docusaurus/cssnano-preset": "0.0.0-4937",
45
- "@docusaurus/logger": "0.0.0-4937",
46
- "@docusaurus/mdx-loader": "0.0.0-4937",
44
+ "@docusaurus/cssnano-preset": "0.0.0-4940",
45
+ "@docusaurus/logger": "0.0.0-4940",
46
+ "@docusaurus/mdx-loader": "0.0.0-4940",
47
47
  "@docusaurus/react-loadable": "5.5.2",
48
- "@docusaurus/utils": "0.0.0-4937",
49
- "@docusaurus/utils-common": "0.0.0-4937",
50
- "@docusaurus/utils-validation": "0.0.0-4937",
48
+ "@docusaurus/utils": "0.0.0-4940",
49
+ "@docusaurus/utils-common": "0.0.0-4940",
50
+ "@docusaurus/utils-validation": "0.0.0-4940",
51
51
  "@slorber/static-site-generator-webpack-plugin": "^4.0.4",
52
52
  "@svgr/webpack": "^6.2.1",
53
53
  "autoprefixer": "^10.4.5",
@@ -104,8 +104,8 @@
104
104
  "webpackbar": "^5.0.2"
105
105
  },
106
106
  "devDependencies": {
107
- "@docusaurus/module-type-aliases": "0.0.0-4937",
108
- "@docusaurus/types": "0.0.0-4937",
107
+ "@docusaurus/module-type-aliases": "0.0.0-4940",
108
+ "@docusaurus/types": "0.0.0-4940",
109
109
  "@types/detect-port": "^1.3.2",
110
110
  "@types/react-dom": "^18.0.3",
111
111
  "@types/react-router-config": "^5.0.6",
@@ -125,5 +125,5 @@
125
125
  "engines": {
126
126
  "node": ">=14"
127
127
  },
128
- "gitHead": "64a4acb5b96a4cbe8a8f3b49e2e111d80ed6a5e0"
128
+ "gitHead": "e2752f0bd8c9da9eff67162cb5f64dc30194cbf9"
129
129
  }