Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .devcontainer/arduino/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"name": "Drift demo — Arduino / PlatformIO",
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bookworm",
"hostRequirements": {
"cpus": 4
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/cargo/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"name": "Drift demo — Rust",
"image": "mcr.microsoft.com/devcontainers/rust:1-1-bookworm",
"hostRequirements": {
"cpus": 4
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/cocoapods/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"name": "Drift demo — CocoaPods",
"image": "mcr.microsoft.com/devcontainers/ruby:1-3.3-bookworm",
"hostRequirements": {
"cpus": 4
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/conan/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"name": "Drift demo — C / C++ (Conan)",
"image": "mcr.microsoft.com/devcontainers/cpp:1-debian-12",
"hostRequirements": {
"cpus": 4
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/go/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"name": "Drift demo — Go",
"image": "mcr.microsoft.com/devcontainers/go:1-1.22-bookworm",
"hostRequirements": {
"cpus": 4
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/hex/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"name": "Drift demo — Elixir / Erlang",
"image": "hexpm/elixir:1.15.7-erlang-26.2.1-debian-bookworm-20231009-slim",
"hostRequirements": {
"cpus": 4
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/maven/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"name": "Drift demo — Java / Kotlin / Scala",
"image": "mcr.microsoft.com/devcontainers/java:1-21-bookworm",
"hostRequirements": {
"cpus": 4
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/npm/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"name": "Drift demo — JavaScript / TypeScript",
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm",
"hostRequirements": {
"cpus": 4
},
"onCreateCommand": "node scripts/prepare-demo.mjs npm && npm --prefix demos/npm install --no-audit --no-fund && npm install -g @usedrift/cli",
"waitFor": "onCreateCommand",
"postAttachCommand": "drift analyze",
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/nuget/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"name": "Drift demo — .NET",
"image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm",
"hostRequirements": {
"cpus": 4
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/opam/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"name": "Drift demo — OCaml",
"image": "ocaml/opam:debian-12-ocaml-4.14",
"hostRequirements": {
"cpus": 4
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/packagist/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"name": "Drift demo — PHP",
"image": "mcr.microsoft.com/devcontainers/php:1-8.2-bookworm",
"hostRequirements": {
"cpus": 4
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/pub/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"name": "Drift demo — Dart / Flutter",
"image": "dart:3.3",
"hostRequirements": {
"cpus": 4
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/pypi/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"name": "Drift demo — Python",
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bookworm",
"hostRequirements": {
"cpus": 4
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/rubygems/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"name": "Drift demo — Ruby",
"image": "mcr.microsoft.com/devcontainers/ruby:1-3.3-bookworm",
"hostRequirements": {
"cpus": 4
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/swift/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"name": "Drift demo — Swift",
"image": "swift:5.9-jammy",
"hostRequirements": {
"cpus": 4
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/vcpkg/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"name": "Drift demo — C / C++ (vcpkg)",
"image": "mcr.microsoft.com/devcontainers/cpp:1-debian-12",
"hostRequirements": {
"cpus": 4
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
Expand Down
20 changes: 20 additions & 0 deletions docs/browser-demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,26 @@ npm install on the images that get Node from a feature rather than the base
image (opam, pub, swift, hex) and whether `postAttachCommand` output lands where
these notes claim it does.

## Startup time

A demo is judged on how long it takes to show something, and a cold Codespace
spends that budget before Drift has run at all: building the container,
installing the extension, then `onCreateCommand` — which the editor waits for,
deliberately, so the dependency change is already in place when startup analysis
runs.

Two levers exist, and only one of them is free:

- **`hostRequirements: { cpus: 4 }`** — set on every demo. Codespaces then offers
the 4-core machine as the smallest that qualifies. It spends the visitor's own
allowance twice as fast (30 hours a month on the free tier rather than 60),
which is the right trade for something opened once for ten minutes.
- **Prebuilds** — not configured, and a deliberate omission rather than an
oversight. A prebuild per devcontainer means *sixteen* of them, each consuming
Actions minutes and storage billed to the `trydrift` organisation, which
currently configures no billing at all. Turning them on is a cost decision, not
a technical one: GitHub repository settings → Codespaces → Set up prebuild.

## Cost

Codespaces are created under the visitor's own GitHub account and count against
Expand Down
10 changes: 10 additions & 0 deletions scripts/lib/devcontainer-spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ export function buildDevcontainer(demo, allDemos) {
return {
name: `Drift demo — ${demo.label}`,
image: spec.image,
// A demo is judged on how long it takes to show something, and the default
// 2-core machine spends that budget building a container and installing an
// extension before Drift has run at all. Asking for 4 cores makes
// Codespaces offer the 4-core machine as the smallest that qualifies.
//
// It costs the visitor's own allowance twice as fast — 30 hours a month on
// the free tier rather than 60 — which is the right trade for something
// opened once for ten minutes, and would be the wrong one for a container
// somebody works in all day.
hostRequirements: { cpus: 4 },
...(Object.keys(features).length > 0 ? { features } : {}),
// Runs once at creation, after checkout and before the editor starts, so
// the dependency change is already in place when Drift's startup analysis
Expand Down
Loading