How to add a rescript library
pnpm run gen
is a code generation script that creates new ReScript packages from templates. Here’s what it does:
Workflow
Section titled “Workflow”- User runs the script
pnpm run gen
- Script asks: “What is the original package name?”
- User enters a name (e.g., “array-async”)
- Script generates a new package structure in
types/array-async/
using the template - All
__name__
placeholders in template files are replaced with the actual name
Main Functionality
Section titled “Main Functionality”- Interactive Package Creation: It prompts the user to enter a package name via command line input
- Template-based Generation: Uses the generate-template-files library to create a new package structure from a template
- Dynamic Name Replacement: Replaces placeholder name in template files with the user-provided package name
Key Components
Section titled “Key Components”- Template Source: Uses files from
scripts/template/
directory - Output Location: Creates new packages in
types/__name__(kebabCase)/
directory - Dynamic Replacement: Converts the user input name to kebab-case and replaces
__name__
placeholders