Skip to content
Open
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ present, such as `-Dquidem.filter=qaWin/**`.

### Web Console Development

- Refer to `web-console/README.md` for instructions on developing, linting, and testing web console features.
Refer to `web-console/README.md` for general instructions on developing the web console.

Run `npm run test-unit` from the `web-console/` directory to verify your work. Before doing this for the first time
in a fresh checkout, you will also need to run `npm install`.

Run `npm run autofix` from the `web-console/` directory to fix formatting issues.

### Documentation

Expand Down
1 change: 1 addition & 0 deletions web-console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"test": "npm run test-base -- --silent 2>&1",
"test-ci": "npm run test-base -- --coverage",
"test-e2e": "jest --runInBand --config jest.e2e.config.js e2e-tests",
"test-unit": "./script/build-sql-docs && npm run eslint && npm run sasslint && npm run prettify-check && jest --config jest.config.js --testPathIgnorePatterns='e2e-tests'",
"codecov": "codecov --disable=gcov -p ..",
"coverage": "jest --coverage src",
"update-snapshots": "jest -u --config jest.config.js",
Expand Down
43 changes: 4 additions & 39 deletions web-console/script/build
Original file line number Diff line number Diff line change
Expand Up @@ -36,46 +36,11 @@ is_newer_than() {
[ "$1" -nt "$2" ]
}

# Check if SQL docs need to be built
SQL_DOCS_OUTPUT="lib/sql-docs.ts"
SQL_DOCS_SCRIPT="script/create-sql-docs.mjs"
SQL_DOCS_FILELIST="script/sql-doc-files.txt"

BUILD_SQL_DOCS=false

if [ "$FORCE_BUILD" = true ] || [ ! -f "$SQL_DOCS_OUTPUT" ]; then
BUILD_SQL_DOCS=true
else
# Check if create-sql-docs.mjs is newer than output
if is_newer_than "$SQL_DOCS_SCRIPT" "$SQL_DOCS_OUTPUT"; then
BUILD_SQL_DOCS=true
fi

# Check if sql-doc-files.txt is newer than output
if is_newer_than "$SQL_DOCS_FILELIST" "$SQL_DOCS_OUTPUT"; then
BUILD_SQL_DOCS=true
fi

# Check if any file listed in sql-doc-files.txt is newer than output
if [ -f "$SQL_DOCS_FILELIST" ] && [ "$BUILD_SQL_DOCS" = false ]; then
while read -r file; do
# Skip empty lines and comments
if [[ -z "$file" ]] || [[ "$file" =~ ^[[:space:]]*# ]]; then
continue
fi
if [ -n "$file" ] && is_newer_than "$file" "$SQL_DOCS_OUTPUT"; then
BUILD_SQL_DOCS=true
break
fi
done < "$SQL_DOCS_FILELIST"
fi
fi

if [ "$BUILD_SQL_DOCS" = true ]; then
echo "Compiling SQL function docs for the web console..."
./script/create-sql-docs.mjs
# Build SQL docs
if [ "$FORCE_BUILD" = true ]; then
./script/build-sql-docs --force
else
echo "SQL docs are up to date, skipping..."
./script/build-sql-docs
fi

# Get version from package.json
Expand Down
78 changes: 78 additions & 0 deletions web-console/script/build-sql-docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/bash -eu

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

# Check if --force flag is provided
FORCE_BUILD=false
if [[ "$@" == *"--force"* ]]; then
FORCE_BUILD=true
fi

# Function to check if a file is newer than another
is_newer_than() {
# Returns 0 (true) if $1 is newer than $2, 1 (false) otherwise
if [ ! -f "$2" ]; then
return 0 # If target doesn't exist, we need to build
fi
if [ ! -f "$1" ]; then
return 1 # If source doesn't exist, we can't build (will error later)
fi
[ "$1" -nt "$2" ]
}

SQL_DOCS_OUTPUT="lib/sql-docs.ts"
SQL_DOCS_SCRIPT="script/create-sql-docs.mjs"
SQL_DOCS_FILELIST="script/sql-doc-files.txt"

BUILD_SQL_DOCS=false

if [ "$FORCE_BUILD" = true ] || [ ! -f "$SQL_DOCS_OUTPUT" ]; then
BUILD_SQL_DOCS=true
else
# Check if create-sql-docs.mjs is newer than output
if is_newer_than "$SQL_DOCS_SCRIPT" "$SQL_DOCS_OUTPUT"; then
BUILD_SQL_DOCS=true
fi

# Check if sql-doc-files.txt is newer than output
if is_newer_than "$SQL_DOCS_FILELIST" "$SQL_DOCS_OUTPUT"; then
BUILD_SQL_DOCS=true
fi

# Check if any file listed in sql-doc-files.txt is newer than output
if [ -f "$SQL_DOCS_FILELIST" ] && [ "$BUILD_SQL_DOCS" = false ]; then
while read -r file; do
# Skip empty lines and comments
if [[ -z "$file" ]] || [[ "$file" =~ ^[[:space:]]*# ]]; then
continue
fi
if [ -n "$file" ] && is_newer_than "$file" "$SQL_DOCS_OUTPUT"; then
BUILD_SQL_DOCS=true
break
fi
done < "$SQL_DOCS_FILELIST"
fi
fi

if [ "$BUILD_SQL_DOCS" = true ]; then
echo "Compiling SQL function docs for the web console..."
./script/create-sql-docs.mjs
else
echo "SQL docs are up to date, skipping..."
fi
Loading