From 44394d877fbdd5114bfa742d896db88351523670 Mon Sep 17 00:00:00 2001 From: ludamad <163993+ludamad@users.noreply.github.com> Date: Thu, 4 Dec 2025 20:55:30 +0000 Subject: [PATCH] chore: use swc in yarn build It turns out tsgo is pretty plainly not ready to be our emit engine for yarn-project due to not supporting decorator transpilation ATM. This makes tsgo only used for type checking, and we make sure to not invoke it to emit any yarn-project packages --- yarn-project/accounts/package.json | 4 +-- yarn-project/accounts/package.local.json | 5 ++- yarn-project/archiver/package.json | 4 +-- yarn-project/aztec-faucet/package.json | 4 +-- yarn-project/aztec-node/package.json | 4 +-- yarn-project/aztec.js/package.json | 4 +-- yarn-project/aztec/package.json | 4 +-- yarn-project/bb-prover/package.json | 4 +-- yarn-project/blob-lib/package.json | 4 +-- yarn-project/blob-sink/package.json | 4 +-- yarn-project/bot/package.json | 4 +-- yarn-project/builder/package.json | 4 +-- yarn-project/cli-wallet/package.json | 4 +-- yarn-project/cli/package.json | 4 +-- yarn-project/constants/package.json | 4 +-- yarn-project/end-to-end/package.json | 4 +-- yarn-project/entrypoints/package.json | 4 +-- yarn-project/epoch-cache/package.json | 4 +-- yarn-project/ethereum/package.json | 4 +-- yarn-project/foundation/package.json | 4 +-- yarn-project/ivc-integration/package.json | 2 +- yarn-project/key-store/package.json | 4 +-- yarn-project/kv-store/package.json | 4 +-- yarn-project/merkle-tree/package.json | 4 +-- yarn-project/native/package.json | 4 +-- yarn-project/node-keystore/package.json | 4 +-- yarn-project/node-lib/package.json | 4 +-- yarn-project/noir-contracts.js/package.json | 2 +- .../noir-protocol-circuits-types/package.json | 2 +- .../noir-test-contracts.js/package.json | 2 +- yarn-project/p2p-bootstrap/package.json | 4 +-- yarn-project/p2p/package.json | 4 +-- yarn-project/package.common.json | 4 +-- yarn-project/protocol-contracts/package.json | 4 +-- .../protocol-contracts/package.local.json | 5 ++- yarn-project/prover-client/package.json | 4 +-- yarn-project/prover-node/package.json | 4 +-- yarn-project/pxe/package.json | 2 +- yarn-project/scripts/tsc.sh | 33 +++++++++++++++++++ yarn-project/sequencer-client/package.json | 4 +-- yarn-project/simulator/package.json | 4 +-- yarn-project/slasher/package.json | 4 +-- yarn-project/stdlib/package.json | 2 +- yarn-project/telemetry-client/package.json | 4 +-- yarn-project/test-wallet/package.json | 4 +-- yarn-project/txe/package.json | 4 +-- yarn-project/validator-client/package.json | 4 +-- yarn-project/wallet-sdk/package.json | 4 +-- yarn-project/world-state/package.json | 4 +-- 49 files changed, 123 insertions(+), 92 deletions(-) create mode 100755 yarn-project/scripts/tsc.sh diff --git a/yarn-project/accounts/package.json b/yarn-project/accounts/package.json index ac78c98137fa..0ee62510a8b8 100644 --- a/yarn-project/accounts/package.json +++ b/yarn-project/accounts/package.json @@ -32,10 +32,10 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && yarn generate && tsgo -b", + "build": "yarn clean && yarn generate && ../scripts/tsc.sh", "generate": "yarn generate:noir-contracts", "generate:noir-contracts": "./scripts/copy-contracts.sh", - "build:dev": "tsgo -b --watch", + "build:dev": "../scripts/tsc.sh --watch", "build:ts": "tsgo -b", "clean": "rm -rf ./dest .tsbuildinfo ./artifacts", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" diff --git a/yarn-project/accounts/package.local.json b/yarn-project/accounts/package.local.json index 4165bbb02ada..c95872fd3d4a 100644 --- a/yarn-project/accounts/package.local.json +++ b/yarn-project/accounts/package.local.json @@ -1,10 +1,9 @@ { "scripts": { - "build": "yarn clean && yarn generate && tsgo -b", + "build": "yarn clean && yarn generate && ../scripts/tsc.sh", "generate": "yarn generate:noir-contracts", "generate:noir-contracts": "./scripts/copy-contracts.sh", - "build:dev": "tsgo -b --watch", - "build:ts": "tsgo -b", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo ./artifacts" }, "files": ["dest", "src", "artifacts", "!*.test.*"] diff --git a/yarn-project/archiver/package.json b/yarn-project/archiver/package.json index 40808248b3b6..8688a75c0e49 100644 --- a/yarn-project/archiver/package.json +++ b/yarn-project/archiver/package.json @@ -17,8 +17,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}", "test:integration": "concurrently -k -s first -c reset,dim -n test,anvil \"yarn test:integration:run\" \"anvil\"", diff --git a/yarn-project/aztec-faucet/package.json b/yarn-project/aztec-faucet/package.json index 8af0b14a3a9c..0c18833e717b 100644 --- a/yarn-project/aztec-faucet/package.json +++ b/yarn-project/aztec-faucet/package.json @@ -17,8 +17,8 @@ }, "scripts": { "start": "node --no-warnings ./dest/bin", - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" }, diff --git a/yarn-project/aztec-node/package.json b/yarn-project/aztec-node/package.json index 10825d08a5b7..8902ba77f885 100644 --- a/yarn-project/aztec-node/package.json +++ b/yarn-project/aztec-node/package.json @@ -20,8 +20,8 @@ "scripts": { "start": "node --no-warnings ./dest/bin", "start:debug": "node --no-warnings --inspect ./dest/bin", - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" }, diff --git a/yarn-project/aztec.js/package.json b/yarn-project/aztec.js/package.json index 2967e01ea092..42103ef36c12 100644 --- a/yarn-project/aztec.js/package.json +++ b/yarn-project/aztec.js/package.json @@ -36,8 +36,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "build:ts": "tsgo -b", "clean": "rm -rf ./dest .tsbuildinfo ./src/account_contract/artifacts", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" diff --git a/yarn-project/aztec/package.json b/yarn-project/aztec/package.json index 50a5c8bcf377..20f28cf25100 100644 --- a/yarn-project/aztec/package.json +++ b/yarn-project/aztec/package.json @@ -15,12 +15,12 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", + "build": "yarn clean && ../scripts/tsc.sh", "start": "node --no-warnings ./dest/bin", "start:debug": "node --inspect=0.0.0.0:9221 --no-warnings ./dest/bin", "start:local-network": "ETHEREUM_HOSTS=http://0.0.0.0:8545/ && yarn start start --local-network", "clean": "rm -rf ./dest .tsbuildinfo", - "build:dev": "tsgo -b --watch", + "build:dev": "../scripts/tsc.sh --watch", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}", "run:example:token": "LOG_LEVEL='verbose' node ./dest/examples/token.js" }, diff --git a/yarn-project/bb-prover/package.json b/yarn-project/bb-prover/package.json index 8b3e24e42fea..ef5be6dcdf38 100644 --- a/yarn-project/bb-prover/package.json +++ b/yarn-project/bb-prover/package.json @@ -25,8 +25,8 @@ "../package.common.json" ], "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "bb": "node --no-warnings ./dest/bb/index.js", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" diff --git a/yarn-project/blob-lib/package.json b/yarn-project/blob-lib/package.json index 94315bcb4530..42bae1560520 100644 --- a/yarn-project/blob-lib/package.json +++ b/yarn-project/blob-lib/package.json @@ -16,8 +16,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "start:dev": "concurrently -k \"tsgo -b -w\" \"nodemon --watch dest --exec yarn start\"", "start": "node ./dest/index.js", diff --git a/yarn-project/blob-sink/package.json b/yarn-project/blob-sink/package.json index adc1ac879a5e..f76e46eebb84 100644 --- a/yarn-project/blob-sink/package.json +++ b/yarn-project/blob-sink/package.json @@ -15,8 +15,8 @@ "../package.common.json" ], "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" }, diff --git a/yarn-project/bot/package.json b/yarn-project/bot/package.json index 26ae54309630..99ad8bc1e2ed 100644 --- a/yarn-project/bot/package.json +++ b/yarn-project/bot/package.json @@ -10,8 +10,8 @@ "../package.common.json" ], "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "bb": "node --no-warnings ./dest/bb/index.js", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" diff --git a/yarn-project/builder/package.json b/yarn-project/builder/package.json index 8c3b399bef9c..f87a973dbf50 100644 --- a/yarn-project/builder/package.json +++ b/yarn-project/builder/package.json @@ -17,8 +17,8 @@ "aztec-builder": "dest/bin/cli.js" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "generate": "tsgo -b", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" diff --git a/yarn-project/cli-wallet/package.json b/yarn-project/cli-wallet/package.json index dde01f26a58b..887b332acb3f 100644 --- a/yarn-project/cli-wallet/package.json +++ b/yarn-project/cli-wallet/package.json @@ -20,8 +20,8 @@ "start": "node --no-warnings ./dest/bin", "start:debug": "node --inspect=0.0.0.0:9221 --no-warnings ./dest/bin", "dev": "LOG_LEVEL=debug && node ./dest/bin", - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" }, diff --git a/yarn-project/cli/package.json b/yarn-project/cli/package.json index 8f22645f4381..2c271ee9789c 100644 --- a/yarn-project/cli/package.json +++ b/yarn-project/cli/package.json @@ -24,8 +24,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" }, diff --git a/yarn-project/constants/package.json b/yarn-project/constants/package.json index b7334ad94137..b5d29ca270ef 100644 --- a/yarn-project/constants/package.json +++ b/yarn-project/constants/package.json @@ -9,8 +9,8 @@ ".": "./dest/constants.js" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "remake-constants": "node --loader @swc-node/register/esm src/scripts/constants.in.ts && cd ../../l1-contracts && forge fmt", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" diff --git a/yarn-project/end-to-end/package.json b/yarn-project/end-to-end/package.json index 487cdf02a2da..d304696a4a74 100644 --- a/yarn-project/end-to-end/package.json +++ b/yarn-project/end-to-end/package.json @@ -8,8 +8,8 @@ "./package.local.json" ], "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test:with-alerts": "./scripts/test-with-alerts.sh", "test:e2e": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000 --forceExit", diff --git a/yarn-project/entrypoints/package.json b/yarn-project/entrypoints/package.json index c0e761023a1f..5ef3a97535bd 100644 --- a/yarn-project/entrypoints/package.json +++ b/yarn-project/entrypoints/package.json @@ -20,8 +20,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "build:ts": "tsgo -b", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" diff --git a/yarn-project/epoch-cache/package.json b/yarn-project/epoch-cache/package.json index 63c5fc4c70dc..2eabaac97f46 100644 --- a/yarn-project/epoch-cache/package.json +++ b/yarn-project/epoch-cache/package.json @@ -15,8 +15,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "start:dev": "concurrently -k \"tsgo -b -w\" \"nodemon --watch dest --exec yarn start\"", "start": "node ./dest/index.js", diff --git a/yarn-project/ethereum/package.json b/yarn-project/ethereum/package.json index 52f7222b155f..64b252c36523 100644 --- a/yarn-project/ethereum/package.json +++ b/yarn-project/ethereum/package.json @@ -19,8 +19,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "start:dev": "concurrently -k \"tsgo -b -w\" \"nodemon --watch dest --exec yarn start\"", "start": "node ./dest/index.js", diff --git a/yarn-project/foundation/package.json b/yarn-project/foundation/package.json index a3b7d369cf28..6a06d3eed27f 100644 --- a/yarn-project/foundation/package.json +++ b/yarn-project/foundation/package.json @@ -58,8 +58,8 @@ "./number": "./dest/number/index.js" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "generate": "true", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" diff --git a/yarn-project/ivc-integration/package.json b/yarn-project/ivc-integration/package.json index ccd4b4a22c1d..6d57f3b3143d 100644 --- a/yarn-project/ivc-integration/package.json +++ b/yarn-project/ivc-integration/package.json @@ -18,7 +18,7 @@ "generate:noir-circuits": "mkdir -p ./artifacts && cp -r ../../noir-projects/mock-protocol-circuits/target/* ./artifacts && node --no-warnings --loader @swc-node/register/esm src/scripts/generate_declaration_files.ts && node --no-warnings --loader @swc-node/register/esm src/scripts/generate_ts_from_abi.ts", "test": "RAYON_NUM_THREADS=4 NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests ", "codegen": "yarn noir-codegen", - "build:dev": "tsgo -b --watch", + "build:dev": "../scripts/tsc.sh --watch", "serve": "serve -n -L -p 8080 -c ../serve.mt.json dest" }, "jest": { diff --git a/yarn-project/key-store/package.json b/yarn-project/key-store/package.json index 26fc936667a9..b2d164120a81 100644 --- a/yarn-project/key-store/package.json +++ b/yarn-project/key-store/package.json @@ -11,8 +11,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" }, diff --git a/yarn-project/kv-store/package.json b/yarn-project/kv-store/package.json index 6e5e232e1742..716551c832e4 100644 --- a/yarn-project/kv-store/package.json +++ b/yarn-project/kv-store/package.json @@ -11,8 +11,8 @@ "./config": "./dest/config.js" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test:node": "NODE_NO_WARNINGS=1 mocha --config ./.mocharc.json", "test:browser": "wtr --config ./web-test-runner.config.mjs", diff --git a/yarn-project/merkle-tree/package.json b/yarn-project/merkle-tree/package.json index 547aa4bb4af0..a7bdabf540c8 100644 --- a/yarn-project/merkle-tree/package.json +++ b/yarn-project/merkle-tree/package.json @@ -11,8 +11,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" }, diff --git a/yarn-project/native/package.json b/yarn-project/native/package.json index 77af250ed30a..2535f1a9e524 100644 --- a/yarn-project/native/package.json +++ b/yarn-project/native/package.json @@ -6,8 +6,8 @@ ".": "./dest/index.js" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" }, diff --git a/yarn-project/node-keystore/package.json b/yarn-project/node-keystore/package.json index 1a56d387820e..99a08c193cb6 100644 --- a/yarn-project/node-keystore/package.json +++ b/yarn-project/node-keystore/package.json @@ -16,8 +16,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" }, diff --git a/yarn-project/node-lib/package.json b/yarn-project/node-lib/package.json index 725e720ad68e..b839c1bf241f 100644 --- a/yarn-project/node-lib/package.json +++ b/yarn-project/node-lib/package.json @@ -13,8 +13,8 @@ "../package.common.json" ], "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "bb": "node --no-warnings ./dest/bb/index.js", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" diff --git a/yarn-project/noir-contracts.js/package.json b/yarn-project/noir-contracts.js/package.json index db6f05f86f6f..659240d31725 100644 --- a/yarn-project/noir-contracts.js/package.json +++ b/yarn-project/noir-contracts.js/package.json @@ -9,7 +9,7 @@ }, "scripts": { "build": "yarn clean && yarn generate", - "build:dev": "tsgo -b --watch", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo ./artifacts ./src ./codegenCache.json", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}", "generate": "yarn generate:noir-contracts", diff --git a/yarn-project/noir-protocol-circuits-types/package.json b/yarn-project/noir-protocol-circuits-types/package.json index 9bbbb8bc45d4..7a3a1bd2cec4 100644 --- a/yarn-project/noir-protocol-circuits-types/package.json +++ b/yarn-project/noir-protocol-circuits-types/package.json @@ -23,7 +23,7 @@ "generate": "./scripts/generate.sh", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}", "codegen": "yarn noir-codegen", - "build:dev": "tsgo -b --watch" + "build:dev": "../scripts/tsc.sh --watch" }, "jest": { "moduleNameMapper": { diff --git a/yarn-project/noir-test-contracts.js/package.json b/yarn-project/noir-test-contracts.js/package.json index bc851262ea60..67b8706bcc93 100644 --- a/yarn-project/noir-test-contracts.js/package.json +++ b/yarn-project/noir-test-contracts.js/package.json @@ -9,7 +9,7 @@ }, "scripts": { "build": "yarn clean && yarn generate", - "build:dev": "tsgo -b --watch", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo ./artifacts ./src ./codegenCache.json", "formatting": "run -T prettier --check ./src && run -T eslint ./src", "formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src", diff --git a/yarn-project/p2p-bootstrap/package.json b/yarn-project/p2p-bootstrap/package.json index 9c3492dcc004..3ca3458827be 100644 --- a/yarn-project/p2p-bootstrap/package.json +++ b/yarn-project/p2p-bootstrap/package.json @@ -11,8 +11,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "start:dev": "concurrently -k \"tsgo -b -w\" \"nodemon --watch dest --exec yarn start\"", "start": "node ./dest/index.js", diff --git a/yarn-project/p2p/package.json b/yarn-project/p2p/package.json index a5ec554acb36..302e5d03dc43 100644 --- a/yarn-project/p2p/package.json +++ b/yarn-project/p2p/package.json @@ -19,8 +19,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}", "start": "node ./dest", diff --git a/yarn-project/package.common.json b/yarn-project/package.common.json index 1a2c9d55fcbf..b0eeb9e599e9 100644 --- a/yarn-project/package.common.json +++ b/yarn-project/package.common.json @@ -1,7 +1,7 @@ { "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" }, diff --git a/yarn-project/protocol-contracts/package.json b/yarn-project/protocol-contracts/package.json index e943d5a5c47a..87fb6087ebaa 100644 --- a/yarn-project/protocol-contracts/package.json +++ b/yarn-project/protocol-contracts/package.json @@ -21,12 +21,12 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && yarn generate && yarn generate:cleanup-artifacts && tsgo -b", + "build": "yarn clean && yarn generate && yarn generate:cleanup-artifacts && ../scripts/tsc.sh", "build:keep-debug-symbols": "yarn clean && yarn generate && tsgo -b", "generate": "yarn generate:data", "generate:cleanup-artifacts": "node --no-warnings --loader @swc-node/register/esm src/scripts/cleanup_artifacts.ts", "generate:data": "node --no-warnings --loader @swc-node/register/esm src/scripts/generate_data.ts", - "build:dev": "tsgo -b --watch", + "build:dev": "../scripts/tsc.sh --watch", "build:ts": "tsgo -b", "clean": "rm -rf ./dest .tsbuildinfo ./artifacts", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" diff --git a/yarn-project/protocol-contracts/package.local.json b/yarn-project/protocol-contracts/package.local.json index 0cdd8962c415..9bbdf6a9d751 100644 --- a/yarn-project/protocol-contracts/package.local.json +++ b/yarn-project/protocol-contracts/package.local.json @@ -1,8 +1,7 @@ { "scripts": { - "build": "yarn clean && yarn generate && yarn generate:cleanup-artifacts && tsgo -b", - "build:dev": "tsgo -b --watch", - "build:ts": "tsgo -b", + "build": "yarn clean && yarn generate && yarn generate:cleanup-artifacts && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo ./artifacts" }, "files": ["dest", "src", "artifacts", "!*.test.*"] diff --git a/yarn-project/prover-client/package.json b/yarn-project/prover-client/package.json index 10de59458b98..c807c4600355 100644 --- a/yarn-project/prover-client/package.json +++ b/yarn-project/prover-client/package.json @@ -22,8 +22,8 @@ "./package.local.json" ], "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "bb": "node --no-warnings ./dest/bb/index.js", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=3500000 --forceExit", diff --git a/yarn-project/prover-node/package.json b/yarn-project/prover-node/package.json index bcc41809ef6a..23983c549ff6 100644 --- a/yarn-project/prover-node/package.json +++ b/yarn-project/prover-node/package.json @@ -11,8 +11,8 @@ "../package.common.json" ], "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "bb": "node --no-warnings ./dest/bb/index.js", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}", diff --git a/yarn-project/pxe/package.json b/yarn-project/pxe/package.json index f4330c85c4cc..95217a1e5d6b 100644 --- a/yarn-project/pxe/package.json +++ b/yarn-project/pxe/package.json @@ -12,7 +12,7 @@ "bin": "./dest/bin/index.js", "scripts": { "build": "yarn clean && yarn generate && tsgo -b", - "build:dev": "tsgo -b --watch", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo ./src/config/package_info.ts", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}", "generate": "node ./scripts/generate_package_info.js", diff --git a/yarn-project/scripts/tsc.sh b/yarn-project/scripts/tsc.sh new file mode 100755 index 000000000000..b30c77d60757 --- /dev/null +++ b/yarn-project/scripts/tsc.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# Combines tsgo (type-checking + declaration emit) with swc (JS transpilation) in parallel. +# - tsgo -b --emitDeclarationOnly: Generates .d.ts declaration files only and performs type-checking +# - swc: Generates .js files (faster transpilation than tsc, supports decorators) +# +# Usage: ../scripts/tsc.sh [--watch] +# +# The script expects to be run from a package directory (e.g., yarn-project/foundation). + +set -euo pipefail + +WATCH_MODE=false +if [[ "${1:-}" == "--watch" ]] || [[ "${1:-}" == "-w" ]]; then + WATCH_MODE=true +fi + +# Get the directory where this script is located +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +YARN_PROJECT_DIR="$(dirname "$SCRIPT_DIR")" + +# Run tsgo for type-checking + declarations and swc for JS transpilation in parallel +if $WATCH_MODE; then + # In watch mode, run both in parallel + parallel --line-buffered --tag ::: \ + "tsgo -b --emitDeclarationOnly --watch" \ + "$YARN_PROJECT_DIR/node_modules/.bin/swc src -d dest --config-file=$YARN_PROJECT_DIR/.swcrc --strip-leading-paths --watch" +else + # In non-watch mode, run both in parallel and wait for both to complete + # If either fails, the script will exit with an error + parallel --halt now,fail=1 ::: \ + "tsgo -b --emitDeclarationOnly" \ + "$YARN_PROJECT_DIR/node_modules/.bin/swc src -d dest --config-file=$YARN_PROJECT_DIR/.swcrc --strip-leading-paths" +fi diff --git a/yarn-project/sequencer-client/package.json b/yarn-project/sequencer-client/package.json index 4bd0d866b9e0..8b45e00b7f61 100644 --- a/yarn-project/sequencer-client/package.json +++ b/yarn-project/sequencer-client/package.json @@ -18,8 +18,8 @@ "../package.common.json" ], "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}", "test:integration": "concurrently -k -s first -c reset,dim -n test,anvil \"yarn test:integration:run\" \"anvil\"", diff --git a/yarn-project/simulator/package.json b/yarn-project/simulator/package.json index 804fc68a9ad6..bd8310c2d92c 100644 --- a/yarn-project/simulator/package.json +++ b/yarn-project/simulator/package.json @@ -17,8 +17,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}", "build:fuzzer": "tsgo scripts/fuzzing/avm_simulator_bin.ts --outDir dest/scripts/fuzzing --module commonjs --target es2022 --esModuleInterop --allowSyntheticDefaultImports --resolveJsonModule --skipLibCheck" diff --git a/yarn-project/slasher/package.json b/yarn-project/slasher/package.json index 2f785d5b861b..fb089f25cbce 100644 --- a/yarn-project/slasher/package.json +++ b/yarn-project/slasher/package.json @@ -10,8 +10,8 @@ "../package.common.json" ], "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "bb": "node --no-warnings ./dest/bb/index.js", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" diff --git a/yarn-project/stdlib/package.json b/yarn-project/stdlib/package.json index e14bd2181f84..87788017caf2 100644 --- a/yarn-project/stdlib/package.json +++ b/yarn-project/stdlib/package.json @@ -66,7 +66,7 @@ "scripts": { "build": "yarn clean && yarn generate && tsgo -b", "generate": "./scripts/copy-contracts.sh", - "build:dev": "tsgo -b --watch", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" }, diff --git a/yarn-project/telemetry-client/package.json b/yarn-project/telemetry-client/package.json index 5d8d8cc92413..0b05a1f7e48e 100644 --- a/yarn-project/telemetry-client/package.json +++ b/yarn-project/telemetry-client/package.json @@ -11,8 +11,8 @@ "./otel-pino-stream": "./dest/vendor/otel-pino-stream.js" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" }, diff --git a/yarn-project/test-wallet/package.json b/yarn-project/test-wallet/package.json index 66a8ec317ca0..6de139e79162 100644 --- a/yarn-project/test-wallet/package.json +++ b/yarn-project/test-wallet/package.json @@ -15,8 +15,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "build:ts": "tsgo -b", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" diff --git a/yarn-project/txe/package.json b/yarn-project/txe/package.json index 640febb610e3..65c612be8af5 100644 --- a/yarn-project/txe/package.json +++ b/yarn-project/txe/package.json @@ -12,8 +12,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}", "dev": "LOG_LEVEL=\"debug; trace: simulator:state_manager; info: json-rpc:proxy\" node ./dest/bin/index.js", diff --git a/yarn-project/validator-client/package.json b/yarn-project/validator-client/package.json index 8e828b12807f..0f2722819286 100644 --- a/yarn-project/validator-client/package.json +++ b/yarn-project/validator-client/package.json @@ -18,8 +18,8 @@ }, "scripts": { "start": "node --no-warnings ./dest/bin", - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" }, diff --git a/yarn-project/wallet-sdk/package.json b/yarn-project/wallet-sdk/package.json index 185d56d1812c..b5775155bc69 100644 --- a/yarn-project/wallet-sdk/package.json +++ b/yarn-project/wallet-sdk/package.json @@ -15,8 +15,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "build:ts": "tsc -b", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" diff --git a/yarn-project/world-state/package.json b/yarn-project/world-state/package.json index 1320a4fb0f80..18da1a2ee40d 100644 --- a/yarn-project/world-state/package.json +++ b/yarn-project/world-state/package.json @@ -18,8 +18,8 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsgo -b", - "build:dev": "tsgo -b --watch", + "build": "yarn clean && ../scripts/tsc.sh", + "build:dev": "../scripts/tsc.sh --watch", "clean": "rm -rf ./dest .tsbuildinfo", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}" },