[feat-req] rescript init command
i would like a rescript init command that creates a rescript.json file
it should use values from package.json (for e.g. the name field) if one exists, otherwise use sane defaults (like dir name as project name).
it should insert all possible fields (commented out) so the file becomes self-documenting, just like tsc init does.
it could also insert one or multiple links (commented out) to documentation for easy access
example
rescript init
generates something like (ai slop below, just to give you an idea)
{
// The project name, taken from package.json if available, otherwise defaults to the directory name
"name": "theproject",
// Directories containing your ReScript source files
"sources": [
{
"dir": "src",
// Set to true to include all nested subdirectories
"subdirs": true
}
],
// Configure how compiled JS files are emitted
"package-specs": [
{
// Possible values: "commonjs" | "esmodule"
"module": "esmodule",
// If true, .res.js files are emitted next to source files
// If false, they go under lib/js/
"in-source": true
}
],
// File extension suffix for compiled output
"suffix": ".res.js",
// Dependencies that should be compiled by ReScript as well
"bs-dependencies": [
"@rescript/core"
// Add other rescript packages here, e.g. "rescript-react"
],
// Flags passed to the ReScript compiler
"bsc-flags": [
"-open RescriptCore"
// Example: "-bs-super-errors" for detailed compiler output
],
// Output directory for generated JS artifacts when not using "in-source": true
// "gentypeconfig": { "language": "typescript" }, // Example if using gentype
// Clean output on build
// "clean-on-build": true,
// Specify the namespace of generated JS modules
// "namespace": "MyNamespace",
// Enables warnings as errors
// "warnings-as-errors": true,
// Optional compiler version pinning
// "version": "11.0.0",
// ⚙️ For more options and docs:
// https://rescript-lang.org/docs/manual/latest/build-configuration
// https://rescript-lang.org/docs/manual/latest/configuration-schema
}
We do have https://github.com/rescript-lang/create-rescript-app for this. Maybe we should add a note about that to rescript's (rewatch's) help message.
rescript.json needs to be valid JSON, not JSONC.
We do have https://github.com/rescript-lang/create-rescript-app for this. Maybe we should add a note about that to rescript's (rewatch's) help message.
rescript.jsonneeds to be valid JSON, not JSONC.
right, i've seen that one, but i dislike using create-*-app scripts because they all try to pull in stuff that i dont want or need, e.g a readme, gitignore and more.
Then still it would be better to just have a barebones template in Create-ReScript-App. Many people don't have a globally installed ReScript on their machine.
Then still it would be better to just have a barebones template in Create-ReScript-App. Many people don't have a globally installed ReScript on their machine.
ok, fair point. i have my paths setup so i can always run commands if theres a node_modules folder, i didn't even consider that this is not standard (maybe it is?), no matter, i would be all for a rescript.json-only template.. this is a munor thing anyway so if it doesn't sit well with your vision of rescript or its roadmap, feel free to close.