mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 23:57:22 +02:00
Prints an console error if /blog/ folder has no files.
This commit is contained in:
parent
a86af92e7c
commit
b241ed4404
1 changed files with 8 additions and 0 deletions
|
@ -12,6 +12,7 @@ const CWD = process.cwd();
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const glob = require("glob");
|
const glob = require("glob");
|
||||||
|
const chalk = require("chalk");
|
||||||
const siteConfig = require(CWD + "/siteConfig.js");
|
const siteConfig = require(CWD + "/siteConfig.js");
|
||||||
const versionFallback = require("./versionFallback.js");
|
const versionFallback = require("./versionFallback.js");
|
||||||
|
|
||||||
|
@ -271,6 +272,13 @@ function generateBlogMetadata() {
|
||||||
const metadatas = [];
|
const metadatas = [];
|
||||||
|
|
||||||
let files = glob.sync(CWD + "/blog/**/*.*");
|
let files = glob.sync(CWD + "/blog/**/*.*");
|
||||||
|
if (!files || files.length == 0) {
|
||||||
|
console.error(
|
||||||
|
`${chalk.yellow(
|
||||||
|
CWD + "/blog/ appears to be empty"
|
||||||
|
)} Make sure you've put your blog files in your Docusaurus 'website' folder.`
|
||||||
|
);
|
||||||
|
}
|
||||||
files.sort().reverse().forEach(file => {
|
files.sort().reverse().forEach(file => {
|
||||||
const extension = path.extname(file);
|
const extension = path.extname(file);
|
||||||
if (extension !== ".md" && extension !== ".markdown") {
|
if (extension !== ".md" && extension !== ".markdown") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue