Skip to content

Commit

Permalink
Merge pull request #2931 from quantified-uncertainty/website-docs-api…
Browse files Browse the repository at this point in the history
…-fix

Website script: Make api path if it doesn't exist
  • Loading branch information
OAGr authored Jan 7, 2024
2 parents aa0eb4a + 7672c88 commit f8a3e45
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/website/scripts/generateModulePages.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import { FnDocumentation } from "@quri/squiggle-lang";
import { ModulePage, modulePages } from "../templates.mjs";
import { generateModuleContent } from "./generateModuleContent.mjs";

const targetFilename = (name: string) => `./src/pages/docs/Api/${name}.mdx`;
const directoryPath = `./src/pages/docs/Api`;
if (!fs.existsSync(directoryPath)) {
fs.mkdirSync(directoryPath, { recursive: true });
}

const targetFilename = (name: string) => `${directoryPath}/${name}.mdx`;

//We need to escape the curly braces in the markdown for .jsx files.
function escapedStr(str: string) {
Expand Down Expand Up @@ -50,7 +55,7 @@ const generateMetaPage = async ({ pages }: { pages: ModulePage[] }) => {
}

const names = pages.map((p) => p.name);
const fileName = `./src/pages/docs/Api/_meta.json`;
const fileName = `${directoryPath}/_meta.json`;
const content = JSON.stringify(convertToKeyValuePairs(names), null, 2);

fs.writeFile(fileName, content, (err) => {
Expand Down

1 comment on commit f8a3e45

@vercel
Copy link

@vercel vercel bot commented on f8a3e45 Jan 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.