-
Notifications
You must be signed in to change notification settings - Fork 188
Generate Ballerina By Examples
A script is used to take the source of the Ballerina By Examples (BBEs) from the ballerina-distribution repository as the input and generates the HTML files to be published on the Ballerina website.
Download and install Node.js.
- Navigate to the directory, which includes the script.
Note: The scripts can be found in the
bbe-generation-v2branch.
cd ./.github/scripts/bbe- Install the dependencies.
npm install- Navigate back to the root of the repo.
cd ../../..
You can do either of the below.
- Delete all the HTML files located in the
./learn/by-examplesdirectory excluding the404.htmlandindex.htmlfiles by executing the command below.
find ./learn/by-example -type f \( -name "*.html" ! -name "404.html" ! -name "index.html" \) -delete- Delete only the BBEs that you want to update from the
./learn/by-examplesdirectory.
The script markdownConverter.js is used to convert the BBE content written in markdown to HTML.
| Location from root of the website repo | ./.github/scripts/bbe/markdownConverter.js |
| Inputs |
1. Location of the examples directory.2. Location of the output to be saved. |
| Outputs | HTML files corresponding to the markdown BBE files. |
From the root of the ballerina-dev-website repository, run the script using Node.js.
node ./.github/scripts/bbe/markdownConverter.js <relative_path_to_examples> <relative_path_for_output_HTMLs>By default, the arguments of the above command will have the values below.
-
<relative_path_to_examples>=“./examples” -
<relative_path_for_output_HTMLs>=“./learn/by-example”
An example command would be as follows.
node ./.github/scripts/bbe/markdownConverter.js "../ballerina-distribution/examples" "./learn/by-example"Note: Generated output BBE HTML files will be saved in the specified directory.
Deploy the generated HTML files on the Ballerina website by replacing the <ballerina-dev-website>/learn/by-example directory and verify your changes locally.