|
4 | 4 |
|
5 | 5 | // TODO: factor into an independent plugin |
6 | 6 | import visit from "unist-util-visit" |
| 7 | +import logger from "@docusaurus/logger" |
7 | 8 | import fs_extra_pkg from "fs-extra" |
8 | 9 | import { spawnSync } from "child_process" |
9 | 10 | const { readJsonSync, writeJsonSync, ensureDirSync } = fs_extra_pkg |
10 | 11 | import { createHash } from "crypto" |
11 | 12 |
|
12 | 13 | // site version |
13 | | -const sitePkg = readJsonSync("../package.json") |
| 14 | +const sitePkg = readJsonSync("../compiler/package.json") |
14 | 15 | // for version `x.y.z`, only recompute hashes if `x` changes |
15 | 16 | // to avoid recomputation over minor changes on the website |
16 | 17 | // (so we only recompute for every major release) |
17 | 18 | const VERSION = sitePkg.version.replace(/(\..)*$/g, "") |
18 | 19 |
|
19 | | -console.log(`rendering snippets ${VERSION}`) |
| 20 | +logger.info(`rendering snippets ${VERSION}`) |
20 | 21 | // language configs |
21 | 22 | import getLangConfig from "../../language.config.js" |
22 | 23 | const languageConfig = await getLangConfig() |
@@ -91,7 +92,6 @@ async function getOutput(config, input, lang, skipErr) { |
91 | 92 | memoryCache[pathOut] || |
92 | 93 | (cache && readJsonSync(pathOut, { throws: false })) // don't throw an error if file not exist |
93 | 94 | if (data) { |
94 | | - console.log(`cache hit ${hash}`) |
95 | 95 | const errorToReport = checkRuntimeError( |
96 | 96 | lang, |
97 | 97 | langVersion, |
@@ -144,7 +144,7 @@ async function getOutput(config, input, lang, skipErr) { |
144 | 144 | ) |
145 | 145 | } |
146 | 146 |
|
147 | | - console.debug(`${lang}: ${hash}, ${status}, ${error}`) |
| 147 | + logger.debug`${lang}: ${hash}, ${status}, ${error}` |
148 | 148 |
|
149 | 149 | const errorToReport = checkRuntimeError( |
150 | 150 | langVersion, |
|
0 commit comments