Skip to content
Myr

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 file

Take 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 back
1/**

Merge build/comments-ops into mainoscabrielbefore adoptione4c407e

lines 2–3why, one step back
2 * 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 back
4 * bunx varlock run --path apps/platform/ -- \

Merge build/comments-ops into mainoscabrielbefore adoptione4c407e

lines 5–6why, one step back
5 * 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 back
7 *

Merge build/comments-ops into mainoscabrielbefore adoptione4c407e

line 8why, one step back
8 * `--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 back
9 */

Merge branch 'build/913-import-any-branch-and-examples'oscabrielbefore adoptiona4543f6

line 10why, one step back
10import { BunRuntime, BunServices } from "@effect/platform-bun";

Merge build/1314-import-list into mainoscabrielbefore adoption33c4cac

line 11why, one step back
11import { Effect, Layer, Option, Stdio } from "effect";

Merge branch 'build/906-platform-root-page'oscabrielbefore adoption10c8b54

line 12why, one step back
12

Merge branch 'build/913-import-any-branch-and-examples'oscabrielbefore adoptiona4543f6

lines 13–33why, one step back
13import { 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 back
34 stageTarget(stage, url, Option.getOrUndefined(options.web)),

Merge branch 'build/913-import-any-branch-and-examples'oscabrielbefore adoptiona4543f6

lines 35–39why, one step back
35 options.tags ? restBackfill(stage) : noBackfill
36 ),37 World: () => Layer.mergeAll(worldTarget, noBackfill),38 });39

Merge branch 'build/906-platform-root-page'oscabrielbefore adoption10c8b54

lines 40–41why, one step back
40if (import.meta.main) {
41 BunRuntime.runMain(

Merge branch 'build/913-import-any-branch-and-examples'oscabrielbefore adoptiona4543f6

lines 42–46why, one step back
42 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 back
47 );
48}