Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show the latest version of the basic-cli docs by default #5718

Closed
Changes from all 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
45 changes: 27 additions & 18 deletions www/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,29 +100,38 @@ cp -r www/wip_new_website/static/site.css www/build/wip
rm -rf roc_nightly roc_releases.json

echo 'Generating CLI example platform docs...'

BASIC_CLI_PACKAGE_DIR="www/build/packages/basic-cli"
mkdir -p $BASIC_CLI_PACKAGE_DIR

# Change ROC_DOCS_ROOT_DIR=builtins so that links will be generated relative to
# "/packages/basic-cli/" rather than "/builtins/"
export ROC_DOCS_URL_ROOT=/packages/basic-cli
# "/packages/basic-cli/main" rather than "/builtins/"
export ROC_DOCS_URL_ROOT=/packages/basic-cli/main

# Generate the docs for the main branch
rm -rf ./downloaded-basic-cli

git clone --depth 1 https://github.com/roc-lang/basic-cli.git downloaded-basic-cli

cargo run --bin roc-docs downloaded-basic-cli/src/main.roc

rm -rf ./downloaded-basic-cli

BASIC_CLI_PACKAGE_DIR="www/build/packages/basic-cli"
mkdir -p $BASIC_CLI_PACKAGE_DIR
mv generated-docs/* $BASIC_CLI_PACKAGE_DIR # move all the folders to build/packages/basic-cli

# set up docs for basic-cli 0.3.2
BASIC_CLI_DIR_0_3_2=$BASIC_CLI_PACKAGE_DIR/0.3.2
mkdir -p $BASIC_CLI_DIR_0_3_2
curl -fL --output $BASIC_CLI_DIR_0_3_2/docs.tar.gz https://github.com/roc-lang/basic-cli/releases/download/0.3.2/docs.tar.gz
tar -xf $BASIC_CLI_DIR_0_3_2/docs.tar.gz -C $BASIC_CLI_DIR_0_3_2/
rm $BASIC_CLI_DIR_0_3_2/docs.tar.gz
mv $BASIC_CLI_DIR_0_3_2/generated-docs/* $BASIC_CLI_DIR_0_3_2
rm -rf $BASIC_CLI_DIR_0_3_2/generated-docs
# Move the generated docs to build/packages/basic-cli/main
mkdir -p $BASIC_CLI_PACKAGE_DIR/main
mv generated-docs/* $BASIC_CLI_PACKAGE_DIR/main

# Set up docs for different basic-cli versions
BASIC_CLI_VERSIONS=("0.4.0" "0.3.2") # Listed with the latest version first
Copy link
Collaborator

Choose a reason for hiding this comment

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

So I guess we need to update this for each new release?

for BASIC_CLI_VERSION in ${BASIC_CLI_VERSIONS[@]}; do
echo "Generating CLI example platform docs for version $BASIC_CLI_VERSION..."
BASIC_CLI_PACKAGE_VERSION_DIR=$BASIC_CLI_PACKAGE_DIR/$BASIC_CLI_VERSION
mkdir -p $BASIC_CLI_PACKAGE_VERSION_DIR
curl -fL --output $BASIC_CLI_PACKAGE_VERSION_DIR/docs.tar.gz "https://github.com/roc-lang/basic-cli/releases/download/$BASIC_CLI_VERSION/docs.tar.gz"
tar -xf $BASIC_CLI_PACKAGE_VERSION_DIR/docs.tar.gz -C $BASIC_CLI_PACKAGE_VERSION_DIR
rm $BASIC_CLI_PACKAGE_VERSION_DIR/docs.tar.gz
mv $BASIC_CLI_PACKAGE_VERSION_DIR/generated-docs/* $BASIC_CLI_PACKAGE_VERSION_DIR
rm -rf $BASIC_CLI_PACKAGE_VERSION_DIR/generated-docs
done

# Copy the docs for the latest version of basic-cli to the root of the basic-cli docs folder
BASIC_CLI_LATEST_VERSION=${BASIC_CLI_VERSIONS[0]}
cp -r "$BASIC_CLI_PACKAGE_DIR/$BASIC_CLI_LATEST_VERSION/." "$BASIC_CLI_PACKAGE_DIR"

popd