Skip to content

Commit

Permalink
Stop saying "Building roots:" twice (#3256)
Browse files Browse the repository at this point in the history
Fixes #3253
  • Loading branch information
peterbe authored Mar 17, 2021
1 parent 2072d11 commit 49409d3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
16 changes: 15 additions & 1 deletion build/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const fs = require("fs");
const path = require("path");
const zlib = require("zlib");

const chalk = require("chalk");
const cliProgress = require("cli-progress");
const program = require("@caporal/core").default;
const { prompt } = require("inquirer");
Expand All @@ -10,7 +11,9 @@ const {
Document,
slugToFolder,
translationsOf,
CONTENT_ROOT,
CONTENT_TRANSLATED_ROOT,
CONTENT_ARCHIVED_ROOT,
} = require("../content");

// eslint-disable-next-line node/no-missing-require
Expand Down Expand Up @@ -279,7 +282,18 @@ program
.action(async ({ args, options }) => {
try {
if (!options.quiet) {
console.log("\nBuilding Documents...");
const roots = [
["CONTENT_ROOT", CONTENT_ROOT],
["CONTENT_TRANSLATED_ROOT", CONTENT_TRANSLATED_ROOT],
["CONTENT_ARCHIVED_ROOT", CONTENT_ARCHIVED_ROOT],
];
for (const [key, value] of roots) {
console.log(
`${chalk.grey((key + ":").padEnd(25, " "))}${
value ? chalk.white(value) : chalk.grey("not set")
}`
);
}
}
const { files } = args;
const t0 = new Date();
Expand Down
12 changes: 1 addition & 11 deletions content/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,30 +358,20 @@ function findByURL(url, ...args) {
return doc;
}

function findAll({
files = new Set(),
folderSearch = null,
quiet = false,
} = {}) {
function findAll({ files = new Set(), folderSearch = null } = {}) {
if (!(files instanceof Set)) throw new TypeError("'files' not a Set");
if (folderSearch && typeof folderSearch !== "string")
throw new TypeError("'folderSearch' not a string");

// TODO: doesn't support archive content yet
// console.warn("Currently hardcoded to only build 'en-us'");
const filePaths = [];
const roots = [];
if (CONTENT_ARCHIVED_ROOT) {
// roots.push({ path: CONTENT_ARCHIVED_ROOT, isArchive: true });
roots.push(CONTENT_ARCHIVED_ROOT);
}
if (CONTENT_TRANSLATED_ROOT) {
roots.push(CONTENT_TRANSLATED_ROOT);
}
roots.push(CONTENT_ROOT);
if (!quiet) {
console.log("Building roots:", roots);
}
for (const root of roots) {
filePaths.push(
...glob
Expand Down

0 comments on commit 49409d3

Please sign in to comment.