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
2 changes: 1 addition & 1 deletion ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"test:functional": "vitest run --project functional",
"test:unit": "vitest run --project unit",
"test:sdk-compatibility": "vitest run --project functional sdl-parity.spec.ts",
"compile:validators": "node --experimental-strip-types --no-warnings ./script/compile-json-schema-to-ts.ts",
"compile:validators": "node ./script/compile-json-schema-to-ts.ts",
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 | ⚑ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Current engine range:"
rg -n '"node":\s*".*"' ts/package.json

echo
echo "Node guidance (expect: < v22.18.0 needs --experimental-strip-types):"
curl -fsSL https://nodejs.org/en/learn/typescript/run-natively \
  | rg -n 'less than v22\.18\.0|--experimental-strip-types'

echo
echo "Node TypeScript history (expect: enabled by default from v22.18.0):"
curl -fsSL https://nodejs.org/api/typescript.html \
  | rg -n 'v23\.6\.0, v22\.18\.0|enabled by default'

Repository: akash-network/chain-sdk

Length of output: 2075


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# show the relevant scripts/sections with line numbers
sed -n '30,130p' ts/package.json | cat -n

echo
echo "Occurrences of node running .ts files in scripts:"
rg -n '"scripts"\s*:\s*\{' -n ts/package.json && true
rg -n 'node\s+.*\.ts' ts/package.json || true

echo
echo "compile:validators entry:"
rg -n '"compile:validators"\s*:' ts/package.json

Repository: akash-network/chain-sdk

Length of output: 3382


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Search for experimental-strip-types / experimental-transform-types in ts/:"
rg -n --hidden --no-ignore-vcs 'experimental-strip-types|experimental-transform-types' ts || true

echo
echo "Find script files referenced by ts/package.json:"
fd -t f 'compile-json-schema-to-ts\.ts' -d 4 . || true
fd -t f 'validate-package-exports\.ts' -d 4 . || true

echo
echo "Inspect first ~60 lines of compile-json-schema-to-ts.ts (if found):"
f="$(fd -t f 'compile-json-schema-to-ts\.ts' -d 4 . -E node_modules | head -n 1 || true)"
if [ -n "${f:-}" ]; then
  echo "File: $f"
  head -n 60 "$f" | nl -ba
else
  echo "compile-json-schema-to-ts.ts not found"
fi

echo
echo "Inspect first ~60 lines of validate-package-exports.ts (if found):"
f="$(fd -t f 'validate-package-exports\.ts' -d 4 . -E node_modules | head -n 1 || true)"
if [ -n "${f:-}" ]; then
  echo "File: $f"
  head -n 60 "$f" | nl -ba
else
  echo "validate-package-exports.ts not found"
fi

echo
echo "Search for node invocations that run .ts files anywhere under ts/:"
rg -n 'node\s+[^#\n]*\.ts\b' ts || true

echo
echo "Search for shebangs in .ts files under script/:"
fd -t f '\.ts$' ts/script -d 4 | while read -r p; do
  head -n 1 "$p" | rg -n '^#!' >/dev/null 2>&1 && echo "Shebang in $p: $(head -n 1 "$p" | tr -d '\n')"
done || true

Repository: akash-network/chain-sdk

Length of output: 552


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Search for experimental-strip-types / experimental-transform-types in ts/:"
rg -n --hidden --no-ignore-vcs 'experimental-strip-types|experimental-transform-types' ts || true

echo
echo "Inspect ts/script/compile-json-schema-to-ts.ts (first 120 lines):"
f="./ts/script/compile-json-schema-to-ts.ts"
if [ -f "$f" ]; then
  sed -n '1,120p' "$f" | cat -n
else
  echo "Missing $f"
fi

echo
echo "Inspect ts/script/validate-package-exports.ts (first 120 lines):"
f="./ts/script/validate-package-exports.ts"
if [ -f "$f" ]; then
  sed -n '1,120p' "$f" | cat -n
else
  echo "Missing $f"
fi

echo
echo "Search for node invocations that run .ts files under ts/:"
rg -n 'node\s+[^#\n]*\.ts\b' ts || true

echo
echo "Search for any direct node execution of script/*.ts with flags (e.g., --experimental-strip-types) under ts/:"
rg -n 'node\s+--[^#\n]*\.ts\b' ts || true

Repository: akash-network/chain-sdk

Length of output: 9579


Raise engines.node to >=22.18.0 to match native TypeScript execution

ts/package.json runs node ./script/compile-json-schema-to-ts.ts and ./script/validate-package-exports.ts (both have #!/usr/bin/env -S node and include TS-only syntax like type annotations/assertions). Node’s native TS β€œtype stripping” is enabled by default starting in v22.18.0; for < v22.18.0, running TS files directly requires --experimental-strip-types. With engines.node still set to >=22.14.0 <25, Node 22.14–22.17 can fail at build time.

πŸ”§ Proposed fix
   "engines": {
-    "node": ">=22.14.0 <25"
+    "node": ">=22.18.0 <25"
   },

volta.node is already pinned to 24.14.1, so only the engines.node range needs adjustment.

πŸ€– 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 `@ts/package.json` at line 43, Update the package.json engines.node range to
require Node >=22.18.0 so native TypeScript execution works for the scripts that
run TS files directly; specifically, change the engines.node field to raise the
lower bound (for example to ">=22.18.0 <25") so running scripts like the
"compile:validators" script ("node ./script/compile-json-schema-to-ts.ts") and
"./script/validate-package-exports.ts" won't need --experimental-strip-types
(volta.node can remain pinned at 24.14.1).

"release": "npm run build && npm test && npm publish --tag alpha"
},
"lint-staged": {
Expand Down
2 changes: 1 addition & 1 deletion ts/script/compile-json-schema-to-ts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S node --experimental-strip-types --no-warnings
#!/usr/bin/env -S node

import fs from "node:fs";
import path from "node:path";
Expand Down
2 changes: 1 addition & 1 deletion ts/script/fix-ts-proto-generated-types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S node --experimental-strip-types --no-warnings
#!/usr/bin/env -S node

import { promises as fs } from "node:fs";
import { dirname, relative as relativePath, resolve as resolvePath } from "node:path";
Expand Down
2 changes: 1 addition & 1 deletion ts/script/protoc-gen-customtype-patches.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S node --experimental-strip-types --no-warnings
#!/usr/bin/env -S node

import { type DescField, type DescMessage, ScalarType } from "@bufbuild/protobuf";
import {
Expand Down
2 changes: 1 addition & 1 deletion ts/script/protoc-gen-sdk-object.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S node --experimental-strip-types --no-warnings
#!/usr/bin/env -S node

import { type DescExtension, type DescMethod, type DescService, getOption, hasOption } from "@bufbuild/protobuf";
import {
Expand Down
2 changes: 1 addition & 1 deletion ts/script/protoc-gen-type-index-files.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S node --experimental-strip-types --no-warnings
#!/usr/bin/env -S node

import { type DescEnum, type DescMessage } from "@bufbuild/protobuf";
import {
Expand Down
2 changes: 1 addition & 1 deletion ts/script/validate-package-exports.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S node --experimental-strip-types --no-warnings
#!/usr/bin/env -S node

import { execSync } from "child_process";
import { accessSync, constants as fsConstants, globSync, readFileSync } from "fs";
Expand Down
Loading