Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/test-ui-components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
# 1G = 1073741824
gc-max-store-size-linux: 1G

- run: ./prep-all.sh
- run: ./prep-webapp.sh
env:
PUBLIC_WALLETCONNECT_PROJECT_ID: ${{ secrets.WALLETCONNECT_PROJECT_ID || 'test' }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-webapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
# 1G = 1073741824
gc-max-store-size-linux: 1G

- run: ./prep-all.sh
- run: ./prep-webapp.sh
env:
PUBLIC_WALLETCONNECT_PROJECT_ID: ${{ secrets.WALLETCONNECT_PROJECT_ID || 'test' }}

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/vercel-preview-pr-target.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ jobs:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- run: ./prep-all.sh

- run: ./prep-webapp.sh
env:
PUBLIC_WALLETCONNECT_PROJECT_ID: test

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vercel-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
# 1G = 1073741824
gc-max-store-size-linux: 1G

- run: ./prep-all.sh
- run: ./prep-webapp.sh
env:
PUBLIC_WALLETCONNECT_PROJECT_ID: ${{ secrets.WALLETCONNECT_PROJECT_ID }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vercel-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
# 1G = 1073741824
gc-max-store-size-linux: 1G

- run: ./prep-all.sh
- run: ./prep-webapp.sh
env:
PUBLIC_WALLETCONNECT_PROJECT_ID: ${{ secrets.WALLETCONNECT_PROJECT_ID }}

Expand Down
1 change: 1 addition & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ path = [
"tauri-app/**/",
"test-resources/**/",
"prep-base.sh",
"prep-webapp.sh",
]
SPDX-FileCopyrightText = "Copyright (c) 2020 Rain Open Source Software Ltd"
SPDX-License-Identifier = "LicenseRef-DCL-1.0"
57 changes: 57 additions & 0 deletions prep-webapp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

# Set strict error handling
set -euxo pipefail

echo "Starting project setup..."

# Environment variables that need to be set (commented out as reference)
# export CI_DEPLOY_SEPOLIA_RPC_URL=""
# export CI_FORK_SEPOLIA_DEPLOYER_ADDRESS=""
# export CI_FORK_SEPOLIA_BLOCK_NUMBER=""
# export CI_DEPLOY_POLYGON_RPC_URL=""
# export CI_SEPOLIA_METABOARD_URL=""
# export RPC_URL_ETHEREUM_FORK=""
# export COMMIT_SHA=""

# Keep environment variables when using nix-develop
keep=(
-k CI_DEPLOY_SEPOLIA_RPC_URL
-k CI_FORK_SEPOLIA_DEPLOYER_ADDRESS
-k CI_FORK_SEPOLIA_BLOCK_NUMBER
-k CI_DEPLOY_POLYGON_RPC_URL
-k CI_SEPOLIA_METABOARD_URL
-k RPC_URL_ETHEREUM_FORK
-k COMMIT_SHA
-k PUBLIC_WALLETCONNECT_PROJECT_ID
)

echo "Preparing base setup..."
./prep-base.sh

echo "Building packages..."
nix develop -i ${keep[@]} -c bash -c '(npm run build -w @rainlanguage/orderbook)'
nix develop -i ${keep[@]} -c bash -c '(npm run build -w @rainlanguage/ui-components && npm run build -w @rainlanguage/webapp)'
Comment on lines +33 to +34

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix array expansion to prevent re-splitting.

Double-quote the array expansion to follow shell best practices and avoid unintended re-splitting if array elements contain spaces.

Apply this diff:

-nix develop -i ${keep[@]} -c bash -c '(npm run build -w @rainlanguage/orderbook)'
-nix develop -i ${keep[@]} -c bash -c '(npm run build -w @rainlanguage/ui-components && npm run build -w @rainlanguage/webapp)'
+nix develop -i "${keep[@]}" -c bash -c '(npm run build -w @rainlanguage/orderbook)'
+nix develop -i "${keep[@]}" -c bash -c '(npm run build -w @rainlanguage/ui-components && npm run build -w @rainlanguage/webapp)'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
nix develop -i ${keep[@]} -c bash -c '(npm run build -w @rainlanguage/orderbook)'
nix develop -i ${keep[@]} -c bash -c '(npm run build -w @rainlanguage/ui-components && npm run build -w @rainlanguage/webapp)'
nix develop -i "${keep[@]}" -c bash -c '(npm run build -w @rainlanguage/orderbook)'
nix develop -i "${keep[@]}" -c bash -c '(npm run build -w @rainlanguage/ui-components && npm run build -w @rainlanguage/webapp)'
🧰 Tools
🪛 Shellcheck (0.11.0)

[error] 33-33: Double quote array expansions to avoid re-splitting elements.

(SC2068)


[error] 34-34: Double quote array expansions to avoid re-splitting elements.

(SC2068)

🤖 Prompt for AI Agents
In prep-webapp.sh around lines 33 to 34, the array expansion ${keep[@]} is
unquoted which can cause elements with spaces to be split; update both commands
to use the quoted expansion "${keep[@]}" so each array element is preserved as a
single word when passed to nix develop.


# Temporarily disable command echoing
set +x

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

GREEN='\033[0;32m'
NC='\033[0m' # No Color
Comment on lines +42 to +43

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove unused variables.

Lines 42-43 define GREEN and NC variables that are never used in the script; the ANSI codes are hardcoded directly in the printf statements. Remove these dead-code definitions.

Apply this diff:

 export LANG=en_US.UTF-8
 export LC_ALL=en_US.UTF-8

-GREEN='\033[0;32m'
-NC='\033[0m' # No Color
-
 # Print the completion message
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
GREEN='\033[0;32m'
NC='\033[0m' # No Color
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# Print the completion message
🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 42-42: GREEN appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 43-43: NC appears unused. Verify use (or export if used externally).

(SC2034)

🤖 Prompt for AI Agents
In prep-webapp.sh around lines 42 to 43, the script defines unused color
variables GREEN and NC; remove these dead-variable definitions so the script no
longer contains unused ANSI color assignments and relies on the existing
hardcoded escape sequences in printf statements.


# Print the completion message
printf "\033[0;32m" # Set text to green
printf "╔════════════════════════════════════════════════════════════════════════╗\n"
printf "║ Setup Complete! ║\n"
printf "╠════════════════════════════════════════════════════════════════════════╣\n"
printf "║ How to run the apps: ║\n"
printf "║ ║\n"
printf "║ To run webapp: cd packages/webapp && nix develop -c npm run dev ║\n"
printf "╚════════════════════════════════════════════════════════════════════════╝\n"
printf "\033[0m" # Reset text color

# Re-enable command echoing
set -x