Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions packages/playground/rescript.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
"dir": "src",
"subdirs": true
},
"package-specs": {
"module": "esmodule",
"in-source": false,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tsnobip do you have any idea why the playground has "in-source": false?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no idea, that hasn't changed in years!

"suffix": ".res.js"
},
"dependencies": [
"@rescript/react"
]
Expand Down
24 changes: 22 additions & 2 deletions rescript.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
{
"name": "rescript",
"dependencies": ["@tests/gentype-react-example", "playground"]
}
"package-specs": [
{
"module": "esmodule",
"in-source": true,
"suffix": ".res.js"
},
{
"module": "esmodule",
"in-source": false,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Playground had false, the other so far are on true.

"suffix": ".res.js"
}
],
"jsx": {
"version": 4
},
"dependencies": [
"@tests/gentype-react-example",
"@tests/docstring-tests",
"playground",
"@utils/scripts"
]
}
2 changes: 1 addition & 1 deletion scripts/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ echo Formatting OCaml code...
dune build @fmt --auto-promote

echo Formatting ReScript code...
files=$(find runtime tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*" ! -name "generated_mocha_test.res" ! -path "tests/syntax_tests*" ! -path "tests/analysis_tests/tests*" ! -path "*/node_modules/*")
files=$(find runtime tests scripts/res -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*" ! -name "generated_mocha_test.res" ! -path "tests/syntax_tests*" ! -path "tests/analysis_tests/tests*" ! -path "*/node_modules/*")
./cli/rescript.js format $files

echo Formatting JS code...
Expand Down
2 changes: 1 addition & 1 deletion scripts/format_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ case "$(uname -s)" in
fi

echo "Checking ReScript code formatting..."
files=$(find runtime tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*" ! -name "generated_mocha_test.res" ! -path "tests/syntax_tests*" ! -path "tests/analysis_tests/tests*" ! -path "*/node_modules/*")
files=$(find runtime tests scripts/res -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*" ! -name "generated_mocha_test.res" ! -path "tests/syntax_tests*" ! -path "tests/analysis_tests/tests*" ! -path "*/node_modules/*")
if ./cli/rescript.js format --check $files; then
printf "${successGreen}✅ ReScript code formatting ok.${reset}\n"
else
Expand Down
16 changes: 8 additions & 8 deletions scripts/res/GenApiDocs.res
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ module Docgen = RescriptTools.Docgen

let packagePath = Path.join([Node.dirname, "..", "..", "package.json"])
let version = switch Fs.readFileSync(packagePath, ~encoding="utf8")->JSON.parseOrThrow {
| Object(dict{"version": JSON.String(version)}) => version
| _ => JsError.panic("Invalid package.json format")
| Object(dict{"version": JSON.String(version)}) => version
| _ => JsError.panic("Invalid package.json format")
}
let version = Semver.parse(version)->Option.getExn
let version = Semver.parse(version)->Option.getOrThrow
let version = Semver.toString({...version, preRelease: None}) // Remove pre-release identifiers for API docs
let dirVersion = Path.join([Node.dirname, "apiDocs", version])
if !Fs.existsSync(dirVersion) {
Fs.mkdirSync(dirVersion)
}


let entryPointFiles = ["Belt.res", "Dom.res", "Js.res", "Stdlib.res"]

let hiddenModules = ["Js.Internal", "Js.MapperRt"]
Expand Down Expand Up @@ -56,9 +55,10 @@ let docsDecoded = entryPointFiles->Array.map(libFile =>
},
)->Buffer.toString

let docs = output
->JSON.parseOrThrow
->Docgen.decodeFromJson
let docs =
output
->JSON.parseOrThrow
->Docgen.decodeFromJson
Console.log(`Generated docs from ${libFile}`)
docs
} catch {
Expand Down Expand Up @@ -257,7 +257,7 @@ let () = {
tocTree
->Dict.fromArray
->JSON.stringifyAny
->Option.getExn,
->Option.getOrThrow,
)
Console.log("Generated toc_tree.json")
Console.log(`API docs generated successfully in ${dirVersion}`)
Expand Down
4 changes: 2 additions & 2 deletions scripts/res/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"type": "module",
"private": true,
"scripts": {
"build": "rescript legacy build",
"build": "rescript build",
"clean": "rescript clean",
"dev": "rescript legacy -w",
"dev": "rescript build -w",
"apidocs:generate": "yarn build && node GenApiDocs.res.js"
},
"dependencies": {
Expand Down
7 changes: 1 addition & 6 deletions scripts/res/rescript.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@
"dir": "./"
}
],
"dependencies": ["@tests/docstring-tests"],
"package-specs": {
"module": "esmodule",
"in-source": true
},
"suffix": ".res.js"
"dependencies": ["@tests/docstring-tests"]
}
7 changes: 1 addition & 6 deletions tests/docstring_tests/rescript.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,5 @@
"name": "@tests/docstring-tests",
"sources": {
"dir": "."
},
"package-specs": {
"module": "esmodule",
"in-source": true
},
"suffix": ".res.js"
}
}
7 changes: 1 addition & 6 deletions tests/gentype_tests/typescript-react-example/rescript.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,5 @@
"subdirs": true
}
],
"uncurried": true,
"package-specs": {
"module": "esmodule",
"in-source": true
},
"suffix": ".res.js"
"uncurried": true
}
Loading