mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 08:01:35 +00:00
preprocess script for pkg export
This commit is contained in:
@@ -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",
|
||||
|
||||
Executable
+53
@@ -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 "^<!--"; then
|
||||
# Uncomment the block
|
||||
sed -i "/$start_marker/,/$escaped_end_marker/{
|
||||
s|^<!-- ||
|
||||
s| -->$||
|
||||
}" "$FILE"
|
||||
else
|
||||
# Comment the block
|
||||
sed -i "/$start_marker/,/$escaped_end_marker/{
|
||||
s|^|<!-- |
|
||||
s|$| -->|
|
||||
}" "$FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
# Define the line and block
|
||||
LINE=" import UnsavedConfirmationModal "
|
||||
BLOCK_START="<UnsavedConfirmationModal"
|
||||
BLOCK_END="/>"
|
||||
|
||||
# Toggle the line comment
|
||||
toggle_line_comment "$LINE"
|
||||
|
||||
# Toggle the first block comment
|
||||
toggle_first_block_comment "$BLOCK_START" "$BLOCK_END"
|
||||
|
||||
echo "Toggled line and first block comments in $FILE."
|
||||
Reference in New Issue
Block a user