Skip to content

Commit 89f43fe

Browse files
authored
feat(docs/upload): support .mdx file extension (#1198)
## 🧰 Changes We definitely need to support `.mdx` files now, given the fact that the syntax we use in refactored is MDX. ## 🧬 QA & Testing Added a little tweak to ensure our tests capture this extension properly.
1 parent 958bc0f commit 89f43fe

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

__tests__/commands/docs/__snapshots__/upload.test.ts.snap

+4-4
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ exports[`rdme docs upload > given that the file path is a directory > should cre
8686

8787
exports[`rdme docs upload > given that the file path is a directory > should error out if the directory does not contain any Markdown files 1`] = `
8888
{
89-
"error": [Error: The directory you provided (__tests__/__fixtures__/ref-oas) doesn't contain any of the following file extensions: .markdown, .md.],
89+
"error": [Error: The directory you provided (__tests__/__fixtures__/ref-oas) doesn't contain any of the following file extensions: .markdown, .md, .mdx.],
9090
"stderr": "- 🔍 Looking for Markdown files in __tests__/__fixtures__/ref-oas...
9191
✖ 🔍 Looking for Markdown files in __tests__/__fixtures__/ref-oas... no files found.
9292
",
@@ -114,7 +114,7 @@ exports[`rdme docs upload > given that the file path is a directory > should han
114114
⏭️ The following 1 page(s) will be skipped due to no frontmatter data:
115115
- doc-sans-attributes (__tests__/__fixtures__/docs/mixed-docs/doc-sans-attributes.md)
116116
🚨 Unable to fetch data about the following 2 page(s):
117-
- __tests__/__fixtures__/docs/mixed-docs/new-doc-slug.md: The ReadMe API responded with an unexpected error. Please try again and if this issue persists, get in touch with us at [email protected].
117+
- __tests__/__fixtures__/docs/mixed-docs/new-doc-slug.mdx: The ReadMe API responded with an unexpected error. Please try again and if this issue persists, get in touch with us at [email protected].
118118
- __tests__/__fixtures__/docs/mixed-docs/simple-doc.md: The ReadMe API responded with an unexpected error. Please try again and if this issue persists, get in touch with us at [email protected].
119119
",
120120
}
@@ -140,7 +140,7 @@ exports[`rdme docs upload > given that the file path is a directory > should han
140140
⏭️ Skipped 1 page(s) in ReadMe due to no frontmatter data:
141141
- doc-sans-attributes (__tests__/__fixtures__/docs/mixed-docs/doc-sans-attributes.md)
142142
🚨 Received errors when attempting to upload 2 page(s):
143-
- __tests__/__fixtures__/docs/mixed-docs/new-doc-slug.md: The ReadMe API responded with an unexpected error. Please try again and if this issue persists, get in touch with us at [email protected].
143+
- __tests__/__fixtures__/docs/mixed-docs/new-doc-slug.mdx: The ReadMe API responded with an unexpected error. Please try again and if this issue persists, get in touch with us at [email protected].
144144
- __tests__/__fixtures__/docs/mixed-docs/simple-doc.md: The ReadMe API responded with an unexpected error. Please try again and if this issue persists, get in touch with us at [email protected].
145145
",
146146
}
@@ -518,7 +518,7 @@ exports[`rdme docs upload > given that the file path is a single file > should e
518518
519519
exports[`rdme docs upload > given that the file path is a single file > should error out if the file has an invalid file extension 1`] = `
520520
{
521-
"error": [Error: Invalid file extension (.json). Must be one of the following: .markdown, .md],
521+
"error": [Error: Invalid file extension (.json). Must be one of the following: .markdown, .md, .mdx],
522522
"stderr": "",
523523
"stdout": "",
524524
}

src/lib/syncPagePath.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export default async function syncPagePath(this: CommandsThatSyncMarkdown) {
199199
const { path: pathInput }: { path: string } = this.args;
200200
const { 'dry-run': dryRun, 'skip-validation': skipValidation } = this.flags;
201201

202-
const allowedFileExtensions = ['.markdown', '.md'];
202+
const allowedFileExtensions = ['.markdown', '.md', '.mdx'];
203203

204204
const stat = await fs.stat(pathInput).catch(err => {
205205
if (err.code === 'ENOENT') {

0 commit comments

Comments
 (0)