build: make webmcp-types sources genrule cross-platform

Replace `sed -i` in-place substitution with direct stdout redirection from the source file to destination outputs. `sed -i` behaves differently between GNU and BSD sed, which caused build failures on macOS.
This commit is contained in:
Alan Agius
2026-09-10 07:14:28 +00:00
committed by Andrew Scott
parent 8576f161ae
commit 593a5df61c
+2 -4
View File
@@ -11,11 +11,9 @@ genrule(
cmd = """
readonly SRC_DIR="$(location //packages/core:node_modules/@mcp-b/webmcp-types/dir)"
mkdir -p "$$(dirname "$(location dist/common.d.ts)")"
cp "$${SRC_DIR}/dist/common.d.ts" "$(location dist/common.d.ts)"
# Rewrite bare imports of @modelcontextprotocol/server to use the vendored relative path
sed -i 's|@modelcontextprotocol/server|../../../@modelcontextprotocol/server/index.js|g' "$(location dist/common.d.ts)" || true
cp "$${SRC_DIR}/dist/json-schema.d.ts" "$(location dist/json-schema.d.ts)"
sed -i 's|@modelcontextprotocol/server|../../../@modelcontextprotocol/server/index.js|g' "$(location dist/json-schema.d.ts)" || true
sed 's|@modelcontextprotocol/server|../../../@modelcontextprotocol/server/index.js|g' "$${SRC_DIR}/dist/common.d.ts" > "$(location dist/common.d.ts)"
sed 's|@modelcontextprotocol/server|../../../@modelcontextprotocol/server/index.js|g' "$${SRC_DIR}/dist/json-schema.d.ts" > "$(location dist/json-schema.d.ts)"
cp "$${SRC_DIR}/LICENSE" "$(location LICENSE)"
""",
)