@conduction/docusaurus-preset 1.4.0 → 1.4.2
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.
package/package.json
CHANGED
|
@@ -17,7 +17,24 @@
|
|
|
17
17
|
* <DetailHero appId="openregister" ... /> // looks up downloads automatically
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
/* The JSON lives at design-system/data/app-downloads.json — three
|
|
21
|
+
levels up from this file inside the monorepo. When the preset is
|
|
22
|
+
installed via npm into a consumer site, that path resolves outside
|
|
23
|
+
the package directory and webpack 404s the import. Wrap in
|
|
24
|
+
require + try/catch so the consumer build falls back to an empty
|
|
25
|
+
stats payload instead of failing the whole build over a missing
|
|
26
|
+
download counter. */
|
|
27
|
+
let data;
|
|
28
|
+
try {
|
|
29
|
+
// eslint-disable-next-line global-require, import/no-unresolved
|
|
30
|
+
data = require('../../../data/app-downloads.json');
|
|
31
|
+
} catch (e) {
|
|
32
|
+
data = {
|
|
33
|
+
generated_at: null,
|
|
34
|
+
totals: { downloads: 0, apps_total: 0, apps_in_store: 0 },
|
|
35
|
+
apps: [],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
21
38
|
|
|
22
39
|
export default data;
|
|
23
40
|
|
|
@@ -99,7 +99,13 @@ export default function Navbar() {
|
|
|
99
99
|
const rightItems = items.filter(i => i.position === 'right' || i.type === 'localeDropdown');
|
|
100
100
|
|
|
101
101
|
return (
|
|
102
|
-
|
|
102
|
+
/* `navbar` (Docusaurus's framework class) is added alongside the
|
|
103
|
+
brand styles.nav so the internal scroll-anchor offset query
|
|
104
|
+
`document.querySelector('.navbar').clientHeight` resolves. The
|
|
105
|
+
previous JS-only class swizzle made every doc page crash with
|
|
106
|
+
"Cannot read properties of null (reading 'clientHeight')" the
|
|
107
|
+
moment Docusaurus ran its anchor logic on a heading scroll. */
|
|
108
|
+
<nav className={`navbar ${styles.nav}`} role="navigation" aria-label="Main">
|
|
103
109
|
<div className={styles.left}>
|
|
104
110
|
<Link to={homeHref} className={styles.wordmark}>
|
|
105
111
|
{wordmark}
|