Dynamic feature experiments for Lens Desktop. Each experiment is a renderer-only CommonJS bundle loaded at runtime via a sandbox.
experiments/
hello-world/ # Sample experiment
infrastructure/
build/ # Shared esbuild configuration and build scripts
sign/ # Ed25519 bundle signing utilities
publish/ # Manifest generation for releases
Experiments are renderer-only CommonJS bundles that export getFeature() instances. At runtime, Lens Desktop loads these bundles via a sandbox (new Function("module", "require", code)) and registers the features into the DI container.
Each experiment has a single entry point:
index.ts- Re-exports the renderer feature, built todist/index.js
- Create a new directory under
experiments/your-experiment-name/ - Add a
package.jsonwith experiment metadata (see below) - Add an
index.tsthat re-exports your feature - Implement your feature in
src/renderer/feature.tswith glob-imported injectables - Run
npm run buildto verify the build
# Install dependencies (requires GitHub Packages auth for @lensapp scope)
npm install
# Build all experiments
npm run build
# Build a single experiment
npm run build:experiment -- hello-world
# Type-check all experiments
npm run typecheck
# Run tests
npm test
# Sign bundles (requires EXPERIMENT_SIGNING_PRIVATE_KEY env var)
npm run sign
# Generate release manifest
npm run manifestEach experiment's package.json includes an experiment field:
{
"experiment": {
"id": "my-experiment",
"name": "My Experiment",
"description": "What this experiment does",
"terminationUtcDateTime": "2027-01-01T00:00:00Z"
}
}The terminationUtcDateTime field defines when the experiment expires and should be removed.