@mintlify/prebuild 1.0.741 → 1.0.743

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.
@@ -1,3 +1,3 @@
1
1
  export declare const getFileListSync: (dirName: string, og?: string) => string[];
2
2
  export declare const getFileListWithDirectories: (dirName: string, og?: string) => string[];
3
- export declare function getFileList(dirName: string, og?: string, ignored?: Set<string>): AsyncIterable<string>;
3
+ export declare function getFileList(dirName: string, og?: string, mintIgnore?: string[]): AsyncIterable<string>;
package/dist/fs/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { isMintIgnored } from '@mintlify/common';
1
2
  import { readdirSync } from 'fs';
2
3
  import { readdir } from 'fs/promises';
3
4
  import path from 'path';
@@ -34,23 +35,19 @@ export const getFileListWithDirectories = (dirName, og = dirName) => {
34
35
  }
35
36
  return files;
36
37
  };
37
- export async function* getFileList(dirName, og = dirName, ignored = new Set()) {
38
+ export async function* getFileList(dirName, og = dirName, mintIgnore = []) {
38
39
  const items = await readdir(dirName, { withFileTypes: true });
39
- ignored.add('.git');
40
- ignored.add('.github');
41
- ignored.add('.claude');
42
- ignored.add('.agents');
43
- ignored.add('node_modules');
44
40
  for (const item of items) {
45
- if (ignored.has(item.name)) {
41
+ const fullPath = `${dirName}/${item.name}`;
42
+ const relativePath = path.relative(og, fullPath);
43
+ if (isMintIgnored(relativePath, mintIgnore)) {
46
44
  continue;
47
45
  }
48
46
  if (item.isDirectory()) {
49
- yield* getFileList(`${dirName}/${item.name}`, og);
47
+ yield* getFileList(fullPath, og, mintIgnore);
50
48
  }
51
49
  else {
52
- const path = `${dirName}/${item.name}`;
53
- yield path.startsWith(og) ? path.substring(og.length) : path;
50
+ yield `/${relativePath}`;
54
51
  }
55
52
  }
56
53
  }
@@ -1,6 +1,6 @@
1
1
  import { AsyncAPIFile } from '@mintlify/common';
2
2
  import { OpenApiFile } from '@mintlify/models';
3
- export declare const categorizeFilePaths: (contentDirectoryPath: string) => Promise<{
3
+ export declare const categorizeFilePaths: (contentDirectoryPath: string, mintIgnore?: string[]) => Promise<{
4
4
  contentFilenames: string[];
5
5
  staticFilenames: string[];
6
6
  openApiFiles: OpenApiFile[];
@@ -5,8 +5,8 @@ import yaml from 'js-yaml';
5
5
  import * as path from 'path';
6
6
  import { getFileList } from '../fs/index.js';
7
7
  import { getFileExtension } from '../utils.js';
8
- export const categorizeFilePaths = async (contentDirectoryPath) => {
9
- const allFilesInCmdExecutionPath = getFileList(contentDirectoryPath);
8
+ export const categorizeFilePaths = async (contentDirectoryPath, mintIgnore = []) => {
9
+ const allFilesInCmdExecutionPath = getFileList(contentDirectoryPath, contentDirectoryPath, mintIgnore);
10
10
  const contentFilenames = [];
11
11
  const staticFilenames = [];
12
12
  const openApiFiles = [];
@@ -1,4 +1,4 @@
1
- import { getConfigPath } from '../utils.js';
1
+ import { getConfigPath, getMintIgnore } from '../utils.js';
2
2
  import { categorizeFilePaths } from './categorizeFilePaths.js';
3
3
  import { update } from './update/index.js';
4
4
  export const prebuild = async (contentDirectoryPath, { localSchema, groups } = {}) => {
@@ -11,7 +11,8 @@ export const prebuild = async (contentDirectoryPath, { localSchema, groups } = {
11
11
  if (mintConfigPath == null && docsConfigPath == null) {
12
12
  throw Error('must be run in a directory where a docs.json file exists.');
13
13
  }
14
- const { contentFilenames, staticFilenames, openApiFiles, asyncApiFiles, snippets, snippetsV2 } = await categorizeFilePaths(contentDirectoryPath);
14
+ const mintIgnore = await getMintIgnore(contentDirectoryPath);
15
+ const { contentFilenames, staticFilenames, openApiFiles, asyncApiFiles, snippets, snippetsV2 } = await categorizeFilePaths(contentDirectoryPath, mintIgnore);
15
16
  await update({
16
17
  contentDirectoryPath,
17
18
  staticFilenames,
@@ -23,6 +24,7 @@ export const prebuild = async (contentDirectoryPath, { localSchema, groups } = {
23
24
  docsConfigPath,
24
25
  localSchema,
25
26
  groups,
27
+ mintIgnore,
26
28
  });
27
29
  };
28
30
  export * from './categorizeFilePaths.js';
@@ -12,8 +12,9 @@ type UpdateArgs = {
12
12
  docsConfigPath?: string | null;
13
13
  localSchema?: boolean;
14
14
  groups?: string[];
15
+ mintIgnore?: string[];
15
16
  };
16
- export declare const update: ({ contentDirectoryPath, staticFilenames, openApiFiles, asyncApiFiles, contentFilenames, snippets, snippetV2Filenames, docsConfigPath, localSchema, groups, }: UpdateArgs) => Promise<{
17
+ export declare const update: ({ contentDirectoryPath, staticFilenames, openApiFiles, asyncApiFiles, contentFilenames, snippets, snippetV2Filenames, docsConfigPath, localSchema, groups, mintIgnore, }: UpdateArgs) => Promise<{
17
18
  name: string;
18
19
  $schema: string;
19
20
  theme: "mint";
@@ -11,7 +11,7 @@ import { writeAsyncApiFiles } from './write/writeAsyncApiFiles.js';
11
11
  import { writeFiles, writeFile } from './write/writeFiles.js';
12
12
  import { writeOpenApiData } from './write/writeOpenApiData.js';
13
13
  import { writeRssFiles } from './write/writeRssFiles.js';
14
- export const update = async ({ contentDirectoryPath, staticFilenames, openApiFiles, asyncApiFiles, contentFilenames, snippets, snippetV2Filenames, docsConfigPath, localSchema, groups, }) => {
14
+ export const update = async ({ contentDirectoryPath, staticFilenames, openApiFiles, asyncApiFiles, contentFilenames, snippets, snippetV2Filenames, docsConfigPath, localSchema, groups, mintIgnore, }) => {
15
15
  const mintConfigResult = await updateMintConfigFile(contentDirectoryPath, openApiFiles, localSchema);
16
16
  // we used the original mint config without openapi pages injected
17
17
  // because we will do it in `updateDocsConfigFile`, this will avoid duplicated openapi pages
@@ -39,8 +39,14 @@ export const update = async ({ contentDirectoryPath, staticFilenames, openApiFil
39
39
  const writeDevGroupsPromise = groups && groups.length > 0
40
40
  ? outputFile('src/_props/dev-groups.json', JSON.stringify({ groups }, null, 2), { flag: 'w' })
41
41
  : Promise.resolve();
42
+ const writeMintIgnorePromise = mintIgnore && mintIgnore.length > 0
43
+ ? outputFile('src/_props/mint-ignore.json', JSON.stringify(mintIgnore, null, 2), {
44
+ flag: 'w',
45
+ })
46
+ : Promise.resolve();
42
47
  await Promise.all([
43
48
  writeDevGroupsPromise,
49
+ writeMintIgnorePromise,
44
50
  resolveImportsAndWriteFiles({
45
51
  openApiFiles: newOpenApiFiles,
46
52
  asyncApiFiles: newAsyncApiFiles,