Skip to content

Commit a072fcb

Browse files
author
luguellis
committed
fix: changing to RegExp and String Rescript Core types
1 parent 1e5c255 commit a072fcb

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

scripts/generate_llms.res

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,33 @@ let createDirectoryIfNotExists = (dirPath: string): unit => {
2929
}
3030

3131
let removeCodeTabTags = (content: string): string => {
32-
let regex = Js.Re.fromStringWithFlags("<CodeTab.*?>[\\s\\S]*?</CodeTab>", ~flags="g")
33-
Js.String.replaceByRe(regex, "", content)
32+
let regex = RegExp.fromStringWithFlags("<CodeTab.*?>[\\s\\S]*?</CodeTab>", ~flags="g")
33+
String.replaceRegExp(content, regex, "")
3434
}
3535

3636
let removeCodeBlocks = (content: string): string => {
37-
let regex = Js.Re.fromStringWithFlags("```[a-zA-Z]+\\s*[\\s\\S]*?```", ~flags="g")
38-
Js.String.replaceByRe(regex, "", content)
37+
let regex = RegExp.fromStringWithFlags("```[a-zA-Z]+\\s*[\\s\\S]*?```", ~flags="g")
38+
String.replaceRegExp(content, regex, "")
3939
}
4040

4141
let removeFileTitle = (content: string): string => {
42-
let regex = Js.Re.fromStringWithFlags("---\ntitle[\\s\\S]*?---", ~flags="g")
43-
Js.String.replaceByRe(regex, "", content)
42+
let regex = RegExp.fromStringWithFlags("---\ntitle[\\s\\S]*?---", ~flags="g")
43+
String.replaceRegExp(content, regex, "")
4444
}
4545

4646
let removeUnnecessaryBreaks = (content: string): string => {
47-
let regex = Js.Re.fromStringWithFlags("^\n{2,}", ~flags="g")
48-
Js.String.replaceByRe(regex, "", content)
47+
let regex = RegExp.fromStringWithFlags("^\n{2,}", ~flags="g")
48+
String.replaceRegExp(content, regex, "")
4949
}
5050

5151
let removeToDos = (content: string): string => {
52-
let regex = Js.Re.fromStringWithFlags("<!-- TODO[\\s\\S]*?-->", ~flags="g")
53-
Js.String.replaceByRe(regex, "", content)
52+
let regex = RegExp.fromStringWithFlags("<!-- TODO[\\s\\S]*?-->", ~flags="g")
53+
String.replaceRegExp(content, regex, "")
5454
}
5555

5656
let fillContentWithVersion = (content: string, version: string): string => {
57-
let regex = Js.Re.fromStringWithFlags("<VERSION>", ~flags="g")
58-
Js.String.replaceByRe(regex, version, content)
57+
let regex = RegExp.fromStringWithFlags("<VERSION>", ~flags="g")
58+
String.replaceRegExp(content, regex, version)
5959
}
6060

6161
let createFullFile = (content: string, filePath: string): unit => {
@@ -113,7 +113,7 @@ let processVersions = (
113113
versionDir
114114
->collectFiles
115115
->Array.forEach(filePath => {
116-
if Js.String.endsWith(".mdx", filePath) {
116+
if String.endsWith(filePath, ".mdx") {
117117
let content = readMarkdownFile(filePath)
118118

119119
content->createFullFile(fullFilePath)

0 commit comments

Comments
 (0)