stagehand/turbo.json
Sean McGuire 66f6dbf981
[chore]: simplify build for browser-side scripts (#1988)
# why

# what changed

# test plan

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Unifies the build for browser-injected DOM scripts by replacing four
generators with a single builder. Simplifies the pipeline and removes
redundant file copying, with no runtime changes expected.

- **Refactors**
- Added `scripts/build-dom-scripts.ts` to build all DOM-injected assets:
IIFE strings for `piercer.entry.ts` and
`rerenderMissingShadows.entry.ts`; bootstrap + per-function sources for
`locator` (`__stagehandLocatorScripts`) and `a11y`
(`__stagehandA11yScripts`); sources-only for `screenshot` scripts.
- Removed `genDomScripts.ts`, `genLocatorScripts.ts`,
`genScreenshotScripts.ts`, `genA11yScripts.ts`.
- Updated `packages/core/package.json` to a single `build-dom-scripts`
command and simplified `turbo.json` to one task with
`lib/v3/dom/build/**` outputs.
- Removed JS copy steps from `scripts/build-cjs.ts` and
`scripts/build-esm.ts`; generated TS emits compile with the rest of the
package.
- Updated `tsconfig.json` to include generated files (removed old
`gen*.ts` exclude).

- **Migration**
- Use `pnpm run build-dom-scripts`; the old `build-dom-scripts:*`
scripts are removed.

<sup>Written for commit ac3839794447064bb865a0b6070decb2f2518169.
Summary will update on new commits. <a
href="https://cubic.dev/pr/browserbase/stagehand/pull/1988">Review in
cubic</a></sup>

<!-- End of auto-generated description by cubic. -->
2026-04-10 11:11:06 -07:00

525 lines
12 KiB
JSON

{
"$schema": "https://v2-8-10.turborepo.dev/schema.json",
"globalEnv": [
"CI"
],
"globalDependencies": [
".github/workflows/ci.yml",
"package.json",
"packages/*/package.json",
"tsconfig.json",
"tsconfig.base.json",
"eslint.config.mjs",
".prettierrc",
".prettierignore"
],
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": [
"dist/**"
],
"inputs": [
"**/*.ts",
"**/*.js",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/**"
]
},
"@browserbasehq/stagehand#build": {
"dependsOn": [
"^build",
"gen-version",
"build-dom-scripts"
],
"outputs": [
"dist/**"
],
"inputs": [
"**/*.ts",
"**/*.js",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!lib/version.ts",
"!lib/dom/build/**",
"!lib/v3/dom/build/**",
"!dist/**"
]
},
"@browserbasehq/stagehand-server-v3#build": {
"dependsOn": ["^build"],
"outputs": [
"dist/**",
"openapi.v3.yaml"
],
"inputs": [
"**/*.ts",
"**/*.js",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/**",
"!openapi.v3.yaml"
]
},
"@browserbasehq/stagehand-server-v3#build:esm-tests": {
"dependsOn": ["^build:esm"],
"outputs": ["dist/tests/**", "dist/src/**"],
"inputs": [
"tests/**/*.ts",
"src/**/*.ts",
"package.json",
"tsconfig.tests.json",
"!dist/tests/**"
]
},
"@browserbasehq/stagehand-server-v4#build": {
"dependsOn": ["^build"],
"outputs": [
"dist/**",
"openapi.v4.yaml"
],
"inputs": [
"**/*.ts",
"**/*.js",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/**",
"!openapi.v4.yaml"
]
},
"@browserbasehq/browse-cli#build": {
"dependsOn": ["^build"],
"outputs": [
"dist/**"
],
"inputs": [
"**/*.ts",
"**/*.js",
"package.json",
"tsconfig.json",
"tsup.config.ts",
"!dist/**"
]
},
"@browserbasehq/stagehand-server-v4#gen:openapi": {
"dependsOn": ["^build:esm"],
"outputs": ["openapi.v4.yaml"],
"inputs": [
"src/**/*.ts",
"scripts/gen-openapi.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!openapi.v4.yaml"
]
},
"@browserbasehq/stagehand#build:esm": {
"dependsOn": [
"^build:esm",
"gen-version",
"build-dom-scripts"
],
"outputs": [
"dist/esm/**"
],
"inputs": [
"**/*.ts",
"**/*.js",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!lib/version.ts",
"!lib/dom/build/**",
"!lib/v3/dom/build/**",
"!dist/**"
]
},
"@browserbasehq/stagehand#build:cjs": {
"dependsOn": [
"^build:cjs",
"gen-version",
"build-dom-scripts"
],
"outputs": [
"dist/cjs/**"
],
"inputs": [
"**/*.ts",
"**/*.js",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!lib/version.ts",
"!lib/dom/build/**",
"!lib/v3/dom/build/**",
"!dist/**"
]
},
"gen-version": {
"outputs": ["lib/version.ts"],
"inputs": [
"scripts/gen-version.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!lib/version.ts"
]
},
"build-dom-scripts": {
"outputs": [
"lib/v3/dom/build/**"
],
"inputs": [
"scripts/build-dom-scripts.ts",
"lib/v3/dom/**/*.ts",
"!lib/v3/dom/build/**",
"package.json",
"tsconfig.json",
"tsconfig.*.json"
]
},
"build:esm": {
"dependsOn": ["^build:esm"],
"outputs": [
"dist/esm/**"
],
"inputs": [
"**/*.ts",
"**/*.js",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/esm/**"
]
},
"build:server:dist": {
"dependsOn": ["^build:esm"],
"outputs": [
"dist/lib/**",
"dist/routes/**",
"dist/types/**",
"dist/*.js",
"dist/*.js.map",
"dist/*.d.ts"
],
"inputs": [
"src/**/*.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/lib/**",
"!dist/routes/**",
"!dist/types/**",
"!dist/*.js",
"!dist/*.js.map",
"!dist/*.d.ts"
]
},
"gen:openapi": {
"dependsOn": ["^build:esm"],
"outputs": ["openapi.v3.yaml"],
"inputs": [
"src/**/*.ts",
"scripts/gen-openapi.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!openapi.v3.yaml"
]
},
"build:sea:esm": {
"dependsOn": ["^build:esm"],
"outputs": [
"dist/sea/**",
"dist/app.mjs"
],
"env": [
"SEA_BUILD_MODE",
"SEA_TARGET_PLATFORM",
"SEA_TARGET_ARCH",
"SEA_BINARY_NAME"
],
"inputs": [
"src/**/*.ts",
"scripts/**/*.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/sea/**",
"!dist/app.mjs"
]
},
"build:sea:cjs": {
"dependsOn": ["^build:cjs"],
"outputs": ["dist/sea/**"],
"env": [
"SEA_BUILD_MODE",
"SEA_TARGET_PLATFORM",
"SEA_TARGET_ARCH",
"SEA_BINARY_NAME"
],
"inputs": [
"src/**/*.ts",
"scripts/**/*.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/sea/**"
]
},
"build:cjs": {
"dependsOn": ["^build:cjs"],
"outputs": [
"dist/cjs/**"
],
"inputs": [
"**/*.ts",
"**/*.js",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/cjs/**"
]
},
"build:cli": {
"dependsOn": ["^build:esm"],
"outputs": ["dist/cli/**"],
"inputs": [
"cli.ts",
"evals.config.json",
"scripts/**",
"!dist/cli/**"
]
},
"lint": {
"dependsOn": ["^build"],
"outputs": [],
"inputs": [
"**/*.ts",
"**/*.tsx",
"**/*.js",
"**/*.jsx",
"**/*.mjs",
"**/*.cjs",
"**/*.mts",
"**/*.cts",
"**/*.md",
"**/*.mdx",
"**/*.yml",
"**/*.yaml",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/**",
"!node_modules/**",
"!.turbo/**"
]
},
"format": {
"outputs": [],
"cache": false
},
"test": {
"dependsOn": [],
"outputs": [],
"inputs": [
"**/*.spec.ts",
"**/*.test.ts"
]
},
"test:core": {
"dependsOn": ["build:esm"],
"outputs": [],
"cache": false,
"env": [
"BROWSERBASE_FLOW_LOGS",
"VITEST_CONSOLE_REPORTER"
],
"inputs": [
"tests/**/*.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json"
]
},
"test:e2e": {
"dependsOn": ["build:esm"],
"outputs": [
"playwright-report/**",
"test-results/**"
],
"cache": false,
"env": [
"BB_API_KEY",
"BB_PROJECT_ID",
"BROWSERBASE_REGION",
"BROWSERBASE_SESSION_LIMIT_PER_E2E_TEST",
"IFRAME_CHILD_FRAME_TIMEOUT_MS",
"IFRAME_DEBUG",
"IFRAME_POPUP_TIMEOUT_MS",
"IFRAME_POPUP_URL_TIMEOUT_MS",
"KEEP_ALIVE_ACTION_EXIT_TIMEOUT_MS",
"KEEP_ALIVE_BB_INFO_TIMEOUT_MS",
"KEEP_ALIVE_BB_TIMEOUT_MS",
"KEEP_ALIVE_DEBUG",
"KEEP_ALIVE_LOCAL_INFO_TIMEOUT_MS",
"KEEP_ALIVE_LOCAL_TIMEOUT_MS",
"KEEP_ALIVE_STAY_OPEN_MS",
"KEEP_ALIVE_VIEW_MS",
"LOCAL_SESSION_LIMIT_PER_E2E_TEST",
"PLAYWRIGHT_CONSOLE_REPORTER",
"STAGEHAND_BROWSER_TARGET",
"STAGEHAND_API_URL"
],
"passThroughEnv": [
"ANTHROPIC_API_KEY",
"BROWSERBASE_API_KEY",
"BROWSERBASE_CDP_CONNECT_MAX_MS",
"BROWSERBASE_PROJECT_ID",
"BROWSERBASE_SESSION_CREATE_MAX_MS",
"CHROME_PATH",
"CTRF_JUNIT_PATH",
"GEMINI_API_KEY",
"GOOGLE_GENERATIVE_AI_API_KEY",
"HEADLESS",
"LLM_MAX_MS",
"NODE_OPTIONS",
"NODE_V8_COVERAGE",
"OPENAI_API_KEY",
"STAGEHAND_SERVER_TARGET"
],
"inputs": [
"lib/v3/tests/**/*.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!playwright-report/**",
"!test-results/**"
]
},
"test:evals": {
"dependsOn": ["build:esm", "build:cli"],
"outputs": [],
"cache": false,
"env": [
"AGENT_EVAL_MAX_STEPS",
"BRAINTRUST_API_KEY",
"EVAL_AGENT_MODELS",
"EVAL_AGENT_MODELS_CUA",
"EVAL_CATEGORIES",
"EVAL_DATASET",
"EVAL_ENV",
"EVAL_GAIA_FILE",
"EVAL_GAIA_LEVEL",
"EVAL_GAIA_LIMIT",
"EVAL_GAIA_SAMPLE",
"EVAL_MAX_CONCURRENCY",
"EVAL_MAX_K",
"EVAL_MODELS",
"EVAL_ONLINEMIND2WEB_LIMIT",
"EVAL_ONLINEMIND2WEB_SAMPLE",
"EVAL_PROVIDER",
"EVAL_TRIAL_COUNT",
"EVAL_WEBVOYAGER_LIMIT",
"EVAL_WEBVOYAGER_SAMPLE",
"OP_AUTO_ENV_DISABLE",
"OP_ENV_FILE",
"STAGEHAND_BROWSER_TARGET",
"USE_API"
],
"passThroughEnv": [
"ANTHROPIC_API_KEY",
"BROWSERBASE_API_KEY",
"BROWSERBASE_CDP_CONNECT_MAX_MS",
"BROWSERBASE_PROJECT_ID",
"BROWSERBASE_SESSION_CREATE_MAX_MS",
"CHROME_PATH",
"CTRF_JUNIT_PATH",
"GEMINI_API_KEY",
"GOOGLE_GENERATIVE_AI_API_KEY",
"HEADLESS",
"LLM_MAX_MS",
"NODE_OPTIONS",
"NODE_V8_COVERAGE",
"OPENAI_API_KEY",
"STAGEHAND_SERVER_TARGET"
],
"inputs": [
"scripts/**",
"cli.ts",
"evals.config.json",
"package.json",
"tsconfig.json",
"tsconfig.*.json"
]
},
"test:server": {
"dependsOn": ["build:server:dist", "build:sea:esm", "build:esm-tests"],
"outputs": [],
"cache": false,
"env": [
"BB_ENV",
"NODE_ENV",
"NODE_TEST_CONSOLE_REPORTER",
"NODE_TEST_REPORTER",
"NODE_TEST_REPORTER_DESTINATION",
"SEA_BINARY_NAME",
"STAGEHAND_BASE_URL",
"STAGEHAND_SEA_CACHE_DIR",
"STAGEHAND_TEST_LOCAL_CONNECT_TIMEOUT_MS"
],
"passThroughEnv": [
"ANTHROPIC_API_KEY",
"BROWSERBASE_API_KEY",
"BROWSERBASE_CDP_CONNECT_MAX_MS",
"BROWSERBASE_PROJECT_ID",
"BROWSERBASE_SESSION_CREATE_MAX_MS",
"CHROME_PATH",
"CTRF_JUNIT_PATH",
"GEMINI_API_KEY",
"GOOGLE_GENERATIVE_AI_API_KEY",
"HEADLESS",
"LLM_MAX_MS",
"NODE_OPTIONS",
"NODE_V8_COVERAGE",
"OPENAI_API_KEY",
"STAGEHAND_BROWSER_TARGET",
"STAGEHAND_SERVER_TARGET"
],
"inputs": [
"test/**/*.ts",
"scripts/**",
"src/**/*.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json"
]
},
"test:cli": {
"dependsOn": ["build"],
"outputs": [],
"cache": false,
"inputs": [
"tests/**/*.ts",
"src/**/*.ts",
"package.json",
"tsconfig.json",
"vitest.config.ts"
]
},
"docs": {
"persistent": true,
"cache": false
},
"dev": {
"persistent": true,
"cache": false
}
}
}