@mintlify/cli 4.0.945 → 4.0.947
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.
- package/__test__/migrateMdx.test.ts +13 -5
- package/package.json +6 -6
|
@@ -6,6 +6,8 @@ import { outputFile } from 'fs-extra';
|
|
|
6
6
|
|
|
7
7
|
import { migrateMdx } from '../src/migrateMdx.js';
|
|
8
8
|
|
|
9
|
+
const normalizePath = (p: string) => p.replace(/[\\/]+/g, '/');
|
|
10
|
+
|
|
9
11
|
vi.mock('../src/constants.js', () => ({
|
|
10
12
|
HOME_DIR: '/home/test-user',
|
|
11
13
|
CMD_EXEC_PATH: '/project',
|
|
@@ -91,13 +93,15 @@ describe('migrateMdx', () => {
|
|
|
91
93
|
|
|
92
94
|
const existsSyncSpy = vi.spyOn(fs, 'existsSync');
|
|
93
95
|
existsSyncSpy.mockImplementation((p: fs.PathLike) => {
|
|
94
|
-
const value = String(p);
|
|
96
|
+
const value = normalizePath(String(p));
|
|
95
97
|
return value === '/project/api/pets.mdx' || value === 'openapi.json';
|
|
96
98
|
});
|
|
97
99
|
|
|
98
100
|
const readFileSpy = vi.spyOn(fs.promises, 'readFile');
|
|
99
101
|
readFileSpy.mockImplementation(async (p: Parameters<typeof fs.promises.readFile>[0]) => {
|
|
100
|
-
const value =
|
|
102
|
+
const value = normalizePath(
|
|
103
|
+
typeof p === 'string' ? p : (p as unknown as { toString(): string }).toString()
|
|
104
|
+
);
|
|
101
105
|
if (value === '/project/api/pets.mdx') {
|
|
102
106
|
return `---\nopenapi: openapi.json GET /pets\n---\n\n# Title\nContent`;
|
|
103
107
|
}
|
|
@@ -142,7 +146,9 @@ describe('migrateMdx', () => {
|
|
|
142
146
|
expect.objectContaining({ href: '/api/pets' })
|
|
143
147
|
);
|
|
144
148
|
|
|
145
|
-
expect(
|
|
149
|
+
expect(
|
|
150
|
+
unlinkSpy.mock.calls.some((c) => normalizePath(c[0] as string) === '/project/api/pets.mdx')
|
|
151
|
+
).toBe(true);
|
|
146
152
|
|
|
147
153
|
expect(addLogSpy).toHaveBeenCalledWith(
|
|
148
154
|
expect.objectContaining({ props: { message: 'migration complete' } })
|
|
@@ -167,13 +173,15 @@ describe('migrateMdx', () => {
|
|
|
167
173
|
|
|
168
174
|
const existsSyncSpy = vi.spyOn(fs, 'existsSync');
|
|
169
175
|
existsSyncSpy.mockImplementation((p: fs.PathLike) => {
|
|
170
|
-
const value = String(p);
|
|
176
|
+
const value = normalizePath(String(p));
|
|
171
177
|
return value === '/project/webhooks/newPet.mdx' || value === 'openapi1.json';
|
|
172
178
|
});
|
|
173
179
|
|
|
174
180
|
const readFileSpy = vi.spyOn(fs.promises, 'readFile');
|
|
175
181
|
readFileSpy.mockImplementation(async (p: Parameters<typeof fs.promises.readFile>[0]) => {
|
|
176
|
-
const value =
|
|
182
|
+
const value = normalizePath(
|
|
183
|
+
typeof p === 'string' ? p : (p as unknown as { toString(): string }).toString()
|
|
184
|
+
);
|
|
177
185
|
if (value === '/project/webhooks/newPet.mdx') {
|
|
178
186
|
return `---\nopenapi: openapi1.json webhook newPet\n---\n\n# Webhook\nBody`;
|
|
179
187
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintlify/cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.947",
|
|
4
4
|
"description": "The Mintlify CLI",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0"
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@inquirer/prompts": "7.9.0",
|
|
48
|
-
"@mintlify/common": "1.0.
|
|
49
|
-
"@mintlify/link-rot": "3.0.
|
|
48
|
+
"@mintlify/common": "1.0.723",
|
|
49
|
+
"@mintlify/link-rot": "3.0.883",
|
|
50
50
|
"@mintlify/models": "0.0.271",
|
|
51
|
-
"@mintlify/prebuild": "1.0.
|
|
52
|
-
"@mintlify/previewing": "4.0.
|
|
51
|
+
"@mintlify/prebuild": "1.0.859",
|
|
52
|
+
"@mintlify/previewing": "4.0.916",
|
|
53
53
|
"@mintlify/validation": "0.1.591",
|
|
54
54
|
"adm-zip": "0.5.16",
|
|
55
55
|
"chalk": "5.2.0",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"vitest": "2.0.4",
|
|
87
87
|
"vitest-mock-process": "1.0.4"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "686c5bedc22783387dd3f84583a2e075ff41ed8a"
|
|
90
90
|
}
|