@conduction/docusaurus-preset 1.4.0 → 1.4.1

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduction/docusaurus-preset",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "scripts": {
5
5
  "prepack": "node scripts/prepack-bundle-css.js"
6
6
  },
@@ -17,7 +17,24 @@
17
17
  * <DetailHero appId="openregister" ... /> // looks up downloads automatically
18
18
  */
19
19
 
20
- import data from '../../../data/app-downloads.json';
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