UNPKG

@mintlify/prebuild

Version:

Helpful functions for Mintlify's prebuild step

32 lines (31 loc) 1.27 kB
import { getConfigPath } from '../utils.js'; import { categorizeFilePaths } from './categorizeFilePaths.js'; import { update } from './update/index.js'; export const prebuild = async (contentDirectoryPath, { localSchema, groups } = {}) => { if (process.env.IS_MULTI_TENANT === 'true') { console.log('Skipping prebuild in multi-tenant mode.'); return; } const docsConfigPath = await getConfigPath(contentDirectoryPath, 'docs'); const mintConfigPath = await getConfigPath(contentDirectoryPath, 'mint'); if (mintConfigPath == null && docsConfigPath == null) { throw Error('must be run in a directory where a docs.json file exists.'); } const { contentFilenames, staticFilenames, openApiFiles, asyncApiFiles, snippets, snippetsV2 } = await categorizeFilePaths(contentDirectoryPath); await update({ contentDirectoryPath, staticFilenames, openApiFiles, asyncApiFiles, contentFilenames, snippets, snippetV2Filenames: snippetsV2, docsConfigPath, localSchema, groups, }); }; export * from './categorizeFilePaths.js'; export * from '../createPage/index.js'; export * from '../createPage/preparseMdx/index.js'; export * from './update/index.js';