Skip to content

Commit bc07101

Browse files
committed
pr feedback
1 parent b80a9b1 commit bc07101

File tree

15 files changed

+29
-1598
lines changed

15 files changed

+29
-1598
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public/playground-bundles/
3939
dist
4040
build
4141
.react-router
42+
mdx-manifest.json
4243

4344
app/**/*.mjs
4445
!_shims.mjs

app/routes/MdxRoute.res

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ let loader: ReactRouter.Loader.t<loaderData> = async ({request}) => {
154154
} else if pathname->String.includes("syntax-lookup") {
155155
let mdxSources =
156156
(await allMdx())
157-
->Array.filter(page => page.path->String.includes("syntax-lookup"))
157+
->Array.filter(page =>
158+
page.path
159+
->Option.map(String.includes(_, "syntax-lookup"))
160+
->Option.getOr(false)
161+
)
158162
->Array.map(SyntaxLookupRoute.convert)
159163

160164
let activeSyntaxItem =
@@ -191,14 +195,17 @@ let loader: ReactRouter.Loader.t<loaderData> = async ({request}) => {
191195
// TODO POST RR7: extract this out into a separate function
192196
// it can probably be cached or something
193197
let fileContents = await (await allMdx())
194-
->Array.filter(mdx => (mdx.path :> string)->String.includes(pathname))
198+
->Array.filter(mdx => mdx.path->Option.map(String.includes(_, pathname))->Option.getOr(false))
195199
->Array.get(0)
196-
->Option.map(mdx => {
200+
->Option.flatMap(mdx => {
197201
filePath :=
198-
Some(mdx.path->String.slice(~start=mdx.path->String.indexOf("rescript-lang.org/") + 17)) // remove the filesystem path to get the relative path to the files in the repo
202+
mdx.path->Option.map(mdxPath =>
203+
String.slice(mdxPath, ~start=mdxPath->String.indexOf("rescript-lang.org/") + 17)
204+
)
205+
// remove the filesystem path to get the relative path to the files in the repo
199206
mdx.path
200207
})
201-
->Option.map(path => Node.Fs.readFile((path :> string), "utf-8"))
208+
->Option.map(path => Node.Fs.readFile(path, "utf-8"))
202209
->Option.getOrThrow
203210

204211
let markdownTree = Mdast.fromMarkdown(fileContents)

app/routes/SyntaxLookupRoute.res

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ let loader: Loader.t<loaderData> = async ({request}) => {
2020

2121
let mdxSources =
2222
allMdx
23-
->Array.filter(page => page.path->String.includes("syntax-lookup"))
23+
->Array.filter(page =>
24+
page.path->Option.map(String.includes(_, "syntax-lookup"))->Option.getOr(false)
25+
)
2426
->Array.map(convert)
2527

2628
{

docs/guidelines/publishing-packages.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Whenever you publish a ReScript package to npm, please follow the following guid
1515
**Naming:**
1616

1717
- Make sure to give a descriptive package name. We usually use `rescript-[name-of-js-lib]` for packages that bind to a specific JS library on npm.
18-
- Use names that are self explanatory (no weird marketing terms /pages/docs/guidelines fantasy words if possible).
18+
- Use names that are self explanatory (no weird marketing terms / fantasy words if possible).
1919

2020
**Metadata:**
2121

0 commit comments

Comments
 (0)