shiplane 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing.js","names":["changesetText"],"sources":["../src/adapters/shell/__fakes__/shell.fake.ts","../src/adapters/ci-pipeline/__fakes__/ci-pipeline.fake.ts","../src/adapters/code-host/__fakes__/code-host.fake.ts","../src/adapters/source-control/__fakes__/source-control.fake.ts","../src/adapters/terminal/__fakes__/progress.fake.ts","../src/adapters/terminal/__fakes__/terminal.fake.ts","../src/adapters/versioning/__fakes__/versioning.fake.ts","../src/testing/releaseContext.ts","../src/testing/deliveryContract.ts","../src/adapters/server-hosting/server-hosting.contract.ts","../src/adapters/static-hosting/static-hosting.contract.ts","../src/adapters/mobile-distribution/mobile-distribution.contract.ts","../src/adapters/package-registry/package-registry.contract.ts","../src/adapters/source-control/source-control.contract.ts","../src/adapters/code-host/code-host.contract.ts","../src/adapters/ci-pipeline/ci-pipeline.contract.ts","../src/adapters/versioning/versioning.contract.ts","../src/adapters/server-hosting/__fakes__/server-hosting.fake.ts","../src/adapters/static-hosting/__fakes__/static-hosting.fake.ts","../src/adapters/mobile-distribution/__fakes__/mobile-distribution.fake.ts","../src/adapters/package-registry/__fakes__/package-registry.fake.ts","../src/testing/sample.ts","../src/testing/live.ts","../src/testing/plans.ts","../src/testing/consumer.ts","../src/testing/workspace.ts"],"sourcesContent":["import type { RunOptions, Shell, ShellResult } from \"../../../ports/shell.port\";\n\nexport interface ShellCall {\n command: string;\n args: string[];\n cwd?: string;\n env?: Record<string, string>;\n}\n\n/** A shell that runs nothing: it keeps every call and answers from what was seeded. */\nexport class RecordingShell implements Shell {\n readonly calls: ShellCall[] = [];\n private answers: { prefix: string; result: Partial<ShellResult>; once?: boolean }[] = [];\n private variables: Record<string, string> = {};\n\n seedEnv(variables: Record<string, string>) {\n this.variables = { ...this.variables, ...variables };\n return this;\n }\n\n env = (name: string) => this.variables[name];\n\n /** Answers every call whose `command args` line starts with `prefix`. */\n seed(prefix: string, result: Partial<ShellResult>) {\n this.answers.push({ prefix, result });\n return this;\n }\n\n /** Answers the next call starting with `prefix` only, ahead of what `seed` answers. */\n seedOnce(prefix: string, result: Partial<ShellResult>) {\n this.answers.unshift({ prefix, result, once: true });\n return this;\n }\n\n private answer(command: string, args: readonly string[], options: RunOptions): ShellResult {\n this.calls.push({ command, args: [...args], cwd: options.cwd, env: options.env });\n const line = [command, ...args].join(\" \");\n const found = this.answers.find(({ prefix }) => line.startsWith(prefix));\n if (found?.once) this.answers.splice(this.answers.indexOf(found), 1);\n return { status: 0, stdout: \"\", stderr: \"\", ...found?.result };\n }\n\n capture = (command: string, args: readonly string[], options: RunOptions = {}) =>\n Promise.resolve(this.answer(command, args, options));\n\n attach = (command: string, args: readonly string[], options: RunOptions = {}) =>\n Promise.resolve(this.answer(command, args, options).status);\n}\n","import type { ActionsMinutes } from \"../../../domain/budget\";\nimport type { ServiceAdapter } from \"../../../ports/adapter.port\";\nimport type { CiPipelinePort } from \"../../../ports/ci-pipeline.port\";\nimport type { Deploy } from \"../../../ports/code-host.port\";\n\ninterface PipelineState {\n workflowRuns: Record<string, Deploy[]>;\n minutes: ActionsMinutes | null;\n measured: Record<string, number[]>;\n}\n\nexport interface Dispatched {\n type: \"dispatch\";\n workflow: string;\n ref: string;\n inputs: Record<string, string>;\n}\n\n/** A CI pipeline held in memory: seed its runs and minutes, read back what was dispatched. */\nexport class CiPipelineFake implements CiPipelinePort {\n private state: PipelineState = { workflowRuns: {}, minutes: null, measured: {} };\n\n readonly received: Dispatched[] = [];\n\n constructor(readonly shipWorkflow = \"ship.yml\") {}\n\n seed(state: Partial<PipelineState>) {\n this.state = { ...this.state, ...state };\n return this;\n }\n\n workflowRuns = (workflow: string) => Promise.resolve(this.state.workflowRuns[workflow] ?? []);\n\n dispatch = (workflow: string, ref: string, inputs: Record<string, string>) => {\n this.received.push({ type: \"dispatch\", workflow, ref, inputs });\n return Promise.resolve();\n };\n\n minutes = () => Promise.resolve(this.state.minutes);\n measuredMinutes = (workflow: string) => Promise.resolve(this.state.measured[workflow] ?? []);\n}\n\n/** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */\nexport const ciPipelineFake = (\n fake = new CiPipelineFake(),\n): ServiceAdapter<CiPipelinePort> & { fake: CiPipelineFake } => ({\n name: \"fake\",\n create: () => fake,\n fake,\n});\n","import type { Environment } from \"../../../domain/environment\";\nimport type { IssueRef, LinkedPr } from \"../../../domain/issues\";\nimport type { MergeMethod, MergeMethods, OpenPr } from \"../../../domain/releasePr\";\nimport type { ServiceAdapter } from \"../../../ports/adapter.port\";\nimport type { CodeHostPort, Deploy } from \"../../../ports/code-host.port\";\nimport { issueName } from \"../../../domain/issues\";\n\ninterface HostState {\n openPrs: { branch: string; pr: OpenPr }[];\n /** States a pull request goes through, one per poll; the last one stays. */\n prStates: Record<number, (\"OPEN\" | \"MERGED\" | \"CLOSED\")[]>;\n /** The merge methods the repository allows, and the one its pull request page preselects. */\n merges: MergeMethods;\n releasedTags: string[];\n deployments: Deploy[];\n nextPrNumber: number;\n /** Merged pull requests by number, as a release reads their linked issues. */\n pullRequests: Record<number, LinkedPr>;\n /** `owner/name#123` → the text of its comments. */\n comments: Record<string, string[]>;\n}\n\nexport type HostEvent =\n | {\n type: \"pr\";\n pr: OpenPr;\n base: string;\n head: string;\n title: string;\n body: string;\n label: string;\n }\n | { type: \"merge\"; pr: OpenPr; method: MergeMethod }\n | { type: \"close\"; pr: OpenPr; comment: string }\n | { type: \"release\"; tag: string; notes: string; latest: boolean }\n | { type: \"record\"; ref: string; environment: Environment }\n | { type: \"comment\"; issue: string; body: string };\n\n/** A code host held in memory: seed its pull requests and deploys, read back what it received. */\nexport class CodeHostFake implements CodeHostPort {\n private state: HostState = {\n openPrs: [],\n prStates: {},\n merges: { allowed: [\"--squash\", \"--merge\", \"--rebase\"], preselected: \"--squash\" },\n releasedTags: [],\n deployments: [],\n nextPrNumber: 1800,\n pullRequests: {},\n comments: {},\n };\n\n readonly received: HostEvent[] = [];\n /** Each pull request number, once per state check. */\n readonly polled: number[] = [];\n /** Each batched read of pull requests or comments, in order. */\n readonly reads: (\"pull-requests\" | \"comments\")[] = [];\n\n seed(state: Partial<HostState>) {\n this.state = { ...this.state, ...state };\n return this;\n }\n\n openPrsFrom = (branchPrefix: string) =>\n Promise.resolve(\n this.state.openPrs\n .filter(({ branch }) => branch.startsWith(branchPrefix))\n .map(({ pr }) => pr),\n );\n\n createPr = (pr: { base: string; head: string; title: string; body: string; label: string }) => {\n const number = this.state.nextPrNumber++;\n const created = { number, url: `https://github.com/acme/repo/pull/${number}` };\n this.received.push({ type: \"pr\", pr: created, ...pr });\n this.state.openPrs.push({ branch: pr.head, pr: created });\n return Promise.resolve(created);\n };\n\n private closeError: Error | null = null;\n\n /** Every pull request close throws `error`. */\n failClose(error: Error) {\n this.closeError = error;\n return this;\n }\n\n closePr = (pr: OpenPr, comment: string) => {\n if (this.closeError) return Promise.reject(this.closeError);\n this.received.push({ type: \"close\", pr, comment });\n this.state.openPrs = this.state.openPrs.filter((open) => open.pr.number !== pr.number);\n this.state.prStates[pr.number] = [\"CLOSED\"];\n return Promise.resolve();\n };\n\n prState = (pr: OpenPr) => {\n this.polled.push(pr.number);\n const states = this.state.prStates[pr.number] ?? [\"OPEN\"];\n const [state = \"OPEN\", ...rest] = states;\n if (rest.length > 0) this.state.prStates[pr.number] = rest;\n return Promise.resolve(state);\n };\n\n mergeMethods = () => Promise.resolve(this.state.merges);\n\n merge = (pr: OpenPr, method: MergeMethod) => {\n this.received.push({ type: \"merge\", pr, method });\n this.state.prStates[pr.number] = [\"MERGED\"];\n return Promise.resolve();\n };\n\n showDiff = () => Promise.resolve();\n openInBrowser = () => Promise.resolve();\n releasedTags = () => Promise.resolve(new Set(this.state.releasedTags));\n\n private releaseError: Error | null = null;\n\n /** Every release notes publish throws `error`. */\n failRelease(error: Error) {\n this.releaseError = error;\n return this;\n }\n\n createRelease = (tag: string, notes: string, latest: boolean) => {\n if (this.releaseError) return Promise.reject(this.releaseError);\n this.received.push({ type: \"release\", tag, notes, latest });\n this.state.releasedTags.push(tag);\n return Promise.resolve();\n };\n\n deployments = () => Promise.resolve(this.state.deployments);\n\n recordDeployment = (ref: string, environment: Environment) => {\n this.received.push({ type: \"record\", ref, environment });\n this.state.deployments.push({ title: `Deploy ${ref} to ${environment}`, state: \"done\" });\n return Promise.resolve();\n };\n\n pullRequests = (numbers: readonly number[]) => {\n this.reads.push(\"pull-requests\");\n const missing = numbers.find((number) => !this.state.pullRequests[number]);\n if (missing !== undefined) return Promise.reject(new Error(`no pull request #${missing}`));\n return Promise.resolve(numbers.flatMap((number) => this.state.pullRequests[number] ?? []));\n };\n\n comments = (on: readonly IssueRef[]) => {\n this.reads.push(\"comments\");\n return Promise.resolve(on.map((ref) => this.state.comments[issueName(ref)] ?? []));\n };\n\n private commentError: Error | null = null;\n\n /** Every comment throws `error`. */\n failComment(error: Error) {\n this.commentError = error;\n return this;\n }\n\n comment = (on: IssueRef, body: string) => {\n if (this.commentError) return Promise.reject(this.commentError);\n this.received.push({ type: \"comment\", issue: issueName(on), body });\n this.state.comments[issueName(on)] = [...(this.state.comments[issueName(on)] ?? []), body];\n return Promise.resolve();\n };\n}\n\n/** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */\nexport const codeHostFake = (\n fake = new CodeHostFake(),\n): ServiceAdapter<CodeHostPort> & { fake: CodeHostFake } => ({\n name: \"fake\",\n create: () => fake,\n fake,\n});\n","import type { GitPosition } from \"../../../domain/governance\";\nimport type { ServiceAdapter } from \"../../../ports/adapter.port\";\nimport type { SourceControlPort } from \"../../../ports/source-control.port\";\n\ninterface SourceState {\n position: GitPosition;\n clean: boolean;\n /** Tag name → the commit it points at. */\n tags: Record<string, string>;\n /** `<dir>@<version>` → the commit that brought that version. */\n versionCommits: Record<string, { sha: string; subject: string }>;\n /** `<sha>:<dir>` → subjects of the commits since, newest first. */\n subjects: Record<string, string[]>;\n /** `<ref>:<file>` → its text at that ref. */\n files: Record<string, string>;\n /** `<from>..<to>` → the files that differ. */\n diffs: Record<string, string[]>;\n /** `<from>..<to>` → the commits after `from` up to `to`, newest first. */\n commits: Record<string, { subject: string; files: string[] }[]>;\n changed: string[];\n}\n\nexport type SourceEvent =\n | { type: \"branch\"; name: string }\n | { type: \"switch\"; branch: string }\n | { type: \"commit\"; files: string[]; title: string; body?: string }\n | { type: \"push\"; branch: string }\n | { type: \"pull\" }\n | { type: \"tag\"; name: string; sha: string; message: string }\n | { type: \"push-tags\"; names: string[] }\n | { type: \"discard\"; files: string[] }\n | { type: \"delete-branch\"; name: string }\n | { type: \"delete-remote\"; branch: string }\n | { type: \"delete-tag\"; name: string };\n\n/** A repository held in memory: seed what it contains, read back what it received. */\nexport class SourceControlFake implements SourceControlPort {\n private state: SourceState = {\n position: { branch: \"main\", head: \"head\", originMain: \"head\" },\n clean: true,\n tags: {},\n versionCommits: {},\n subjects: {},\n files: {},\n diffs: {},\n commits: {},\n changed: [],\n };\n\n readonly received: SourceEvent[] = [];\n private failures: { type: SourceEvent[\"type\"]; nth: number; error: Error }[] = [];\n\n seed(state: Partial<SourceState>) {\n this.state = { ...this.state, ...state };\n return this;\n }\n\n /** The `nth` call of this kind throws `error`, after it is recorded. */\n failAt(type: SourceEvent[\"type\"], nth: number, error: Error) {\n this.failures.push({ type, nth, error });\n return this;\n }\n\n private record(event: SourceEvent) {\n this.received.push(event);\n const count = this.received.filter(({ type }) => type === event.type).length;\n const failure = this.failures.find(({ type, nth }) => type === event.type && nth === count);\n return failure ? Promise.reject(failure.error) : Promise.resolve();\n }\n\n position = () => Promise.resolve(this.state.position);\n isClean = () => Promise.resolve(this.state.clean);\n tagCommit = (tag: string) => Promise.resolve(this.state.tags[tag] ?? null);\n versionCommit = (dir: string, _manifest: string, version: string) =>\n Promise.resolve(this.state.versionCommits[`${dir}@${version}`] ?? null);\n subjectsSince = (sha: string, dir: string) =>\n Promise.resolve(this.state.subjects[`${sha}:${dir}`] ?? []);\n changedFiles = () => Promise.resolve(this.state.changed);\n diffNames = (from: string, to: string) =>\n Promise.resolve(this.state.diffs[`${from}..${to}`] ?? []);\n commitsBetween = (from: string, to: string) =>\n Promise.resolve(this.state.commits[`${from}..${to}`] ?? []);\n fileAt = (ref: string, file: string) =>\n Promise.resolve(this.state.files[`${ref}:${file}`] ?? null);\n tags = () => Promise.resolve(new Set(Object.keys(this.state.tags)));\n\n createBranch = async (name: string) => {\n await this.record({ type: \"branch\", name });\n this.state.position = { ...this.state.position, branch: name };\n };\n\n switchTo = async (branch: string) => {\n await this.record({ type: \"switch\", branch });\n this.state.position = { ...this.state.position, branch };\n };\n\n commit = async (files: string[], title: string, body?: string) => {\n await this.record({ type: \"commit\", files, title, body });\n this.state.changed = this.state.changed.filter((file) => !files.includes(file));\n };\n\n push = (branch: string) => this.record({ type: \"push\", branch });\n\n pull = () => this.record({ type: \"pull\" });\n\n tag = async (name: string, sha: string, message: string) => {\n await this.record({ type: \"tag\", name, sha, message });\n this.state.tags[name] = sha;\n };\n\n pushTags = (names: string[]) => this.record({ type: \"push-tags\", names });\n\n discard = async (files: string[]) => {\n await this.record({ type: \"discard\", files });\n this.state.changed = this.state.changed.filter((file) => !files.includes(file));\n };\n\n deleteBranch = (name: string) => this.record({ type: \"delete-branch\", name });\n\n deleteRemoteBranch = (branch: string) => this.record({ type: \"delete-remote\", branch });\n\n deleteTag = async (name: string) => {\n await this.record({ type: \"delete-tag\", name });\n this.state.tags = Object.fromEntries(\n Object.entries(this.state.tags).filter(([tag]) => tag !== name),\n );\n };\n}\n\n/** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */\nexport const sourceControlFake = (\n fake = new SourceControlFake(),\n): ServiceAdapter<SourceControlPort> & { fake: SourceControlFake } => ({\n name: \"fake\",\n create: () => fake,\n fake,\n});\n","import type { Mood } from \"../../../domain/display\";\nimport type { Output, Progress, StepPlace } from \"../../../ports/terminal.port\";\n\nexport interface ProgressEvent {\n kind: \"stage\" | \"during\" | \"say\";\n text: string;\n mood?: Mood;\n step?: StepPlace;\n}\n\n/** Progress kept as events; what it says also goes to the output, as a terminal would print it. */\nexport class RecordingProgress implements Progress {\n readonly events: ProgressEvent[] = [];\n\n constructor(private readonly output: Output) {}\n\n stage = (stages: readonly string[], index: number) => {\n this.events.push({\n kind: \"stage\",\n text: stages[index] ?? \"\",\n step: { index, total: stages.length },\n });\n };\n\n during = <T>(label: string, mood: Mood, work: () => Promise<T>, step?: StepPlace) => {\n this.events.push({ kind: \"during\", mood, text: label, ...(step ? { step } : {}) });\n return work();\n };\n\n say = (mood: Mood, text: string) => {\n this.events.push({ kind: \"say\", mood, text });\n this.output.line(text);\n };\n}\n","import type { Choice, Clock, Output, Prompter } from \"../../../ports/terminal.port\";\n\n/** Everything the CLI printed, in order, without colours. */\nexport class MemoryOutput implements Output {\n readonly lines: string[] = [];\n\n line = (text = \"\") => {\n // eslint-disable-next-line no-control-regex\n this.lines.push(text.replace(/\\u001B\\[[0-9;]*m/g, \"\"));\n };\n\n get text() {\n return this.lines.join(\"\\n\");\n }\n}\n\ntype Answer = boolean | string | string[] | null;\n\n/** A person who answers from a script, in order; every question asked is kept. */\nexport class ScriptedPrompter implements Prompter {\n readonly asked: string[] = [];\n /** The answer each choice question offered first, by question. */\n readonly initials: Record<string, unknown> = {};\n /** The choices each select question offered, by question. */\n readonly choices: Record<string, Choice<string>[]> = {};\n private answers: Answer[] = [];\n\n constructor(readonly interactive = true) {}\n\n answer(...answers: Answer[]) {\n this.answers.push(...answers);\n return this;\n }\n\n private next(question: string): Answer {\n this.asked.push(question);\n if (this.answers.length === 0) throw new Error(`Unexpected question: ${question}`);\n return this.answers.shift() ?? null;\n }\n\n confirm = (question: string, initial = false) => {\n this.initials[question] = initial;\n return Promise.resolve(this.next(question) === true);\n };\n\n typed = (question: string, word: string) => Promise.resolve(this.next(question) === word);\n\n select = <Value extends string>(message: string, choices: Choice<Value>[], initial?: Value) => {\n this.initials[message] = initial;\n this.choices[message] = choices;\n return Promise.resolve(this.next(message) as Value | null);\n };\n\n multiselect = <Value extends string>(message: string, _choices: Choice<Value>[]) =>\n Promise.resolve(this.next(message) as Value[] | null);\n\n text = (message: string) => Promise.resolve(this.next(message) as string | null);\n\n /** No key is ever pressed: every wait times out, unless keys were queued with `press`. */\n private keys: string[] = [];\n\n press(...keys: string[]) {\n this.keys.push(...keys);\n return this;\n }\n\n waitForKey = () => Promise.resolve(this.keys.shift() ?? null);\n}\n\n/** A clock fixed at one moment, whose waits return at once. */\nexport class FixedClock implements Clock {\n constructor(private readonly at: Date) {}\n\n now = () => this.at;\n sleep = () => Promise.resolve();\n}\n","import type { PlannedChangeset, StatusPlan } from \"../../../domain/changes\";\nimport type { ServiceAdapter } from \"../../../ports/adapter.port\";\nimport type { VersioningPort } from \"../../../ports/versioning.port\";\n\n/** A changeset as its file reads: one `\"package\": bump` line each, then the summary. */\nconst changesetText = ({ releases, summary }: PlannedChangeset) =>\n `---\\n${releases.map(({ name, type }) => `\"${name}\": ${type}`).join(\"\\n\")}\\n---\\n\\n${summary}\\n`;\n\ntype PlanOf = (added: PlannedChangeset[], held: PlannedChangeset[]) => StatusPlan;\n\ninterface VersioningState {\n pending: { id: string; text: string }[];\n /** What `changeset status` would answer, given what the release adds and holds back. */\n plan: PlanOf;\n dependencies: Record<string, string[]>;\n folders: Record<string, string>;\n}\n\n/** Versioning held in memory: seed the pending changes and the plan, read back what it received. */\nexport class VersioningFake implements VersioningPort {\n private state: VersioningState = {\n pending: [],\n plan: () => ({ changesets: [], releases: [] }),\n dependencies: {},\n folders: {},\n };\n\n readonly applied: { added: PlannedChangeset[]; held: PlannedChangeset[] }[] = [];\n readonly written: PlannedChangeset[] = [];\n\n seed(state: Partial<VersioningState>) {\n this.state = { ...this.state, ...state };\n return this;\n }\n\n pending = () => Promise.resolve(this.state.pending);\n plan = (added: PlannedChangeset[], held: PlannedChangeset[]) =>\n Promise.resolve(this.state.plan(added, held));\n dependencies = () => Promise.resolve(this.state.dependencies);\n folders = () => Promise.resolve(this.state.folders);\n\n apply = (added: PlannedChangeset[], held: PlannedChangeset[]) => {\n this.applied.push({ added, held });\n return Promise.resolve();\n };\n\n write = (changeset: PlannedChangeset) => {\n this.written.push(changeset);\n this.state.pending = [\n ...this.state.pending.filter(({ id }) => id !== changeset.id),\n { id: changeset.id, text: changesetText(changeset) },\n ];\n return Promise.resolve();\n };\n\n changesetFile = (id: string) => `.changeset/${id}.md`;\n changelogFile = (dir: string) => `${dir}/CHANGELOG.md`;\n}\n\n/** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */\nexport const versioningFake = (\n fake = new VersioningFake(),\n): ServiceAdapter<VersioningPort> & { fake: VersioningFake } => ({\n name: \"fake\",\n create: () => fake,\n fake,\n});\n","import type { Release } from \"../application/config/loadRelease\";\nimport type { ReleaseContext } from \"../application/context\";\nimport type { ReleaseUnit } from \"../domain/unit\";\nimport type { Feature, ReleaseModule } from \"../modules/module\";\nimport { ciPipelineFake } from \"../adapters/ci-pipeline/__fakes__/ci-pipeline.fake\";\nimport { codeHostFake } from \"../adapters/code-host/__fakes__/code-host.fake\";\nimport { RecordingShell } from \"../adapters/shell/__fakes__/shell.fake\";\nimport { sourceControlFake } from \"../adapters/source-control/__fakes__/source-control.fake\";\nimport { RecordingProgress } from \"../adapters/terminal/__fakes__/progress.fake\";\nimport {\n FixedClock,\n MemoryOutput,\n ScriptedPrompter,\n} from \"../adapters/terminal/__fakes__/terminal.fake\";\nimport { versioningFake } from \"../adapters/versioning/__fakes__/versioning.fake\";\nimport { releaseFlow } from \"../application/releaseFlow\";\nimport { DEFAULT_TAG_FORMAT } from \"../domain/tags\";\n\nexport const testUnit = (name: string, overrides: Partial<ReleaseUnit> = {}): ReleaseUnit => ({\n name,\n dir: `apps/${name}`,\n file: `apps/${name}/shiplane.unit.yml`,\n packageName: `@acme/${name}`,\n version: \"0.1.0\",\n module: \"web-app\",\n options: {},\n after: [],\n ...overrides,\n});\n\n/** The flow's Fakes, as adapters a config would hold. */\ninterface FlowFakes {\n sourceControl: ReturnType<typeof sourceControlFake>;\n codeHost: ReturnType<typeof codeHostFake>;\n ciPipeline: ReturnType<typeof ciPipelineFake>;\n versioning: ReturnType<typeof versioningFake>;\n}\n\n/**\n * A release over a Fake of every port the flow runs on, answered by a scripted person. The apps are\n * in release order as given: the first is the Latest release.\n */\nexport const testContext = ({\n units,\n modules = [],\n features = [],\n yes = false,\n interactive = true,\n root = \"/repo\",\n tagFormat = DEFAULT_TAG_FORMAT,\n commitsWithoutChangeset = \"release\",\n}: {\n units: ReleaseUnit[];\n modules?: ReleaseModule[];\n /** The features, or how to make them from the flow's Fakes they share. */\n features?: Feature[] | ((flow: FlowFakes) => Feature[]);\n yes?: boolean;\n interactive?: boolean;\n root?: string;\n tagFormat?: string;\n /** A release skips commits no changeset names; the config default ignores them. */\n commitsWithoutChangeset?: \"release\" | \"ignore\";\n}) => {\n const sourceControl = sourceControlFake();\n const codeHost = codeHostFake();\n const ciPipeline = ciPipelineFake();\n const versioning = versioningFake();\n const prompter = new ScriptedPrompter(interactive);\n const output = new MemoryOutput();\n const progress = new RecordingProgress(output);\n const shell = new RecordingShell();\n const fakes = { sourceControl, codeHost, ciPipeline, versioning };\n const flow = releaseFlow(fakes);\n const release: Release = {\n root,\n flow,\n modules,\n features: typeof features === \"function\" ? features(fakes) : features,\n units,\n problems: [],\n tagFormat,\n releasesCommits: commitsWithoutChangeset === \"release\",\n };\n const context: ReleaseContext = {\n release,\n load: () => Promise.resolve(release),\n services: {\n sourceControl: sourceControl.fake,\n codeHost: codeHost.fake,\n ciPipeline: ciPipeline.fake,\n versioning: versioning.fake,\n },\n open: (adapter) => adapter.create({ root, shell }),\n prompter,\n output,\n progress,\n clock: new FixedClock(new Date(\"2026-10-12T09:00:00Z\")),\n shell,\n options: { yes, ci: false },\n };\n return {\n context,\n flow: fakes,\n source: sourceControl.fake,\n host: codeHost.fake,\n ci: ciPipeline.fake,\n versioning: versioning.fake,\n prompter,\n output,\n progress,\n shell,\n };\n};\n\nexport const changesetText = (packages: Record<string, string>, summary: string) =>\n `---\\n${Object.entries(packages)\n .map(([name, type]) => `\"${name}\": ${type}`)\n .join(\"\\n\")}\\n---\\n\\n${summary}\\n`;\n","import { describe, expect, it } from \"vitest\";\n\nimport type { Environment } from \"../domain/environment\";\nimport type { DeliveryAdapter } from \"../ports/adapter.port\";\nimport type { Delivery, FolderView } from \"../ports/delivery.port\";\nimport { RecordingShell } from \"../adapters/shell/__fakes__/shell.fake\";\nimport { optionsFor } from \"../application/config/optionsFor\";\nimport { ENVIRONMENTS } from \"../domain/environment\";\nimport { testUnit } from \"./releaseContext\";\n\n/** One adapter of a port, with settings an app's unit file could hold for it. */\nexport interface ContractCase<Port extends Delivery & { capability: string }> {\n adapter: DeliveryAdapter<Port>;\n settings: Record<string, unknown>;\n}\n\nconst EMPTY_FOLDER: FolderView = {\n dir: \"apps/empty\",\n name: \"empty\",\n files: [],\n has: () => false,\n read: () => null,\n};\n\n/** What every adapter of a delivery port must do, whatever its provider; `more` adds the port's own. */\nexport const deliveryContract = <Port extends Delivery & { capability: string }>(\n kind: string,\n cases: ContractCase<Port>[],\n more: (adapter: DeliveryAdapter<Port>, port: Port) => void = () => undefined,\n) =>\n describe.each(cases.map((entry) => [entry.adapter.name, entry] as const))(\n `%s, as ${kind}`,\n (_name, { adapter, settings }) => {\n const port = adapter.create({ root: \"/repo\", shell: new RecordingShell() });\n const unit = testUnit(\"app\", { module: \"app\", options: settings });\n const inputFor = (environment: Environment) => ({\n unit,\n tag: \"app@0.1.0\",\n environment,\n options: optionsFor({ ...unit, options: adapter.settings.parse(settings) }, environment, [\n unit,\n ]),\n commit: \"abc1234\",\n });\n\n it(\"given an app's settings, when its unit file is read, then the adapter's schema takes them\", () => {\n expect(adapter.settings.safeParse(settings).success).toBe(true);\n });\n\n it(\"given a tag on each environment, when it says where the tag lands, then a person can read it\", () => {\n ENVIRONMENTS.forEach((environment) =>\n expect(port.describe(inputFor(environment)).trim()).not.toBe(\"\"),\n );\n });\n\n it(\"given a tag on each environment, when its jobs are built, then each says what it does and what it runs\", () => {\n ENVIRONMENTS.forEach((environment) =>\n port.jobs(inputFor(environment)).forEach((job) => {\n expect(job.label.trim()).not.toBe(\"\");\n expect(job.local.length).toBeGreaterThan(0);\n job.local.forEach(({ command }) => expect(command.trim()).not.toBe(\"\"));\n }),\n );\n });\n\n it(\"given a folder with nothing in it, when init looks at it, then the adapter recognises nothing\", () => {\n expect(adapter.detect?.(EMPTY_FOLDER) ?? null).toBeNull();\n });\n\n it(\"given an app it ships, when doctor asks what it needs, then each need has a name and a check\", () => {\n (adapter.requirements?.(unit) ?? []).forEach(({ label, check }) => {\n expect(label.trim()).not.toBe(\"\");\n expect(check.command.trim()).not.toBe(\"\");\n });\n });\n\n more(adapter, port);\n },\n );\n","import { expect, it } from \"vitest\";\n\nimport type { ServerHostingPort } from \"../../ports/server-hosting.port\";\nimport type { ContractCase } from \"../../testing/deliveryContract\";\nimport { deliveryContract } from \"../../testing/deliveryContract\";\n\n/** What every server host does, whatever its provider. */\nexport const serverHostingContract = (cases: ContractCase<ServerHostingPort>[]) =>\n deliveryContract(\"server hosting\", cases, (_adapter, port) => {\n it(\"given a server host, when its kind is read, then it hosts servers\", () => {\n expect(port.capability).toBe(\"server-hosting\");\n });\n });\n","import { expect, it } from \"vitest\";\n\nimport type { StaticHostingPort } from \"../../ports/static-hosting.port\";\nimport type { ContractCase } from \"../../testing/deliveryContract\";\nimport { deliveryContract } from \"../../testing/deliveryContract\";\n\n/** What every static host does, whatever its provider. */\nexport const staticHostingContract = (cases: ContractCase<StaticHostingPort>[]) =>\n deliveryContract(\"static hosting\", cases, (_adapter, port) => {\n it(\"given a static host, when its kind is read, then it hosts static sites\", () => {\n expect(port.capability).toBe(\"static-hosting\");\n });\n });\n","import { expect, it } from \"vitest\";\n\nimport type { MobileDistributionPort } from \"../../ports/mobile-distribution.port\";\nimport type { ContractCase } from \"../../testing/deliveryContract\";\nimport { deliveryContract } from \"../../testing/deliveryContract\";\n\n/** What every mobile distribution does, whatever its provider. */\nexport const mobileDistributionContract = (cases: ContractCase<MobileDistributionPort>[]) =>\n deliveryContract(\"mobile distribution\", cases, (adapter, port) => {\n it(\"given a mobile distribution, when status asks who decides, then its platform is named\", () => {\n expect(port.capability).toBe(\"mobile-distribution\");\n expect(adapter.decidedBy?.platform.trim() ?? \"\").not.toBe(\"\");\n });\n });\n","import { expect, it } from \"vitest\";\n\nimport type { PackageRegistryPort } from \"../../ports/package-registry.port\";\nimport type { ContractCase } from \"../../testing/deliveryContract\";\nimport { deliveryContract } from \"../../testing/deliveryContract\";\n\n/** What every package registry does, whatever its provider. */\nexport const packageRegistryContract = (cases: ContractCase<PackageRegistryPort>[]) =>\n deliveryContract(\"a package registry\", cases, (_adapter, port) => {\n it(\"given a package registry, when its kind is read, then it publishes packages\", () => {\n expect(port.capability).toBe(\"package-registry\");\n });\n });\n","import { describe, expect, it } from \"vitest\";\n\nimport type { SourceControlPort } from \"../../ports/source-control.port\";\n\n/** A repository on main with one commit, and the ways a test arranges it beyond the port. */\nexport interface SourceControlSubject {\n port: SourceControlPort;\n /** The commit main is on. */\n head: () => Promise<string>;\n /** Writes a file the repository does not track yet. */\n change: (file: string, text: string) => Promise<void>;\n}\n\n/** What every source control does, whatever its provider. */\nexport const sourceControlContract = (name: string, subject: () => Promise<SourceControlSubject>) =>\n describe(`${name}, as source control`, () => {\n it(\"given a fresh checkout, when its position is read, then it is on main with nothing to commit\", async () => {\n const { port } = await subject();\n\n expect((await port.position()).branch).toBe(\"main\");\n expect(await port.isClean()).toBe(true);\n });\n\n it(\"given a commit tagged, when the tags are read, then the tag is there and names that commit\", async () => {\n const { port, head } = await subject();\n const sha = await head();\n\n await port.tag(\"app@1.0.0\", sha, \"app 1.0.0\");\n\n expect(await port.tags()).toContain(\"app@1.0.0\");\n expect(await port.tagCommit(\"app@1.0.0\")).toBe(sha);\n });\n\n it(\"given tags in every format a config names, when the tags are read, then each one is there\", async () => {\n const { port, head } = await subject();\n const sha = await head();\n for (const tag of [\"arnaud-zg--v0.2.1\", \"v1.0.0\", \"app@1.0.0\"]) {\n await port.tag(tag, sha, tag);\n }\n\n expect([...(await port.tags())].sort()).toEqual([\"app@1.0.0\", \"arnaud-zg--v0.2.1\", \"v1.0.0\"]);\n });\n\n it(\"given a tag deleted, when the tags are read, then it is gone and names no commit\", async () => {\n const { port, head } = await subject();\n await port.tag(\"app@1.0.0\", await head(), \"app 1.0.0\");\n\n await port.deleteTag(\"app@1.0.0\");\n\n expect(await port.tags()).not.toContain(\"app@1.0.0\");\n expect(await port.tagCommit(\"app@1.0.0\")).toBeNull();\n });\n\n it(\"given a branch created, when the position is read, then it is on it, and switching back returns to main\", async () => {\n const { port } = await subject();\n\n await port.createBranch(\"release/next\");\n const onBranch = (await port.position()).branch;\n await port.switchTo(\"main\");\n\n expect(onBranch).toBe(\"release/next\");\n expect((await port.position()).branch).toBe(\"main\");\n });\n\n it(\"given a new file committed, when the changes are read, then it is no longer among them\", async () => {\n const { port, change } = await subject();\n await change(\"notes.md\", \"notes\\n\");\n const before = await port.changedFiles();\n\n await port.commit([\"notes.md\"], \"docs: notes\");\n\n expect(before).toContain(\"notes.md\");\n expect(await port.changedFiles()).not.toContain(\"notes.md\");\n });\n });\n","import { describe, expect, it } from \"vitest\";\n\nimport type { IssueRef } from \"../../domain/issues\";\nimport type { CodeHostPort } from \"../../ports/code-host.port\";\n\n/** A repository on a code host, and the ways a test arranges it beyond the port. */\nexport interface CodeHostSubject {\n port: CodeHostPort;\n /** A branch the host can open a pull request from, pushed with one commit on it. */\n branch: (name: string) => Promise<string>;\n /** A tag the host can publish release notes for. */\n tag: () => Promise<string>;\n /** An issue or pull request comments can go on. */\n issue: IssueRef;\n}\n\n/** What every code host does, whatever its provider. */\nexport const codeHostContract = (name: string, subject: () => Promise<CodeHostSubject>) =>\n describe(`${name}, as a code host`, () => {\n it(\"given a pull request opened, when the open ones are read, then it is there and open\", async () => {\n const { port, branch } = await subject();\n const head = await branch(\"release/contract-open\");\n\n const pr = await port.createPr({\n base: \"main\",\n head,\n title: \"chore: contract\",\n body: \"Opened by the contract suite.\",\n label: \"release\",\n });\n\n expect(await port.openPrsFrom(\"release/contract-open\")).toContainEqual(pr);\n expect(await port.prState(pr)).toBe(\"OPEN\");\n });\n\n it(\"given a pull request closed, when the open ones are read, then it is gone and closed\", async () => {\n const { port, branch } = await subject();\n const head = await branch(\"release/contract-close\");\n const pr = await port.createPr({\n base: \"main\",\n head,\n title: \"chore: contract\",\n body: \"Opened by the contract suite.\",\n label: \"release\",\n });\n\n await port.closePr(pr, \"Closed by the contract suite.\");\n\n expect(await port.openPrsFrom(\"release/contract-close\")).not.toContainEqual(pr);\n expect(await port.prState(pr)).toBe(\"CLOSED\");\n });\n\n it(\"given release notes published for a tag, when the released tags are read, then it is among them\", async () => {\n const { port, tag } = await subject();\n const name = await tag();\n\n await port.createRelease(name, \"Published by the contract suite.\", false);\n\n expect(await port.releasedTags()).toContain(name);\n });\n\n it(\"given a deploy recorded, when the deploys are read, then it is there and done\", async () => {\n const { port, tag } = await subject();\n const name = await tag();\n\n await port.recordDeployment(name, \"preview\");\n\n expect(await port.deployments()).toContainEqual({\n title: `Deploy ${name} to preview`,\n state: \"done\",\n });\n });\n\n it(\"given a comment posted, when the comments are read, then it is among them\", async () => {\n const { port, issue } = await subject();\n const body = `Posted by the contract suite at ${new Date().toISOString()}.`;\n\n await port.comment(issue, body);\n\n expect((await port.comments([issue])).flat()).toContain(body);\n });\n });\n","import { describe, expect, it } from \"vitest\";\n\nimport type { CiPipelinePort } from \"../../ports/ci-pipeline.port\";\n\n/** A CI pipeline, and the ways a test reads it beyond the port. */\nexport interface CiPipelineSubject {\n port: CiPipelinePort;\n /** A workflow that exists and has never run. */\n idle: string;\n}\n\n/** What every CI pipeline does, whatever its provider. */\nexport const ciPipelineContract = (name: string, subject: () => Promise<CiPipelineSubject>) =>\n describe(`${name}, as a CI pipeline`, () => {\n it(\"given a workflow that never ran, when its runs are read, then there are none\", async () => {\n const { port, idle } = await subject();\n\n expect(await port.workflowRuns(idle)).toEqual([]);\n });\n\n it(\"given a workflow that never succeeded, when its billed minutes are read, then none are measured\", async () => {\n const { port, idle } = await subject();\n\n expect(await port.measuredMinutes(idle)).toEqual([]);\n });\n\n it(\"given this month's budget, when it is read, then what is left is never more than included\", async () => {\n const { port } = await subject();\n\n const minutes = await port.minutes();\n\n if (minutes) expect(minutes.left).toBeLessThanOrEqual(minutes.included);\n else expect(minutes).toBeNull();\n });\n });\n","import { describe, expect, it } from \"vitest\";\n\nimport type { VersioningPort } from \"../../ports/versioning.port\";\n\n/** A workspace with one package, and the ways a test arranges it beyond the port. */\nexport interface VersioningSubject {\n port: VersioningPort;\n /** The package the workspace holds, and its folder. */\n workspace: { name: string; folder: string };\n}\n\n/** What every versioning does, whatever its provider. */\nexport const versioningContract = (name: string, subject: () => Promise<VersioningSubject>) =>\n describe(`${name}, as versioning`, () => {\n it(\"given a change written, when the pending changes are read, then it is there naming its package and bump\", async () => {\n const { port, workspace } = await subject();\n\n await port.write({\n id: \"contract-change\",\n releases: [{ name: workspace.name, type: \"minor\" }],\n summary: \"Written by the contract suite.\",\n });\n\n const pending = await port.pending();\n expect(pending.map(({ id }) => id)).toContain(\"contract-change\");\n expect(pending.find(({ id }) => id === \"contract-change\")?.text).toContain(\n `\"${workspace.name}\": minor`,\n );\n });\n\n it(\"given a workspace package, when the folders are read, then it is found in its folder\", async () => {\n const { port, workspace } = await subject();\n\n expect(await port.folders()).toMatchObject({ [workspace.name]: workspace.folder });\n });\n\n it(\"given a change and a folder, when their files are named, then they sit where a person looks\", async () => {\n const { port, workspace } = await subject();\n\n expect(port.changesetFile(\"contract-change\")).toBe(\".changeset/contract-change.md\");\n expect(port.changelogFile(workspace.folder)).toBe(`${workspace.folder}/CHANGELOG.md`);\n });\n });\n","import { z } from \"zod\";\n\nimport type { Environment } from \"../../../domain/environment\";\nimport type { DeliveryAdapter } from \"../../../ports/adapter.port\";\nimport type { Job, JobInput, Requirement } from \"../../../ports/delivery.port\";\nimport type { ServerHostingPort } from \"../../../ports/server-hosting.port\";\nimport { perEnv } from \"../../../application/config/perEnv\";\n\nconst ServerSettings = z.object({\n service: z.string().describe(\"The service it deploys\"),\n url: perEnv(z.string()).optional().describe(\"Where it answers, for other apps to read\"),\n});\n\nconst Resolved = z.object({ service: z.string() });\n\n/** A deploy a module asked for. */\nexport interface Asked {\n tag: string;\n environment: Environment;\n service: string;\n}\n\n/** A server host held in memory: it deploys nothing, and records each deploy it was asked for. */\nexport class ServerHostingFake implements ServerHostingPort {\n readonly capability = \"server-hosting\";\n\n private needs: Requirement[] = [];\n readonly received: Asked[] = [];\n\n /** What doctor checks for each app it ships. */\n seed({ requirements }: { requirements: Requirement[] }) {\n this.needs = requirements;\n return this;\n }\n\n describe = ({ options }: JobInput<Record<string, unknown>>) =>\n `${Resolved.parse(options).service} (fake)`;\n\n jobs = ({ tag, environment, options }: JobInput<Record<string, unknown>>): Job[] => {\n const { service } = Resolved.parse(options);\n this.received.push({ tag, environment, service });\n return [\n {\n label: `deploy ${tag} to ${service} (fake)`,\n local: [{ command: \"echo\", args: [\"deploy\", service, tag] }],\n ci: { ref: tag },\n record: true,\n },\n ];\n };\n\n requirements = () => this.needs;\n}\n\n/** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */\nexport const serverHostingFake = (\n fake = new ServerHostingFake(),\n): DeliveryAdapter<ServerHostingPort> & { fake: ServerHostingFake } => ({\n name: \"fake\",\n capability: \"server-hosting\",\n settings: ServerSettings,\n typicalMinutes: 1,\n requirements: () => fake.requirements(),\n create: () => fake,\n fake,\n});\n","import { z } from \"zod\";\n\nimport type { Environment } from \"../../../domain/environment\";\nimport type { DeliveryAdapter } from \"../../../ports/adapter.port\";\nimport type { Job, JobInput, Requirement } from \"../../../ports/delivery.port\";\nimport type { StaticHostingPort } from \"../../../ports/static-hosting.port\";\n\nconst StaticSettings = z.object({\n site: z.string().describe(\"The site it uploads to\"),\n});\n\n/** An upload a module asked for. */\nexport interface Asked {\n tag: string;\n environment: Environment;\n site: string;\n}\n\n/** A static host held in memory: it uploads nothing, and records each upload it was asked for. */\nexport class StaticHostingFake implements StaticHostingPort {\n readonly capability = \"static-hosting\";\n\n private needs: Requirement[] = [];\n readonly received: Asked[] = [];\n\n /** What doctor checks for each app it ships. */\n seed({ requirements }: { requirements: Requirement[] }) {\n this.needs = requirements;\n return this;\n }\n\n describe = ({ options, environment }: JobInput<Record<string, unknown>>) =>\n `${StaticSettings.parse(options).site} (fake, ${environment})`;\n\n jobs = ({ tag, environment, options }: JobInput<Record<string, unknown>>): Job[] => {\n const { site } = StaticSettings.parse(options);\n this.received.push({ tag, environment, site });\n return [\n {\n label: `build ${tag} and upload it to ${site} (fake)`,\n local: [{ command: \"echo\", args: [\"upload\", site, tag] }],\n ci: { ref: tag },\n record: true,\n },\n ];\n };\n\n requirements = () => this.needs;\n}\n\n/** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */\nexport const staticHostingFake = (\n fake = new StaticHostingFake(),\n): DeliveryAdapter<StaticHostingPort> & { fake: StaticHostingFake } => ({\n name: \"fake\",\n capability: \"static-hosting\",\n settings: StaticSettings,\n typicalMinutes: 1,\n requirements: () => fake.requirements(),\n create: () => fake,\n fake,\n});\n","import { z } from \"zod\";\n\nimport type { Environment } from \"../../../domain/environment\";\nimport type { DeliveryAdapter } from \"../../../ports/adapter.port\";\nimport type {\n DecideContext,\n Decision,\n Health,\n Job,\n JobInput,\n Requirement,\n} from \"../../../ports/delivery.port\";\nimport type { MobileDistributionPort } from \"../../../ports/mobile-distribution.port\";\n\nconst MobileSettings = z.object({\n app: z.string().describe(\"The app it ships to the stores and over the air\"),\n});\n\nconst DECIDED_BY = {\n platform: \"the fake platform\",\n choice: \"update or nothing\",\n check: \"shiplane status\",\n};\n\ninterface MobileState {\n /** The version each environment runs. */\n live: Partial<Record<Environment, string>>;\n /** How each tag does where it runs. */\n health: Record<string, Health>;\n requirements: Requirement[];\n}\n\n/** What a module asked of it. */\nexport interface Asked {\n stage: \"jobs\" | \"decide\" | \"health\" | \"inspect\";\n tag: string;\n environment: Environment;\n}\n\n/**\n * A mobile platform held in memory: seed what each environment runs and how a tag does; a version\n * not live yet ships as an update.\n */\nexport class MobileDistributionFake implements MobileDistributionPort {\n readonly capability = \"mobile-distribution\";\n\n private state: MobileState = { live: {}, health: {}, requirements: [] };\n readonly received: Asked[] = [];\n\n seed(state: Partial<MobileState>) {\n this.state = { ...this.state, ...state };\n return this;\n }\n\n private ask(stage: Asked[\"stage\"], { tag, environment }: JobInput<Record<string, unknown>>) {\n this.received.push({ stage, tag, environment });\n }\n\n describe = ({ options, environment }: JobInput<Record<string, unknown>>) =>\n `${MobileSettings.parse(options).app} on ${environment} (fake)`;\n\n jobs = (input: JobInput<Record<string, unknown>>): Job[] => {\n this.ask(\"jobs\", input);\n const { tag, environment, options } = input;\n const { app } = MobileSettings.parse(options);\n return [\n {\n label: `publish ${tag} to ${app} on ${environment} (fake)`,\n local: [{ command: \"echo\", args: [\"update\", app, tag] }],\n ci: { ref: tag },\n },\n ];\n };\n\n decide = (_context: DecideContext, input: JobInput<Record<string, unknown>>) => {\n this.ask(\"decide\", input);\n const { unit, environment } = input;\n const decision: Decision =\n this.state.live[environment] === unit.version\n ? { action: \"none\", status: `${unit.name} ${unit.version} is on ${environment}` }\n : { action: \"ship\", kind: \"update\", jobs: this.jobs(input) };\n return Promise.resolve(decision);\n };\n\n health = (_context: DecideContext, input: JobInput<Record<string, unknown>>) => {\n this.ask(\"health\", input);\n return Promise.resolve(this.state.health[input.tag] ?? null);\n };\n\n inspect = (_context: DecideContext, input: JobInput<Record<string, unknown>>) => {\n this.ask(\"inspect\", input);\n return Promise.resolve({ live: this.state.live[input.environment] ?? null });\n };\n\n requirements = () => this.state.requirements;\n}\n\n/** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */\nexport const mobileDistributionFake = (\n fake = new MobileDistributionFake(),\n): DeliveryAdapter<MobileDistributionPort> & { fake: MobileDistributionFake } => ({\n name: \"fake\",\n capability: \"mobile-distribution\",\n settings: MobileSettings,\n typicalMinutes: 1,\n decidedBy: DECIDED_BY,\n requirements: () => fake.requirements(),\n create: () => fake,\n fake,\n});\n","import { z } from \"zod\";\n\nimport type { Environment } from \"../../../domain/environment\";\nimport type { DeliveryAdapter } from \"../../../ports/adapter.port\";\nimport type {\n DecideContext,\n Decision,\n Job,\n JobInput,\n Requirement,\n} from \"../../../ports/delivery.port\";\nimport type { PackageRegistryPort } from \"../../../ports/package-registry.port\";\n\nconst PackageSettings = z.object({\n tag: z.string().default(\"latest\").describe(\"The dist-tag a release moves\"),\n});\n\n/** What a module asked of it. */\nexport interface Asked {\n stage: \"jobs\" | \"decide\";\n tag: string;\n environment: Environment;\n}\n\n/** A package registry held in memory: seed what is published, a version not there yet publishes. */\nexport class PackageRegistryFake implements PackageRegistryPort {\n readonly capability = \"package-registry\";\n\n /** `<package>@<version>` already published. */\n private published = new Set<string>();\n private needs: Requirement[] = [];\n readonly received: Asked[] = [];\n\n seed({\n published = [],\n requirements = [],\n }: {\n published?: string[];\n requirements?: Requirement[];\n }) {\n this.published = new Set(published);\n this.needs = requirements;\n return this;\n }\n\n describe = ({ unit, options }: JobInput<Record<string, unknown>>) =>\n `${unit.packageName} (fake, ${PackageSettings.parse(options).tag})`;\n\n jobs = ({ unit, tag, environment, options }: JobInput<Record<string, unknown>>): Job[] => {\n this.received.push({ stage: \"jobs\", tag, environment });\n return [\n {\n label: `publish ${unit.packageName}@${unit.version} under ${PackageSettings.parse(options).tag} (fake)`,\n local: [{ command: \"echo\", args: [\"publish\", unit.packageName, unit.version] }],\n },\n ];\n };\n\n decide = (_context: DecideContext, input: JobInput<Record<string, unknown>>) => {\n const { unit, tag, environment } = input;\n this.received.push({ stage: \"decide\", tag, environment });\n const decision: Decision = this.published.has(`${unit.packageName}@${unit.version}`)\n ? { action: \"none\", status: `${unit.packageName}@${unit.version} is published` }\n : { action: \"ship\", kind: \"publish\", jobs: this.jobs(input) };\n return Promise.resolve(decision);\n };\n\n live = (_context: DecideContext, { unit }: JobInput<Record<string, unknown>>) =>\n Promise.resolve(this.published.has(`${unit.packageName}@${unit.version}`));\n\n requirements = () => this.needs;\n}\n\n/** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */\nexport const packageRegistryFake = (\n fake = new PackageRegistryFake(),\n): DeliveryAdapter<PackageRegistryPort> & { fake: PackageRegistryFake } => ({\n name: \"fake\",\n capability: \"package-registry\",\n settings: PackageSettings,\n typicalMinutes: 1,\n requirements: () => fake.requirements(),\n create: () => fake,\n fake,\n});\n","import type { UnitRef } from \"../domain/changes\";\nimport type { DecidedBy } from \"../domain/scope\";\n\n/** This repository's four shipping units, as the rule tests were written against them. */\nexport const SAMPLE_UNITS: UnitRef[] = [\"expo\", \"api\", \"admin\", \"landing\"].map((name) => ({\n name,\n packageName: `@acme/${name}`,\n}));\n\nexport const SAMPLE_VERSION_FILES = new Set([\n \"apps/expo/app-version.json\",\n \"apps/api/public/app-version.preview.json\",\n \"apps/api/public/app-version.production.json\",\n]);\n\n// Billed minutes per deploy with no successful run to measure: the api validates before deploying.\nexport const SAMPLE_TYPICAL_MINUTES: Record<string, number> = {\n api: 13,\n admin: 5,\n landing: 4,\n expo: 8,\n};\n\nexport const EAS_DECIDES: DecidedBy = {\n platform: \"EAS\",\n choice: \"build or update\",\n check: \"shiplane status\",\n};\n","import { execFileSync } from \"node:child_process\";\nimport { z } from \"zod\";\n\nimport { systemShell } from \"../adapters/shell/system-shell.adapter\";\n\n/**\n * Contract suites against hosted services run only with RELEASE_CONTRACT_LIVE=1, on a sandbox\n * repository checked out at RELEASE_CONTRACT_REPO: they open pull requests, publish releases and\n * dispatch workflows there.\n */\nexport const LIVE = systemShell.env(\"RELEASE_CONTRACT_LIVE\") === \"1\";\n\n/** The sandbox checkout, refused when unset so a live run never touches this repository. */\nexport const sandbox = () =>\n z\n .string({ message: \"RELEASE_CONTRACT_REPO names a sandbox checkout for live contracts\" })\n .min(1)\n .parse(systemShell.env(\"RELEASE_CONTRACT_REPO\"));\n\n/** Runs git in the sandbox and returns what it printed. */\nexport const inSandbox = (args: string[]) =>\n execFileSync(\"git\", args, { cwd: sandbox(), encoding: \"utf8\" }).trim();\n","import type { PlannedChangeset, StatusPlan } from \"../domain/changes\";\nimport { nextPatch } from \"../domain/versions\";\n\nconst bump = (version: string, type: string) => {\n const [major = 0, minor = 0] = version.split(\".\").map(Number);\n if (type === \"major\") return `${major + 1}.0.0`;\n if (type === \"minor\") return `${major}.${minor + 1}.0`;\n return nextPatch(version);\n};\n\n/**\n * What `changeset status` answers for these pending changesets, plus the ones a release adds, minus\n * the lines it holds back: every named package moves once, by its biggest bump.\n */\nexport const planFrom =\n (pending: PlannedChangeset[], versions: Record<string, string>) =>\n (added: PlannedChangeset[], held: PlannedChangeset[]): StatusPlan => {\n const heldLines = new Set(\n held.flatMap(({ id, releases }) => releases.map(({ name }) => `${id}:${name}`)),\n );\n const changesets = [...pending, ...added]\n .map((changeset) => ({\n ...changeset,\n releases: changeset.releases.filter(\n ({ name }) => !heldLines.has(`${changeset.id}:${name}`),\n ),\n }))\n .filter(({ releases }) => releases.length > 0);\n const order = [\"major\", \"minor\", \"patch\"];\n const names = [\n ...new Set(changesets.flatMap(({ releases }) => releases.map(({ name }) => name))),\n ];\n return {\n changesets,\n releases: names.map((name) => {\n const lines = changesets.filter(({ releases }) =>\n releases.some((line) => line.name === name),\n );\n const type =\n order.find((candidate) =>\n lines.some(({ releases }) =>\n releases.some((line) => line.name === name && line.type === candidate),\n ),\n ) ?? \"patch\";\n const oldVersion = versions[name] ?? \"0.1.0\";\n return {\n name,\n type: type as \"patch\",\n oldVersion,\n newVersion: bump(oldVersion, type),\n changesets: lines.map(({ id }) => id),\n };\n }),\n };\n };\n","import { execFileSync, spawnSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\nimport { systemShell } from \"../adapters/shell/system-shell.adapter\";\n\n/** What the built CLI printed and the code it exited with. */\nexport interface CliRun {\n status: number;\n output: string;\n}\n\nexport interface ConsumerRepository {\n root: string;\n /** The bare repository the checkout pushes to, standing in for GitHub. */\n origin: string;\n write: (file: string, text: string) => void;\n read: (file: string) => string;\n /** Runs git in the checkout, or in the bare origin with `{ in: \"origin\" }`. */\n git: (args: string[], where?: { in: \"origin\" }) => string;\n /** Commits every file as it stands and pushes the branch to the origin. */\n commitAndPush: (title: string) => void;\n /** Runs the built `shiplane` CLI in the checkout, as a person types it. */\n shiplane: (args: string[]) => CliRun;\n remove: () => void;\n}\n\nconst CORE = \"shiplane\";\n\nconst coreDir = (from: string): string => {\n const manifest = path.join(from, \"package.json\");\n if (fs.existsSync(manifest)) {\n const { name } = JSON.parse(fs.readFileSync(manifest, \"utf8\")) as { name?: string };\n if (name === CORE) return from;\n }\n const parent = path.dirname(from);\n if (parent === from) throw new Error(`${CORE} not found above ${import.meta.dirname}`);\n return coreDir(parent);\n};\n\n/** The built CLI, as `pnpm add shiplane` installs it. */\nexport const builtCli = (): string => {\n const cli = path.join(coreDir(import.meta.dirname), \"dist\", \"cli.js\");\n if (!fs.existsSync(cli)) {\n throw new Error(`shiplane is not built: run pnpm turbo run build --filter=${CORE}`);\n }\n return cli;\n};\n\n// No global git config, signing key, token or CI marker leaks in: a run sees only this repository.\nconst LEAKS = new Set([\"GITHUB_ACTIONS\", \"CI\", \"GITHUB_TOKEN\", \"GH_TOKEN\"]);\n\nconst hermeticEnv = (home: string, bin: string): NodeJS.ProcessEnv => ({\n ...Object.fromEntries(Object.entries(process.env).filter(([name]) => !LEAKS.has(name))),\n PATH: [bin, systemShell.env(\"PATH\") ?? \"\"].join(path.delimiter),\n HOME: home,\n GIT_CONFIG_GLOBAL: path.join(home, \".gitconfig\"),\n GIT_CONFIG_NOSYSTEM: \"1\",\n NO_COLOR: \"1\",\n // A fixed date makes each commit's hash depend on its files only, so docs can quote a run.\n GIT_AUTHOR_DATE: \"2026-01-01T00:00:00Z\",\n GIT_COMMITTER_DATE: \"2026-01-01T00:00:00Z\",\n});\n\n// The tools that reach a platform answer offline, so a run that would call one fails at once.\nconst OFFLINE = [\"gh\", \"npm\", \"flyctl\"];\n\nconst offlineTools = (bin: string) => {\n fs.mkdirSync(bin);\n OFFLINE.forEach((tool) => {\n const file = path.join(bin, tool);\n fs.writeFileSync(file, `#!/bin/sh\\necho \"${tool}: offline in this repository\" >&2\\nexit 1\\n`);\n fs.chmodSync(file, 0o755);\n });\n};\n\n/**\n * A repository as a consumer has it: its files, the packages it installed linked in its\n * node_modules, one commit pushed to a local bare origin. gh, npm and flyctl answer offline.\n */\nexport const consumerRepository = ({\n files,\n packages = {},\n branch = \"main\",\n}: {\n files: Record<string, string>;\n /** The branch releases start from, created first and pushed. */\n branch?: string;\n /** Package name to the folder it installs from, such as a plugin's workspace folder. */\n packages?: Record<string, string>;\n}): ConsumerRepository => {\n const dir = fs.mkdtempSync(path.join(os.tmpdir(), \"shiplane-consumer-\"));\n const root = path.join(dir, \"checkout\");\n const origin = path.join(dir, \"origin.git\");\n const home = path.join(dir, \"home\");\n fs.mkdirSync(home);\n fs.writeFileSync(\n path.join(home, \".gitconfig\"),\n \"[user]\\n\\tname = Shiplane Consumer\\n\\temail = consumer@example.com\\n\" +\n \"[commit]\\n\\tgpgsign = false\\n[tag]\\n\\tgpgsign = false\\n[core]\\n\\thooksPath = /dev/null\\n\",\n );\n const bin = path.join(dir, \"bin\");\n offlineTools(bin);\n const env = hermeticEnv(home, bin);\n const git = (args: string[], where?: { in: \"origin\" }) =>\n execFileSync(\"git\", args, {\n cwd: where ? origin : root,\n env,\n stdio: \"pipe\",\n encoding: \"utf8\",\n }).trim();\n const write = (file: string, text: string) => {\n const target = path.join(root, file);\n fs.mkdirSync(path.dirname(target), { recursive: true });\n fs.writeFileSync(target, text);\n };\n\n fs.mkdirSync(root);\n execFileSync(\"git\", [\"init\", \"--quiet\", \"--bare\", `--initial-branch=${branch}`, origin], { env });\n git([\"init\", \"--quiet\", `--initial-branch=${branch}`]);\n git([\"remote\", \"add\", \"origin\", origin]);\n write(\".gitignore\", \"node_modules\\n\");\n Object.entries(files).forEach(([file, text]) => write(file, text));\n Object.entries({ [CORE]: coreDir(import.meta.dirname), ...packages }).forEach(([name, from]) => {\n const link = path.join(root, \"node_modules\", name);\n fs.mkdirSync(path.dirname(link), { recursive: true });\n fs.symlinkSync(from, link, \"dir\");\n });\n const commitAndPush = (title: string) => {\n git([\"add\", \"--all\"]);\n git([\"commit\", \"--quiet\", \"-m\", title]);\n git([\"push\", \"--quiet\", \"origin\", branch]);\n };\n commitAndPush(\"chore: start\");\n\n const cli = builtCli();\n return {\n root,\n origin,\n write,\n read: (file) => fs.readFileSync(path.join(root, file), \"utf8\"),\n git,\n commitAndPush,\n shiplane: (args) => {\n const run = spawnSync(process.execPath, [cli, ...args], {\n cwd: root,\n env,\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n return { status: run.status ?? 1, output: `${run.stdout}${run.stderr}` };\n },\n remove: () => fs.rmSync(dir, { recursive: true, force: true }),\n };\n};\n","import fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\n/** The public API a test config imports, resolved to source since tests run before any build. */\nexport const SOURCE_ALIASES: Record<string, string> = {\n shiplane: path.resolve(import.meta.dirname, \"../index.ts\"),\n \"shiplane/plugin\": path.resolve(import.meta.dirname, \"../plugin.ts\"),\n \"shiplane/testing\": path.resolve(import.meta.dirname, \"public.ts\"),\n};\n\nexport interface Workspace {\n root: string;\n write: (file: string, text: string) => void;\n read: (file: string) => string;\n exists: (file: string) => boolean;\n remove: () => void;\n}\n\n/** A throwaway repository on disk, one entry per file, removed by `remove()`. */\nexport const createWorkspace = (files: Record<string, string>): Workspace => {\n const root = fs.mkdtempSync(path.join(os.tmpdir(), \"release-workspace-\"));\n const write = (file: string, text: string) => {\n const target = path.join(root, file);\n fs.mkdirSync(path.dirname(target), { recursive: true });\n fs.writeFileSync(target, text);\n };\n Object.entries(files).forEach(([file, text]) => write(file, text));\n return {\n root,\n write,\n read: (file) => fs.readFileSync(path.join(root, file), \"utf8\"),\n exists: (file) => fs.existsSync(path.join(root, file)),\n remove: () => fs.rmSync(root, { recursive: true, force: true }),\n };\n};\n\nexport const packageJson = (name: string, version = \"1.0.0\", extra: object = {}) =>\n JSON.stringify({ name, version, ...extra }, null, 2);\n"],"mappings":";;;;;;;;;;;;AAUA,IAAa,iBAAb,MAA6C;CAC3C,QAA8B,EAAE;CAChC,UAAsF,EAAE;CACxF,YAA4C,EAAE;CAE9C,QAAQ,WAAmC;AACzC,OAAK,YAAY;GAAE,GAAG,KAAK;GAAW,GAAG;GAAW;AACpD,SAAO;;CAGT,OAAO,SAAiB,KAAK,UAAU;;CAGvC,KAAK,QAAgB,QAA8B;AACjD,OAAK,QAAQ,KAAK;GAAE;GAAQ;GAAQ,CAAC;AACrC,SAAO;;;CAIT,SAAS,QAAgB,QAA8B;AACrD,OAAK,QAAQ,QAAQ;GAAE;GAAQ;GAAQ,MAAM;GAAM,CAAC;AACpD,SAAO;;CAGT,OAAe,SAAiB,MAAyB,SAAkC;AACzF,OAAK,MAAM,KAAK;GAAE;GAAS,MAAM,CAAC,GAAG,KAAK;GAAE,KAAK,QAAQ;GAAK,KAAK,QAAQ;GAAK,CAAC;EACjF,MAAM,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC,KAAK,IAAI;EACzC,MAAM,QAAQ,KAAK,QAAQ,MAAM,EAAE,aAAa,KAAK,WAAW,OAAO,CAAC;AACxE,MAAI,OAAO,KAAM,MAAK,QAAQ,OAAO,KAAK,QAAQ,QAAQ,MAAM,EAAE,EAAE;AACpE,SAAO;GAAE,QAAQ;GAAG,QAAQ;GAAI,QAAQ;GAAI,GAAG,OAAO;GAAQ;;CAGhE,WAAW,SAAiB,MAAyB,UAAsB,EAAE,KAC3E,QAAQ,QAAQ,KAAK,OAAO,SAAS,MAAM,QAA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AAM;CAAS,GAAG;CAAO,EAAE,MAAM,EAAE"}
@@ -0,0 +1,83 @@
1
+ import { z } from "zod";
2
+ //#region src/application/config/perEnv.ts
3
+ /** A value that is the same everywhere, or written once per environment. */
4
+ const perEnv = (value) => z.union([value, z.strictObject({
5
+ preview: value,
6
+ production: value
7
+ })]);
8
+ //#endregion
9
+ //#region src/application/releaseFlow.ts
10
+ /** How the release itself runs, given an adapter for each port it runs on. */
11
+ const releaseFlow = (ports) => ({
12
+ type: "flow",
13
+ ...ports
14
+ });
15
+ //#endregion
16
+ //#region src/modules/deliveryModule.ts
17
+ /** The stages every delivery adapter answers: its settings, where a tag lands and its jobs. */
18
+ const deliveryModule = (kind, adapter, name = kind) => ({
19
+ type: "module",
20
+ name,
21
+ kind,
22
+ provider: adapter.name,
23
+ settings: adapter.settings,
24
+ adapters: [adapter],
25
+ decidedBy: adapter.decidedBy,
26
+ typicalMinutes: adapter.typicalMinutes,
27
+ requirements: (apps) => apps.flatMap((unit) => adapter.requirements?.(unit) ?? []),
28
+ ship: ({ open }, input) => {
29
+ const port = open(adapter);
30
+ return {
31
+ where: port.describe(input),
32
+ jobs: port.jobs(input)
33
+ };
34
+ }
35
+ });
36
+ //#endregion
37
+ //#region src/modules/backend-service/backend-service.module.ts
38
+ /** A long-lived service, such as an API: deployed from its tag, recorded with the code host. */
39
+ const backendService = ({ name, serverHosting }) => deliveryModule("backend-service", serverHosting, name);
40
+ //#endregion
41
+ //#region src/modules/mobile-app/mobile-app.module.ts
42
+ /**
43
+ * A mobile app: its distribution decides between a store build and an over-the-air update, adds to
44
+ * the release PR, and says how a version does before it is promoted.
45
+ */
46
+ const mobileApp = ({ name, mobileDistribution }) => ({
47
+ ...deliveryModule("mobile-app", mobileDistribution, name),
48
+ versionFiles: (unit, units, open) => open(mobileDistribution).versionFiles?.(unit, units) ?? [],
49
+ version: async (context, input) => {
50
+ const port = context.open(mobileDistribution);
51
+ return port.beforeVersion ? port.beforeVersion(context, input) : {
52
+ added: [],
53
+ writes: [],
54
+ summary: [],
55
+ onMerge: ""
56
+ };
57
+ },
58
+ decide: (context, input) => context.open(mobileDistribution).decide(context, input),
59
+ health: async (context, input) => {
60
+ const port = context.open(mobileDistribution);
61
+ return port.health ? port.health(context, input) : null;
62
+ },
63
+ inspect: async (context, input) => {
64
+ const port = context.open(mobileDistribution);
65
+ return port.inspect ? port.inspect(context, input) : void 0;
66
+ }
67
+ });
68
+ //#endregion
69
+ //#region src/modules/published-package/published-package.module.ts
70
+ /** A package others install: its registry, not deploy records, knows what is out. */
71
+ const publishedPackage = ({ name, packageRegistry }) => ({
72
+ ...deliveryModule("published-package", packageRegistry, name),
73
+ decide: (context, input) => context.open(packageRegistry).decide(context, input),
74
+ live: (context, input) => context.open(packageRegistry).live(context, input)
75
+ });
76
+ //#endregion
77
+ //#region src/modules/web-app/web-app.module.ts
78
+ /** A static site, built against the environment it ships to. */
79
+ const webApp = ({ name, staticHosting }) => deliveryModule("web-app", staticHosting, name);
80
+ //#endregion
81
+ export { releaseFlow as a, backendService as i, publishedPackage as n, perEnv as o, mobileApp as r, webApp as t };
82
+
83
+ //# sourceMappingURL=web-app.module-Bw-npC4Z.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-app.module-Bw-npC4Z.js","names":[],"sources":["../src/application/config/perEnv.ts","../src/application/releaseFlow.ts","../src/modules/deliveryModule.ts","../src/modules/backend-service/backend-service.module.ts","../src/modules/mobile-app/mobile-app.module.ts","../src/modules/published-package/published-package.module.ts","../src/modules/web-app/web-app.module.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport type { Environment } from \"../../domain/environment\";\n\n/** A value that is the same everywhere, or written once per environment. */\nexport const perEnv = <Value extends z.ZodType>(value: Value) =>\n z.union([value, z.strictObject({ preview: value, production: value })]);\n\nexport type PerEnv<Value> = Value | Record<Environment, Value>;\n","import type { ReleaseFlow } from \"../modules/module\";\nimport type { ServiceAdapter } from \"../ports/adapter.port\";\nimport type { CiPipelinePort } from \"../ports/ci-pipeline.port\";\nimport type { CodeHostPort } from \"../ports/code-host.port\";\nimport type { SourceControlPort } from \"../ports/source-control.port\";\nimport type { VersioningPort } from \"../ports/versioning.port\";\n\n/** How the release itself runs, given an adapter for each port it runs on. */\nexport const releaseFlow = (ports: {\n sourceControl: ServiceAdapter<SourceControlPort>;\n codeHost: ServiceAdapter<CodeHostPort>;\n ciPipeline: ServiceAdapter<CiPipelinePort>;\n versioning: ServiceAdapter<VersioningPort>;\n}): ReleaseFlow => ({ type: \"flow\", ...ports });\n","import type { DeliveryAdapter } from \"../ports/adapter.port\";\nimport type { Delivery } from \"../ports/delivery.port\";\nimport type { ReleaseModule } from \"./module\";\n\n/** What every module of apps takes besides its adapter: a name, when two of a kind sit side by side. */\nexport interface Named {\n /** What an app's unit file names; the module's kind by default. */\n name?: string;\n}\n\n/** The stages every delivery adapter answers: its settings, where a tag lands and its jobs. */\nexport const deliveryModule = <Port extends Delivery & { capability: string }>(\n kind: string,\n adapter: DeliveryAdapter<Port>,\n name = kind,\n): ReleaseModule => ({\n type: \"module\",\n name,\n kind,\n provider: adapter.name,\n settings: adapter.settings,\n adapters: [adapter],\n decidedBy: adapter.decidedBy,\n typicalMinutes: adapter.typicalMinutes,\n requirements: (apps) => apps.flatMap((unit) => adapter.requirements?.(unit) ?? []),\n ship: ({ open }, input) => {\n const port = open(adapter);\n return { where: port.describe(input), jobs: port.jobs(input) };\n },\n});\n","import type { DeliveryAdapter } from \"../../ports/adapter.port\";\nimport type { ServerHostingPort } from \"../../ports/server-hosting.port\";\nimport type { Named } from \"../deliveryModule\";\nimport type { ReleaseModule } from \"../module\";\nimport { deliveryModule } from \"../deliveryModule\";\n\n/** A long-lived service, such as an API: deployed from its tag, recorded with the code host. */\nexport const backendService = ({\n name,\n serverHosting,\n}: Named & { serverHosting: DeliveryAdapter<ServerHostingPort> }): ReleaseModule =>\n deliveryModule(\"backend-service\", serverHosting, name);\n","import type { DeliveryAdapter } from \"../../ports/adapter.port\";\nimport type { MobileDistributionPort } from \"../../ports/mobile-distribution.port\";\nimport type { Named } from \"../deliveryModule\";\nimport type { ReleaseModule } from \"../module\";\nimport { deliveryModule } from \"../deliveryModule\";\n\n/**\n * A mobile app: its distribution decides between a store build and an over-the-air update, adds to\n * the release PR, and says how a version does before it is promoted.\n */\nexport const mobileApp = ({\n name,\n mobileDistribution,\n}: Named & { mobileDistribution: DeliveryAdapter<MobileDistributionPort> }): ReleaseModule => ({\n ...deliveryModule(\"mobile-app\", mobileDistribution, name),\n versionFiles: (unit, units, open) => open(mobileDistribution).versionFiles?.(unit, units) ?? [],\n version: async (context, input) => {\n const port = context.open(mobileDistribution);\n return port.beforeVersion\n ? port.beforeVersion(context, input)\n : { added: [], writes: [], summary: [], onMerge: \"\" };\n },\n decide: (context, input) => context.open(mobileDistribution).decide(context, input),\n health: async (context, input) => {\n const port = context.open(mobileDistribution);\n return port.health ? port.health(context, input) : null;\n },\n inspect: async (context, input) => {\n const port = context.open(mobileDistribution);\n return port.inspect ? port.inspect(context, input) : undefined;\n },\n});\n","import type { DeliveryAdapter } from \"../../ports/adapter.port\";\nimport type { PackageRegistryPort } from \"../../ports/package-registry.port\";\nimport type { Named } from \"../deliveryModule\";\nimport type { ReleaseModule } from \"../module\";\nimport { deliveryModule } from \"../deliveryModule\";\n\n/** A package others install: its registry, not deploy records, knows what is out. */\nexport const publishedPackage = ({\n name,\n packageRegistry,\n}: Named & { packageRegistry: DeliveryAdapter<PackageRegistryPort> }): ReleaseModule => ({\n ...deliveryModule(\"published-package\", packageRegistry, name),\n decide: (context, input) => context.open(packageRegistry).decide(context, input),\n live: (context, input) => context.open(packageRegistry).live(context, input),\n});\n","import type { DeliveryAdapter } from \"../../ports/adapter.port\";\nimport type { StaticHostingPort } from \"../../ports/static-hosting.port\";\nimport type { Named } from \"../deliveryModule\";\nimport type { ReleaseModule } from \"../module\";\nimport { deliveryModule } from \"../deliveryModule\";\n\n/** A static site, built against the environment it ships to. */\nexport const webApp = ({\n name,\n staticHosting,\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AAmB;AAC7C,SAAO,KAAK,SAAS,KAAK,OAAO,SAAS,MAAM,GAAG;;CAErD,SAAS,OAAO,SAAS,UAAU;EACjC,MAAM,OAAO,QAAQ,KAAK,mBAAmB;AAC7C,SAAO,KAAK,UAAU,KAAK,QAAQ,SAAS,MAAM,GAAG,KAAA;;CAExD;;;;ACxBD,MAAa,oBAAoB,EAC/B,MACA,uBACuF;CACvF,GAAG,eAAe,qBAAqB,iBAAiB,KAAK;CAC7D,SAAS,SAAS,UAAU,QAAQ,KAAK,gBAAgB,CAAC,OAAO,SAAS,MAAM;CAChF,OAAO,SAAS,UAAU,QAAQ,KAAK,gBAAgB,CAAC,KAAK,SAAS,MAAM;CAC7E;;;;ACPD,MAAa,UAAU,EACrB,MACA,oBAEA,eAAe,WAAW,eAAe,KAAK"}
package/package.json CHANGED
@@ -1,12 +1,61 @@
1
1
  {
2
2
  "name": "shiplane",
3
- "version": "0.0.0",
4
- "description": "Coming soon",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
3
+ "version": "0.1.0",
4
+ "description": "The shiplane CLI: detects what changed, versions it and triggers each app's deploy through the plugins its config composes.",
5
+ "homepage": "https://github.com/arnaud-zg/packages/tree/main/packages/shiplane#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/arnaud-zg/packages/issues"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/arnaud-zg/packages.git",
12
+ "directory": "packages/shiplane"
13
+ },
14
+ "license": "MIT",
15
+ "author": "Arnaud Zheng <arnaud.zg@gmail.com>",
16
+ "type": "module",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.js"
21
+ },
22
+ "./plugin": {
23
+ "types": "./dist/plugin.d.ts",
24
+ "default": "./dist/plugin.js"
25
+ },
26
+ "./testing": {
27
+ "types": "./dist/testing.d.ts",
28
+ "default": "./dist/testing.js"
29
+ },
30
+ "./package.json": "./package.json"
31
+ },
32
+ "bin": {
33
+ "shiplane": "./dist/cli.js"
8
34
  },
9
- "keywords": [],
10
- "author": "",
11
- "license": "ISC"
12
- }
35
+ "files": [
36
+ "dist"
37
+ ],
38
+ "dependencies": {
39
+ "@clack/prompts": "1.7.0",
40
+ "jiti": "2.7.0",
41
+ "yaml": "2.9.0",
42
+ "zod": "4.3.6"
43
+ },
44
+ "devDependencies": {
45
+ "@arnaud-zg/configs": "0.3.0",
46
+ "@types/node": "^22.0.0",
47
+ "eslint": "^9.39.4",
48
+ "prettier": "^3.8.3",
49
+ "typescript": "6.0.3",
50
+ "vitest": "^4.1.11"
51
+ },
52
+ "scripts": {
53
+ "build": "tsdown",
54
+ "clean": "git clean -xdf .cache .turbo dist node_modules",
55
+ "format": "prettier --write . --cache --cache-location .cache/.prettiercache",
56
+ "lint": "eslint --cache --cache-location .cache/.eslintcache",
57
+ "start": "node dist/cli.js",
58
+ "test": "vitest run",
59
+ "typecheck": "tsc -p tsconfig.typecheck.json"
60
+ }
61
+ }