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
4 changes: 2 additions & 2 deletions .github/actions/release-tool/npm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ inputs:
required: false
default: 'latest'
tool:
description: 'Tool directory name under tools/ (e.g. npx-thunderid)'
description: 'Tool directory name under tools/ (e.g. npx)'
required: true
bump-type:
description: 'Semver bump type: major, minor, or patch'
Expand Down Expand Up @@ -64,7 +64,7 @@ runs:

- name: 🔨 Build
shell: bash
run: pnpm build:tools
run: pnpm --filter "./tools/${{ inputs.tool }}" build

- name: 📤 Commit and Tag Release
shell: bash
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ on:
- major
default: patch

tool_npx_thunderid:
description: 'thunderid (npx-thunderid)'
npx:
description: 'Release npx tool'
required: false
type: boolean
default: false
Expand All @@ -35,7 +35,7 @@ env:
jobs:
release-npx-thunderid:
name: ⚡ Release thunderid (npx-thunderid)
if: ${{ github.event.inputs.tool_npx_thunderid == 'true' }}
if: ${{ github.event.inputs.npx == 'true' }}
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout Code
Expand All @@ -46,7 +46,7 @@ jobs:
- name: 🚀 Release
uses: ./.github/actions/release-tool/npm
with:
tool: npx-thunderid
tool: npx
bump-type: ${{ github.event.inputs.bump_type }}
git-user-name: ${{ env.RELEASE_GIT_USER_NAME }}
git-user-email: ${{ env.RELEASE_GIT_USER_EMAIL }}
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ test_sdks:
lint_sdks:
./build.sh lint_sdks

build_tools:
./build.sh build_tools

test_tools:
./build.sh test_tools

lint_tools:
./build.sh lint_tools

Comment thread
coderabbitai[bot] marked this conversation as resolved.
lint_docs:
@command -v vale >/dev/null 2>&1 || (echo "vale is not installed. See https://vale.sh/docs/vale-cli/installation/ for installation instructions." && exit 1)
vale docs/
Expand Down Expand Up @@ -214,6 +223,9 @@ help:
@echo " build_sdks - Build all SDK packages."
@echo " test_sdks - Run tests for all SDK packages."
@echo " lint_sdks - Run linting on all SDK packages."
@echo " build_tools - Build all tool binaries (CLI + i18n-extractor + npm tools)."
@echo " test_tools - Run tests for all tools."
@echo " lint_tools - Run linting on all tools."
@echo " lint - Run linting on backend, frontend, and SDK code."
@echo " lint_backend - Run golangci-lint on the backend code."
@echo " lint_frontend - Run ESLint on the frontend code."
Expand Down
110 changes: 109 additions & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,105 @@ function Lint-SDKs {
Write-Host "================================================================"
}

function Build-CLI {
Write-Host "Building CLI tool..."
& bash "$PSScriptRoot/tools/cli/scripts/build.sh"
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
}

function Test-CLI {
Write-Host "Running CLI tool tests..."
Push-Location "$PSScriptRoot/tools/cli"
try {
& go test -v -race -count=1 ./...
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
} finally {
Pop-Location
}
}

function Build-I18n-Extractor {
$toolBin = Join-Path $PSScriptRoot "backend/bin/tools"
New-Item -ItemType Directory -Force -Path $toolBin | Out-Null
Write-Host "Building i18n-extractor..."
Push-Location "$PSScriptRoot/tools/i18n-extractor"
try {
& go build -o "$toolBin/i18n-extractor.exe" .
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
} finally {
Pop-Location
}
}
Comment on lines +550 to +561

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 | 🔴 Critical | ⚡ Quick win

Platform-conditional binary extensions needed in build.ps1.

Build-I18n-Extractor (L551-562) hardcodes i18n-extractor.exe, and both Lint-CLI (L575-585) and Lint-I18n-Extractor (L587-597) hardcode golangci-lint.exe regardless of target OS. Since PowerShell 7 is cross-platform and the script detects $GO_OS, these functions should conditionally append .exe only when $GO_OS -eq "windows", matching the pattern used in Build-Backend (lines 372-374). Without this, builds and linting will fail on Linux and macOS.

🧰 Tools
🪛 PSScriptAnalyzer (1.25.0)

[warning] Missing BOM encoding for non-ASCII encoded file 'build.ps1'

