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
10 changes: 10 additions & 0 deletions apps/sdk-tools/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import { StrictMode } from 'react'

import 'inter-ui'
import { getRpcProvider } from '@cowprotocol/common-const'
import { setGlobalAdapter, SupportedChainId } from '@cowprotocol/cow-sdk'
import { EthersV5Adapter } from '@cowprotocol/sdk-ethers-v5-adapter'

import { createRoot } from 'react-dom/client'

import { SdkTools } from './SdkTools'

// Initialize the global adapter for the CoW SDK
const adapter = new EthersV5Adapter({
provider: getRpcProvider(SupportedChainId.MAINNET)!,
})
setGlobalAdapter(adapter)

// TODO: Add proper return type annotation
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
function Root() {
Expand Down
4 changes: 1 addition & 3 deletions apps/sdk-tools/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": ["node", "vite/client"],
"composite": true,
"declaration": true
"types": ["node", "vite/client"]
},
Comment on lines 3 to 6
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check for tsconfig files that might reference sdk-tools as a composite project

echo "=== Searching for project references to sdk-tools ==="
rg -n --type=json '"references"' -A 10 | grep -i 'sdk-tools' || echo "No references found to sdk-tools"

echo ""
echo "=== Checking for composite project configurations ==="
fd tsconfig.json --exec rg -l '"composite".*true' {} \;

echo ""
echo "=== Searching for imports from sdk-tools app (unusual for apps) ==="
rg -n "from ['\"].*sdk-tools" --type=ts --type=tsx -g '!apps/sdk-tools/**' || echo "No imports from sdk-tools found"

echo ""
echo "=== Checking the full tsconfig.app.json content ==="
cat apps/sdk-tools/tsconfig.app.json

echo ""
echo "=== Checking tsconfig.json (base config) ==="
cat apps/sdk-tools/tsconfig.json 2>/dev/null || echo "No base tsconfig.json found in apps/sdk-tools"

echo ""
echo "=== Checking if apps/sdk-tools is referenced in root tsconfig ==="
rg -n '"references"' -A 50 tsconfig.json | head -60

Repository: cowprotocol/cowswap

Length of output: 1969


🏁 Script executed:

#!/bin/bash
echo "=== Checking tsconfig.spec.json ==="
cat apps/sdk-tools/tsconfig.spec.json

echo ""
echo "=== Verifying: are composite and declaration in any of the sdk-tools tsconfig files? ==="
grep -r "composite\|declaration" apps/sdk-tools/tsconfig*.json || echo "Not found in any tsconfig files"

echo ""
echo "=== Documentation check: does TypeScript require composite for referenced projects? ==="
echo "TypeScript's project references feature (using 'references' in tsconfig) requires all referenced projects to have 'composite: true'"
echo "Without it, TypeScript compilation will fail with an error like 'Project cannot be built because of the above errors.'"

Repository: cowprotocol/cowswap

Length of output: 1310


Critical: composite: true must be restored to tsconfig.app.json to prevent TypeScript build failure.

The removal of composite: true breaks the project reference chain in apps/sdk-tools/tsconfig.json, which declares references to both tsconfig.app.json and tsconfig.spec.json. TypeScript requires all referenced projects to have composite: true enabled. Currently, only tsconfig.spec.json has this setting, but tsconfig.app.json is missing it. This will cause TypeScript compilation to fail with "Project cannot be built because of the above errors."

Restore "composite": true to the compilerOptions in tsconfig.app.json.

🤖 Prompt for AI Agents
In apps/sdk-tools/tsconfig.app.json around lines 3 to 6, the compilerOptions
block is missing "composite": true which breaks the TypeScript project reference
chain; add "composite": true into the compilerOptions object (alongside outDir
and types) so tsconfig.app.json is a composite project and the references
declared in apps/sdk-tools/tsconfig.json can be built successfully.

"files": ["../../node_modules/@nx/react/typings/cssmodule.d.ts", "../../node_modules/@nx/react/typings/image.d.ts"],
"exclude": [
Expand Down
11 changes: 11 additions & 0 deletions apps/sdk-tools/vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"rewrites": [
{
"source": "/(.*)",
"destination": "/index.html"
}
],
"buildCommand": "cd ../../ && yarn build:sdk-tools",
"outputDirectory": "../../build/sdk-tools",
"installCommand": "cd ../../ && yarn run install:ci"
}