diff --git a/frontend/package.json b/frontend/package.json index 5b1e58a63e..5b358f953e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,7 +9,7 @@ "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch", "lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .", "format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. .", - "package": "svelte-package -o package", + "package": "./preprocess_pkg_toggle.sh && svelte-package -o package && ./preprocess_pkg_toggle.sh", "generate-backend-client": "openapi-ts --input ../backend/windmill-api/openapi.yaml --output ./src/lib/gen --useOptions --enums javascript --format false", "generate-backend-client-mac": "openapi-ts --input ../backend/windmill-api/openapi.yaml --output ./src/lib/gen --useOptions --enums javascript", "pretest": "tsc --incremental -p tests/tsconfig.json", diff --git a/frontend/preprocess_pkg_toggle.sh b/frontend/preprocess_pkg_toggle.sh new file mode 100755 index 0000000000..a700cae919 --- /dev/null +++ b/frontend/preprocess_pkg_toggle.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# Define the file to modify +FILE="src/lib/components/apps/editor/AppEditorHeader.svelte" + +# Function to toggle commenting of a line +toggle_line_comment() { + local line="$1" + if grep -q "^//$line" "$FILE"; then + # Uncomment the line + sed -i "s|^//$line|$line|" "$FILE" + else + # Comment the line + sed -i "s|^$line|//$line|" "$FILE" + fi +} + +# Function to toggle commenting of the first matching block +toggle_first_block_comment() { + local start_marker="$1" + local end_marker="$2" + + # Escape the end marker for use in sed + local escaped_end_marker=$(echo "$end_marker" | sed 's|/|\\/|g') + + # Check if the block is already commented + if sed -n "/$start_marker/,/$escaped_end_marker/p" "$FILE" | grep -q "^$|| + }" "$FILE" + else + # Comment the block + sed -i "/$start_marker/,/$escaped_end_marker/{ + s|^|| + }" "$FILE" + fi +} + +# Define the line and block +LINE=" import UnsavedConfirmationModal " +BLOCK_START="