(PSUseBOMForUnicodeEncodedFile)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@build.ps1` around lines 551 - 562, Build-I18n-Extractor, Lint-CLI and
Lint-I18n-Extractor currently hardcode Windows extensions (i18n-extractor.exe
and golangci-lint.exe); change them to compute the binary name like
Build-Backend does by checking $GO_OS and appending ".exe" only when $GO_OS -eq
"windows" (e.g., set a local $exeSuffix or build $binaryName = "i18n-extractor"
+ ($GO_OS -eq "windows" ? ".exe" : "") and use that in & go build and lint
invocations), update references in Build-I18n-Extractor, Lint-CLI, and
Lint-I18n-Extractor so cross-platform builds/linting succeed.


function Test-I18n-Extractor {
Write-Host "Running i18n-extractor tests..."
Push-Location "$PSScriptRoot/tools/i18n-extractor"
try {
& go test -v .
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
} finally {
Pop-Location
}
}

function Lint-CLI {
$golangciLint = Join-Path $PSScriptRoot "backend/bin/tools/golangci-lint.exe"
Write-Host "Linting CLI tool..."
Push-Location "$PSScriptRoot/tools/cli"
try {
& $golangciLint run ./...
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
} finally {
Pop-Location
}
}

function Lint-I18n-Extractor {
$golangciLint = Join-Path $PSScriptRoot "backend/bin/tools/golangci-lint.exe"
Write-Host "Linting i18n-extractor..."
Push-Location "$PSScriptRoot/tools/i18n-extractor"
try {
& $golangciLint run ./...
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
} finally {
Pop-Location
}
}

function Lint-Tools {
Write-Host "================================================================"
Write-Host "Linting tools..."
Lint-CLI
Lint-I18n-Extractor
Write-Host "================================================================"
}

function Build-Npm-Tools {
Ensure-Pnpm
Write-Host "Installing tools dependencies..."
& pnpm install --frozen-lockfile
Write-Host "Building npm-based tools..."
& pnpm --filter './tools/**' build
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
}

function Build-Tools {
Write-Host "================================================================"
Write-Host "Building tools..."
Build-CLI
Build-I18n-Extractor
Build-Npm-Tools
Write-Host "================================================================"
}

function Test-Tools {
Write-Host "================================================================"
Write-Host "Running tool tests..."
Test-CLI
Test-I18n-Extractor
Write-Host "================================================================"
}

function Initialize-Databases {
param(
[bool]$override = $false
Expand Down Expand Up @@ -1793,6 +1892,15 @@ switch ($Command) {
'lint_sdks' {
Lint-SDKs
}
'build_tools' {
Build-Tools
}
'test_tools' {
Test-Tools
}
'lint_tools' {
Lint-Tools
}
'package_samples' {
Package-Sample-App
}
Expand Down Expand Up @@ -1822,7 +1930,7 @@ switch ($Command) {
Test-Integration
}
default {
Write-Host "Usage: $($MyInvocation.MyCommand.Name) {clean|build|build_backend|build_frontend|build_docs|package_samples|test_unit|test_integration|merge_coverage|run|run_backend|run_frontend|run_docs|test}"
Write-Host "Usage: $($MyInvocation.MyCommand.Name) {clean|build|build_backend|build_frontend|build_docs|build_sdks|test_sdks|lint_sdks|build_tools|test_tools|lint_tools|package_samples|test_unit|test_integration|merge_coverage|run|run_backend|run_frontend|run_docs|test}"
exit 1
}
}
85 changes: 85 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,79 @@ function lint_sdks() {
echo "================================================================"
}

function build_cli() {
echo "Building CLI tool..."
bash "$SCRIPT_DIR/tools/cli/scripts/build.sh"
}

function test_cli() {
echo "Running CLI tool tests..."
cd "$SCRIPT_DIR/tools/cli" && go test -v -race -count=1 ./...
cd "$SCRIPT_DIR" || exit 1
}

function build_i18n_extractor() {
local tool_bin="$SCRIPT_DIR/backend/bin/tools"
mkdir -p "$tool_bin"
echo "Building i18n-extractor..."
cd "$SCRIPT_DIR/tools/i18n-extractor" && go build -o "$tool_bin/i18n-extractor" .
cd "$SCRIPT_DIR" || exit 1
}

function test_i18n_extractor() {
echo "Running i18n-extractor tests..."
cd "$SCRIPT_DIR/tools/i18n-extractor" && go test -v .
cd "$SCRIPT_DIR" || exit 1
}

function lint_cli() {
local golangci_lint="$SCRIPT_DIR/backend/bin/tools/golangci-lint"
echo "Linting CLI tool..."
cd "$SCRIPT_DIR/tools/cli" && "$golangci_lint" run ./...
cd "$SCRIPT_DIR" || exit 1
}

function lint_i18n_extractor() {
local golangci_lint="$SCRIPT_DIR/backend/bin/tools/golangci-lint"
echo "Linting i18n-extractor..."
cd "$SCRIPT_DIR/tools/i18n-extractor" && "$golangci_lint" run ./...
cd "$SCRIPT_DIR" || exit 1
}

function lint_tools() {
echo "================================================================"
echo "Linting tools..."
lint_cli
lint_i18n_extractor
echo "================================================================"
}

function build_npm_tools() {
ensure_pnpm
echo "Installing tools dependencies..."
pnpm install --frozen-lockfile
echo "Building npm-based tools..."
pnpm --filter './tools/**' build
cd "$SCRIPT_DIR" || exit 1
}

function build_tools() {
echo "================================================================"
echo "Building tools..."
build_cli
build_i18n_extractor
build_npm_tools
echo "================================================================"
}

function test_tools() {
echo "================================================================"
echo "Running tool tests..."
test_cli
test_i18n_extractor
echo "================================================================"
}

function build_docs() {
echo "================================================================"
echo "Building documentation..."
Expand Down Expand Up @@ -1242,6 +1315,15 @@ case "$1" in
lint_sdks)
lint_sdks
;;
build_tools)
build_tools
;;
test_tools)
test_tools
;;
lint_tools)
lint_tools
;;
package_samples)
package_sample_app
;;
Expand Down Expand Up @@ -1291,6 +1373,9 @@ case "$1" in
echo " build_sdks - Build all SDK packages"
echo " test_sdks - Run tests for all SDK packages"
echo " lint_sdks - Run linting for all SDK packages"
echo " build_tools - Build all tool binaries (CLI + i18n-extractor + npm tools)"
echo " test_tools - Run tests for all tools (CLI + i18n-extractor)"
echo " lint_tools - Run linting for all tools (CLI + i18n-extractor)"
echo " package_samples - Package the sample applications (samples are distributed as source)"
echo " test_unit - Run unit tests with coverage"
echo " test_integration - Run integration tests. Use -run and -package for filtering"
Expand Down
54 changes: 1 addition & 53 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading