import-examples.ts
This file
Path
scripts/import-examples.ts
48 lines · 1.5 KiB · TypeScript
Last changed by
Merge build/comments-ops into mainoscabrielbefore adoptione4c407e
History of this fileTake it
The walk stopped after 200 commits: lines older than 10c8b54 point at it.
Merge branch 'build/906-platform-root-page'oscabrielbefore adoption10c8b54
line 1why, one step back1/**Merge build/comments-ops into mainoscabrielbefore adoptione4c407e
lines 2–3why, one step back2 * Usage:3 * bun scripts/import-examples.ts --world node [--only <p>]Merge branch 'build/913-import-any-branch-and-examples'oscabrielbefore adoptiona4543f6
line 4why, one step back4 * bunx varlock run --path apps/platform/ -- \Merge build/comments-ops into mainoscabrielbefore adoptione4c407e
lines 5–6why, one step back5 * bun scripts/import-examples.ts --stage <stage> [--only <p>] [--warm] [--sources] [--dry-run]6 * `--tags` also needs the ops credentials: `bunx varlock run --path infra/ -- …`.Merge branch 'build/913-import-any-branch-and-examples'oscabrielbefore adoptiona4543f6
line 7why, one step back7 *Merge build/comments-ops into mainoscabrielbefore adoptione4c407e
line 8why, one step back8 * `--tags` is the one write that skips the gateway: tags only, never `main`.Merge branch 'build/906-platform-root-page'oscabrielbefore adoption10c8b54
line 9why, one step back9 */Merge branch 'build/913-import-any-branch-and-examples'oscabrielbefore adoptiona4543f6
line 10why, one step back10import { BunRuntime, BunServices } from "@effect/platform-bun";Merge build/1314-import-list into mainoscabrielbefore adoption33c4cac
line 11why, one step back11import { Effect, Layer, Option, Stdio } from "effect";Merge branch 'build/906-platform-root-page'oscabrielbefore adoption10c8b54
line 12why, one step back12Merge branch 'build/913-import-any-branch-and-examples'oscabrielbefore adoptiona4543f6
lines 13–33why, one step back13import { worldTarget, restBackfill, stageTarget } from "./lib/import/live.ts";14import {15 ImportWhere,16 importExamples,17 ImportExamplesFailed,18 TagBackfill,19} from "./lib/import/run.ts";20import type { ImportOptions } from "./lib/import/run.ts";2122const noBackfill = Layer.succeed(23 TagBackfill,24 TagBackfill.of({25 backfill: () =>26 Effect.fail(new ImportExamplesFailed({ reason: "--tags was not given" })),27 })28);2930const layersOf = (options: ImportOptions) =>31 ImportWhere.match(options.where, {32 Stage: ({ stage, url }) =>33 Layer.mergeAll(Merge build/1314-import-list into mainoscabrielbefore adoption33c4cac
line 34why, one step back34 stageTarget(stage, url, Option.getOrUndefined(options.web)),Merge branch 'build/913-import-any-branch-and-examples'oscabrielbefore adoptiona4543f6
lines 35–39why, one step back35 options.tags ? restBackfill(stage) : noBackfill36 ),37 World: () => Layer.mergeAll(worldTarget, noBackfill),38 });39Merge branch 'build/906-platform-root-page'oscabrielbefore adoption10c8b54
lines 40–41why, one step back40if (import.meta.main) {41 BunRuntime.runMain(Merge branch 'build/913-import-any-branch-and-examples'oscabrielbefore adoptiona4543f6
lines 42–46why, one step back42 Effect.gen(function* () {43 const args = yield* (yield* Stdio.Stdio).args;4445 return yield* importExamples(args, layersOf);46 }).pipe(Effect.scoped, Effect.provide(BunServices.layer))Merge branch 'build/906-platform-root-page'oscabrielbefore adoption10c8b54
lines 47–48why, one step back47 );48}