Skip to content

Commit

Permalink
fix: 🐛 cache fix
Browse files Browse the repository at this point in the history
  • Loading branch information
prc5 committed Dec 5, 2023
1 parent 3f783ed commit fa54387
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/importer/importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { JSONOutput } from "typedoc";
import { mdxFromMarkdown } from "mdast-util-mdx";
import { fromMarkdown } from "mdast-util-from-markdown";
import { mdxjs } from "micromark-extension-mdxjs";
import { readJsonSync } from "fs-extra";

import { PackageOptionsFile, PkgMeta } from "../types/package.types";
import { pluginOptionsPath, packageConfigPath } from "../constants/paths.constants";
Expand Down Expand Up @@ -45,8 +46,10 @@ export const docsImporter = (options: {
pluginOptions.packages.map((pkg) => {
return {
name: cleanFileName(pkg.title),
// eslint-disable-next-line import/no-dynamic-require, global-require
reflection: require(getPackageDocsPath(docsDir, cleanFileName(pkg.title), isMonorepo)),
// readJsonSync is not getting cached as require does
reflection: readJsonSync(
getPackageDocsPath(docsDir, cleanFileName(pkg.title), isMonorepo),
),
};
});

Expand Down Expand Up @@ -74,8 +77,8 @@ export const docsImporter = (options: {

const configPath = path.join(docsDir, packageName, packageConfigPath);

// eslint-disable-next-line import/no-dynamic-require, global-require, @typescript-eslint/no-unused-vars, @typescript-eslint/no-var-requires
const packageMeta: PkgMeta = require(configPath);
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-var-requires
const packageMeta: PkgMeta = readJsonSync(configPath);

const packageReflection = reflectionsMap.find(
({ name }) => cleanFileName(packageName) === name,
Expand Down

0 comments on commit fa54387

Please sign in to comment.