mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 13:37:28 +00:00
docs: update render script
This commit is contained in:
parent
cc9a2b44a5
commit
852468f663
1 changed files with 7 additions and 21 deletions
|
|
@ -1,31 +1,17 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
CONFIG_FILE="docusaurus.config.js"
|
||||
VERSIONS_FILE="versions.json"
|
||||
|
||||
# Extract lastVersion from docusaurus.config.js using sed
|
||||
LAST_VERSION=$(sed -n "s/.*lastVersion: *'\\([^']*\\)'.*/\\1/p" "$CONFIG_FILE")
|
||||
if [ -z "$LAST_VERSION" ]; then
|
||||
echo "Error: lastVersion not found in $CONFIG_FILE"
|
||||
# Ensure versions.json exists
|
||||
if [ ! -f "$VERSIONS_FILE" ]; then
|
||||
echo "Error: $VERSIONS_FILE not found."
|
||||
exit 1
|
||||
fi
|
||||
echo "Found lastVersion: $LAST_VERSION"
|
||||
|
||||
# Extract all version numbers from the entire file
|
||||
ALL_VERSIONS=$(grep -oE "'[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z]+)?'" "$CONFIG_FILE" | sed "s/'//g" | sort -u -V -r)
|
||||
if [ -z "$ALL_VERSIONS" ]; then
|
||||
echo "Error: No versions found in $CONFIG_FILE"
|
||||
exit 1
|
||||
fi
|
||||
echo "Found raw versions:"
|
||||
echo "$ALL_VERSIONS"
|
||||
|
||||
# Convert the extracted versions into a JSON array format
|
||||
VERSION_ARRAY=$(echo "$ALL_VERSIONS" | jq -R -s -c 'split("\n")[:-1] + ["'"$LAST_VERSION"'"] | unique')
|
||||
echo "Updating versions.json with: $VERSION_ARRAY"
|
||||
|
||||
# Update versions.json with combined data
|
||||
echo $VERSION_ARRAY | jq . > versions.json
|
||||
# Output existing versions from versions.json for reference
|
||||
echo "Using versions from $VERSIONS_FILE:"
|
||||
jq . "$VERSIONS_FILE"
|
||||
|
||||
# Install dependencies and build the project
|
||||
npm i && npm run build
|
||||
|
|
|
|||
Loading…
Reference in a new issue