Skip to content

♻️ refactor build-test-apps script with CLI arg support#4359

Merged
thomas-lebeau merged 3 commits intomainfrom
thomas.lebeau/refactor-build-test-apps
Mar 20, 2026
Merged

♻️ refactor build-test-apps script with CLI arg support#4359
thomas-lebeau merged 3 commits intomainfrom
thomas.lebeau/refactor-build-test-apps

Conversation

@thomas-lebeau
Copy link
Collaborator

Motivation

The build-test-apps script was building all test apps unconditionally, making it slow when only a subset is needed (e.g., during development or targeted E2E testing). This refactor adds CLI argument support so specific apps can be built on demand.

Changes

  • Added --app / -a CLI flag (repeatable) to select which apps to build; defaults to all apps if omitted
  • Added --help / -h flag listing all available app names
  • Consolidated app configuration into a single APPS array, replacing separate hardcoded build calls
  • Refactored buildExtensions() into a per-extension buildExtension() builder function aligned with the new config-driven approach
  • buildApp() now derives the path from the app name internally

Test instructions

# Build all apps (existing behavior)
yarn build:apps

# Build only a specific app
yarn build:apps --app vanilla

# Build multiple specific apps
yarn build:apps --app vanilla --app nextjs

# Show help
yarn build:apps --help

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

- Add --app / -a flag to build specific apps instead of all
- Add --help flag listing available apps
- Unify app list into a single APPS config array (data-driven)
- Flatten buildExtensions() loop into per-app buildExtension() function
- buildApp() now accepts an app name and derives the path internally
@thomas-lebeau thomas-lebeau marked this pull request as ready for review March 19, 2026 13:06
@thomas-lebeau thomas-lebeau requested a review from a team as a code owner March 19, 2026 13:06
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 08c4ba66a9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +143 to +147
const targetDir = `test/apps/${appName}`
printLog(`Building app at ${targetDir}...`)

buildApp(baseExtDir)

for (const { name, options } of OTHER_EXTENSIONS) {
const targetDir = path.join('test/apps', `${name}-extension`)
fs.rmSync(targetDir, { recursive: true, force: true })
fs.cpSync(baseExtDir, targetDir, { recursive: true })

Choose a reason for hiding this comment

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

P1 Badge Build base extension before generating derived extensions

When --app is used to build only cdn-extension or appendChild-extension, this function now just copies test/apps/base-extension without ensuring that base-extension was built in the same run. Because generated extension apps are not checked in and the dist/*.js artifacts come from the base build, targeted runs can produce extensions with missing or stale bundles, breaking browser-extension E2E scenarios. Add an explicit dependency build (or enforce selecting base-extension together) before the copy step.

Useful? React with 👍 / 👎.

- Add `deps` field to AppConfig to declare build-time dependencies
- Build dependencies before the app that requires them, skipping already-built ones
- Move CLI argument parsing inside runMain to avoid top-level side effects
- Extract showHelpAndExit helper function
- Add validation error when no valid --app name is specified
@datadog-datadog-prod-us1-2
Copy link

datadog-datadog-prod-us1-2 bot commented Mar 19, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 77.30% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 068c614 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@cit-pr-commenter-54b7da
Copy link

cit-pr-commenter-54b7da bot commented Mar 19, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 175.02 KiB 175.02 KiB 0 B 0.00%
Rum Profiler 6.16 KiB 6.16 KiB 0 B 0.00%
Rum Recorder 27.46 KiB 27.46 KiB 0 B 0.00%
Logs 56.80 KiB 56.80 KiB 0 B 0.00%
Rum Slim 130.66 KiB 130.66 KiB 0 B 0.00%
Worker 23.63 KiB 23.63 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base CPU Time (ms) Local CPU Time (ms) 𝚫%
RUM - add global context 0.006 0.005 -16.67%
RUM - add action 0.0186 0.013 -30.11%
RUM - add error 0.0195 0.0139 -28.72%
RUM - add timing 0.0036 0.0032 -11.11%
RUM - start view 0.029 0.0141 -51.38%
RUM - start/stop session replay recording 0.0018 0.0008 -55.56%
Logs - log message 0.0199 0.0193 -3.02%
🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
RUM - add global context 26.56 KiB 25.69 KiB -889 B
RUM - add action 51.61 KiB 50.99 KiB -631 B
RUM - add timing 27.91 KiB 26.93 KiB -1007 B
RUM - add error 55.17 KiB 55.67 KiB +516 B
RUM - start/stop session replay recording 26.15 KiB 25.35 KiB -820 B
RUM - start view 466.22 KiB 465.78 KiB -453 B
Logs - log message 45.51 KiB 43.80 KiB -1.71 KiB

🔗 RealWorld

@thomas-lebeau thomas-lebeau merged commit 9d3a604 into main Mar 20, 2026
21 checks passed
@thomas-lebeau thomas-lebeau deleted the thomas.lebeau/refactor-build-test-apps branch March 20, 2026 07:02
@github-actions github-actions bot locked and limited conversation to collaborators Mar 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants