@mintlify/cli 4.0.995 → 4.0.997
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,4 @@
|
|
|
1
|
+
import { toPosixPath } from '@mintlify/common';
|
|
1
2
|
import { getConfigObj, getConfigPath } from '@mintlify/prebuild';
|
|
2
3
|
import * as previewing from '@mintlify/previewing';
|
|
3
4
|
import { validateDocsConfig } from '@mintlify/validation';
|
|
@@ -45,7 +46,9 @@ describe('migrateMdx', () => {
|
|
|
45
46
|
|
|
46
47
|
const readdirSpy = vi.spyOn(fs.promises, 'readdir');
|
|
47
48
|
readdirSpy.mockImplementation(async (p: Parameters<typeof fs.promises.readdir>[0]) => {
|
|
48
|
-
const value =
|
|
49
|
+
const value = toPosixPath(
|
|
50
|
+
typeof p === 'string' ? p : (p as unknown as { toString(): string }).toString()
|
|
51
|
+
);
|
|
49
52
|
if (value === '/project') {
|
|
50
53
|
return [
|
|
51
54
|
mkDirent('api', true),
|
|
@@ -91,13 +94,15 @@ describe('migrateMdx', () => {
|
|
|
91
94
|
|
|
92
95
|
const existsSyncSpy = vi.spyOn(fs, 'existsSync');
|
|
93
96
|
existsSyncSpy.mockImplementation((p: fs.PathLike) => {
|
|
94
|
-
const value = String(p);
|
|
97
|
+
const value = toPosixPath(String(p));
|
|
95
98
|
return value === '/project/api/pets.mdx' || value === 'openapi.json';
|
|
96
99
|
});
|
|
97
100
|
|
|
98
101
|
const readFileSpy = vi.spyOn(fs.promises, 'readFile');
|
|
99
102
|
readFileSpy.mockImplementation(async (p: Parameters<typeof fs.promises.readFile>[0]) => {
|
|
100
|
-
const value =
|
|
103
|
+
const value = toPosixPath(
|
|
104
|
+
typeof p === 'string' ? p : (p as unknown as { toString(): string }).toString()
|
|
105
|
+
);
|
|
101
106
|
if (value === '/project/api/pets.mdx') {
|
|
102
107
|
return `---\nopenapi: openapi.json GET /pets\n---\n\n# Title\nContent`;
|
|
103
108
|
}
|
|
@@ -142,7 +147,9 @@ describe('migrateMdx', () => {
|
|
|
142
147
|
expect.objectContaining({ href: '/api/pets' })
|
|
143
148
|
);
|
|
144
149
|
|
|
145
|
-
expect(
|
|
150
|
+
expect(
|
|
151
|
+
unlinkSpy.mock.calls.some((c) => toPosixPath(c[0] as string) === '/project/api/pets.mdx')
|
|
152
|
+
).toBe(true);
|
|
146
153
|
|
|
147
154
|
expect(addLogSpy).toHaveBeenCalledWith(
|
|
148
155
|
expect.objectContaining({ props: { message: 'migration complete' } })
|
|
@@ -167,13 +174,15 @@ describe('migrateMdx', () => {
|
|
|
167
174
|
|
|
168
175
|
const existsSyncSpy = vi.spyOn(fs, 'existsSync');
|
|
169
176
|
existsSyncSpy.mockImplementation((p: fs.PathLike) => {
|
|
170
|
-
const value = String(p);
|
|
177
|
+
const value = toPosixPath(String(p));
|
|
171
178
|
return value === '/project/webhooks/newPet.mdx' || value === 'openapi1.json';
|
|
172
179
|
});
|
|
173
180
|
|
|
174
181
|
const readFileSpy = vi.spyOn(fs.promises, 'readFile');
|
|
175
182
|
readFileSpy.mockImplementation(async (p: Parameters<typeof fs.promises.readFile>[0]) => {
|
|
176
|
-
const value =
|
|
183
|
+
const value = toPosixPath(
|
|
184
|
+
typeof p === 'string' ? p : (p as unknown as { toString(): string }).toString()
|
|
185
|
+
);
|
|
177
186
|
if (value === '/project/webhooks/newPet.mdx') {
|
|
178
187
|
return `---\nopenapi: openapi1.json webhook newPet\n---\n\n# Webhook\nBody`;
|
|
179
188
|
}
|