shiplane 0.5.2 → 0.6.0-fix-shiplane-ship-node-cache.3dccda9

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.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.js +157 -312
  3. package/dist/cli.js.map +1 -1
  4. package/dist/{readStatus-DypM0faL.js → compose-BTQXZqHM.js} +2758 -1448
  5. package/dist/compose-BTQXZqHM.js.map +1 -0
  6. package/dist/{budget-BTnKtGF6.js → display-CfV4G1TR.js} +155 -52
  7. package/dist/display-CfV4G1TR.js.map +1 -0
  8. package/dist/{static-hosting.port-B5i6W7eD.d.ts → index-B1Rd22nM.d.ts} +482 -21
  9. package/dist/index.d.ts +2 -3
  10. package/dist/index.js +3 -4
  11. package/dist/{issues-TcWtMTv5.js → issues-DCRpXUBW.js} +1 -1
  12. package/dist/{issues-TcWtMTv5.js.map → issues-DCRpXUBW.js.map} +1 -1
  13. package/dist/memory.d.ts +1 -1
  14. package/dist/memory.js +1 -1
  15. package/dist/{package-registry.fake-BLBdd7IQ.d.ts → package-registry.fake-CjoePEzE.d.ts} +53 -6
  16. package/dist/{package-registry.fake-CN6M1-Gi.js → package-registry.fake-ykiSBd8M.js} +58 -6
  17. package/dist/package-registry.fake-ykiSBd8M.js.map +1 -0
  18. package/dist/plugin-D-JQhwVd.d.ts +118 -0
  19. package/dist/plugin.d.ts +3 -23
  20. package/dist/plugin.js +84 -7
  21. package/dist/plugin.js.map +1 -0
  22. package/dist/shell-server-hosting.adapter-CvOcC6Wh.js +369 -0
  23. package/dist/shell-server-hosting.adapter-CvOcC6Wh.js.map +1 -0
  24. package/dist/{src-DO7WyrfV.js → src-8BbKTQBb.js} +2 -2
  25. package/dist/src-8BbKTQBb.js.map +1 -0
  26. package/dist/testing.d.ts +103 -18
  27. package/dist/testing.js +235 -22
  28. package/dist/testing.js.map +1 -1
  29. package/package.json +2 -1
  30. package/dist/budget-BTnKtGF6.js.map +0 -1
  31. package/dist/display-IqkJ6uCw.js +0 -96
  32. package/dist/display-IqkJ6uCw.js.map +0 -1
  33. package/dist/index-C_urG4yY.d.ts +0 -252
  34. package/dist/package-registry.fake-CN6M1-Gi.js.map +0 -1
  35. package/dist/readStatus-DypM0faL.js.map +0 -1
  36. package/dist/shell-server-hosting.adapter-C7_5MWrl.js +0 -50
  37. package/dist/shell-server-hosting.adapter-C7_5MWrl.js.map +0 -1
  38. package/dist/src-DO7WyrfV.js.map +0 -1
  39. package/dist/web-app.module-BB1fY1Kd.js +0 -125
  40. package/dist/web-app.module-BB1fY1Kd.js.map +0 -1
@@ -1,50 +0,0 @@
1
- import { t as perEnv } from "./perEnv-n2qFRplP.js";
2
- import { z } from "zod";
3
- //#region src/adapters/defineDelivery.ts
4
- const widen = (port) => port;
5
- const recipe = ({ name, settings, typicalMinutes, decidedBy, detect, questions, requirements, env, ...port }, capability) => ({
6
- name,
7
- capability,
8
- settings,
9
- typicalMinutes,
10
- decidedBy,
11
- detect,
12
- questions,
13
- requirements,
14
- ...env ? { env } : {},
15
- create: () => widen({
16
- ...port,
17
- capability
18
- })
19
- });
20
- const defineServerHosting = (adapter) => recipe(adapter, "server-hosting");
21
- const defineStaticHosting = (adapter) => recipe(adapter, "static-hosting");
22
- const defineMobileDistribution = (adapter) => recipe(adapter, "mobile-distribution");
23
- const definePackageRegistry = (adapter) => recipe(adapter, "package-registry");
24
- //#endregion
25
- //#region src/adapters/server-hosting/shell-server-hosting.adapter.ts
26
- const ShellOptions = z.object({
27
- deploy: perEnv(z.array(z.string()).min(1)).describe("The command that ships it, run from the root, as a list: [npx, my-tool, deploy]"),
28
- url: perEnv(z.string()).optional().describe("Where it answers, for other units to read")
29
- });
30
- const shellServerHosting = () => defineServerHosting({
31
- name: "shell",
32
- settings: ShellOptions,
33
- describe: ({ options }) => options.deploy.join(" "),
34
- jobs: ({ tag, environment, options }) => {
35
- const [command = "true", ...args] = options.deploy;
36
- return [{
37
- label: `ship ${tag}: ${options.deploy.join(" ")}`,
38
- local: [{
39
- command,
40
- args
41
- }],
42
- ci: { ref: tag },
43
- record: true
44
- }];
45
- }
46
- });
47
- //#endregion
48
- export { defineStaticHosting as a, defineServerHosting as i, defineMobileDistribution as n, definePackageRegistry as r, shellServerHosting as t };
49
-
50
- //# sourceMappingURL=shell-server-hosting.adapter-C7_5MWrl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shell-server-hosting.adapter-C7_5MWrl.js","names":[],"sources":["../src/adapters/defineDelivery.ts","../src/adapters/server-hosting/shell-server-hosting.adapter.ts"],"sourcesContent":["import type { z } from \"zod\";\n\nimport type { DeliveryAdapter } from \"../ports/adapter.port\";\nimport type { Resolved } from \"../ports/delivery.port\";\nimport type { MobileDistributionPort } from \"../ports/mobile-distribution.port\";\nimport type { PackageRegistryPort } from \"../ports/package-registry.port\";\nimport type { ServerHostingPort } from \"../ports/server-hosting.port\";\nimport type { StaticHostingPort } from \"../ports/static-hosting.port\";\n\n/**\n * What an adapter author writes in one object: the recipe's static parts (name, settings, what init\n * and doctor ask) and the port's members, which read the settings typed.\n */\ntype Authored<Port extends { capability: string }, Schema extends z.ZodObject> = Omit<\n Port,\n \"capability\"\n> &\n Omit<DeliveryAdapter<Port>, \"create\" | \"settings\" | \"capability\"> & {\n readonly settings: Schema;\n };\n\ntype Typed<Schema extends z.ZodObject> = Resolved<z.output<Schema>>;\n\n// Its members take the settings its schema parses; the release flow only ever passes those.\nconst widen = <Port>(port: object): Port => port as Port;\n\nconst recipe = <Port extends { capability: string }>(\n {\n name,\n settings,\n typicalMinutes,\n decidedBy,\n detect,\n questions,\n requirements,\n env,\n ...port\n }: Omit<DeliveryAdapter<Port>, \"create\" | \"capability\">,\n capability: Port[\"capability\"],\n): DeliveryAdapter<Port> => ({\n name,\n capability,\n settings,\n typicalMinutes,\n decidedBy,\n detect,\n questions,\n requirements,\n ...(env ? { env } : {}),\n create: () => widen({ ...port, capability }),\n});\n\nexport const defineServerHosting = <const Schema extends z.ZodObject>(\n adapter: Authored<ServerHostingPort<Typed<Schema>>, Schema>,\n): DeliveryAdapter<ServerHostingPort> => recipe<ServerHostingPort>(adapter, \"server-hosting\");\n\nexport const defineStaticHosting = <const Schema extends z.ZodObject>(\n adapter: Authored<StaticHostingPort<Typed<Schema>>, Schema>,\n): DeliveryAdapter<StaticHostingPort> => recipe<StaticHostingPort>(adapter, \"static-hosting\");\n\nexport const defineMobileDistribution = <const Schema extends z.ZodObject>(\n adapter: Authored<MobileDistributionPort<Typed<Schema>>, Schema> &\n Required<Pick<DeliveryAdapter<MobileDistributionPort>, \"decidedBy\">>,\n): DeliveryAdapter<MobileDistributionPort> =>\n recipe<MobileDistributionPort>(adapter, \"mobile-distribution\");\n\nexport const definePackageRegistry = <const Schema extends z.ZodObject>(\n adapter: Authored<PackageRegistryPort<Typed<Schema>>, Schema>,\n): DeliveryAdapter<PackageRegistryPort> => recipe<PackageRegistryPort>(adapter, \"package-registry\");\n","import { z } from \"zod\";\n\nimport type { DeliveryAdapter } from \"../../ports/adapter.port\";\nimport type { ServerHostingPort } from \"../../ports/server-hosting.port\";\nimport { perEnv } from \"../../application/config/perEnv\";\nimport { defineServerHosting } from \"../defineDelivery\";\n\nconst ShellOptions = z.object({\n deploy: perEnv(z.array(z.string()).min(1)).describe(\n \"The command that ships it, run from the root, as a list: [npx, my-tool, deploy]\",\n ),\n url: perEnv(z.string()).optional().describe(\"Where it answers, for other units to read\"),\n});\n\n/** Anything a command ships: the escape hatch until a host has its own adapter. */\nexport type ShellServerHostingAdapter = DeliveryAdapter<ServerHostingPort>;\n\nexport const shellServerHosting = (): ShellServerHostingAdapter =>\n defineServerHosting({\n name: \"shell\",\n settings: ShellOptions,\n describe: ({ options }) => options.deploy.join(\" \"),\n jobs: ({ tag, environment, options }) => {\n const [command = \"true\", ...args] = options.deploy;\n return [\n {\n label: `ship ${tag}: ${options.deploy.join(\" \")}`,\n local: [{ command, args }],\n ci: { ref: tag },\n record: true,\n },\n ];\n },\n });\n"],"mappings":";;;AAwBA,MAAM,SAAe,SAAuB;AAE5C,MAAM,UACJ,EACE,MACA,UACA,gBACA,WACA,QACA,WACA,cACA,KACA,GAAG,QAEL,gBAC2B;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,GAAI,MAAM,EAAE,KAAK,GAAG,EAAE;CACtB,cAAc,MAAM;EAAE,GAAG;EAAM;EAAY,CAAC;CAC7C;AAED,MAAa,uBACX,YACuC,OAA0B,SAAS,iBAAiB;AAE7F,MAAa,uBACX,YACuC,OAA0B,SAAS,iBAAiB;AAE7F,MAAa,4BACX,YAGA,OAA+B,SAAS,sBAAsB;AAEhE,MAAa,yBACX,YACyC,OAA4B,SAAS,mBAAmB;;;AC7DnG,MAAM,eAAe,EAAE,OAAO;CAC5B,QAAQ,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,SACzC,kFACD;CACD,KAAK,OAAO,EAAE,QAAQ,CAAC,CAAC,UAAU,CAAC,SAAS,4CAA4C;CACzF,CAAC;AAKF,MAAa,2BACX,oBAAoB;CAClB,MAAM;CACN,UAAU;CACV,WAAW,EAAE,cAAc,QAAQ,OAAO,KAAK,IAAI;CACnD,OAAO,EAAE,KAAK,aAAa,cAAc;EACvC,MAAM,CAAC,UAAU,QAAQ,GAAG,QAAQ,QAAQ;AAC5C,SAAO,CACL;GACE,OAAO,QAAQ,IAAI,IAAI,QAAQ,OAAO,KAAK,IAAI;GAC/C,OAAO,CAAC;IAAE;IAAS;IAAM,CAAC;GAC1B,IAAI,EAAE,KAAK,KAAK;GAChB,QAAQ;GACT,CACF;;CAEJ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"src-DO7WyrfV.js","names":[],"sources":["../src/application/config/defineRelease.ts","../src/modules/agent-plugin/agent-plugin.module.ts","../src/modules/internal-tool/internal-tool.module.ts"],"sourcesContent":["import type { DisplayChoice } from \"../../domain/display\";\nimport type { TagFormatName } from \"../../domain/tags\";\nimport type { Feature, ReleaseFlow, ReleaseModule } from \"../../modules/module\";\n\n/** How a repository releases: the flow, what gets released in order, and what happens around it. */\nexport interface ReleaseConfig {\n /** Folders to look in, `dir/*` or exact. Without it, the workspace file decides. */\n units?: string[];\n /** How the release itself runs: an adapter per port, each from its plugin. */\n flow: ReleaseFlow;\n /** What gets released, in this order. The first app is the repository's Latest release. */\n modules: ReleaseModule[];\n /** What happens around a release, after the ship, in this order. */\n features?: Feature[];\n /**\n * How a tag names a version: `\"package\"` (`{name}@{version}`, the default), `\"plugin\"` (`{name}--v{version}`), `\"single\"` (`v{version}`, one unit only), `\"module\"` (`{name}/v{version}`), or a format of your own.\n */\n tag?: TagFormatName | (string & {});\n /** How much the release says while it runs; `--verbose` and `--mascot` (or `--no-…`) override. */\n display?: DisplayChoice;\n}\n\nexport const defineRelease = (config: ReleaseConfig): ReleaseConfig => config;\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { z } from \"zod\";\n\nimport type { Named } from \"../deliveryModule\";\nimport type { ReleaseModule } from \"../module\";\n\n/**\n * Where each agent reads a plugin's version, relative to the plugin's folder: Claude Code and\n * Copilot CLI, Codex, Cursor, then Gemini CLI.\n */\nexport const AGENT_MANIFESTS = [\n \".claude-plugin/plugin.json\",\n \".codex-plugin/plugin.json\",\n \".cursor-plugin/plugin.json\",\n \"gemini-extension.json\",\n] as const;\n\nconst Versioned = z.object({ version: z.string() });\n\n/** A manifest's version, or null when the file is missing or holds no top-level version. */\nconst versionIn = (file: string) => {\n if (!fs.existsSync(file)) return null;\n const parsed = Versioned.safeParse(JSON.parse(fs.readFileSync(file, \"utf8\")));\n return parsed.success ? parsed.data.version : null;\n};\n\nconst literal = (text: string) => text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\n/** Moves only the version's value, so the release PR shows one changed line per manifest. */\nconst setVersion = (file: string, from: string, to: string) => {\n const text = fs.readFileSync(file, \"utf8\");\n const moved = text.replace(\n new RegExp(`(\"version\"\\\\s*:\\\\s*)\"${literal(from)}\"`),\n `$1${JSON.stringify(to)}`,\n );\n // The first such value may sit under another key: then the file is written whole instead.\n const top = Versioned.safeParse(JSON.parse(moved));\n const json = JSON.parse(text) as Record<string, unknown>;\n fs.writeFileSync(\n file,\n top.success && top.data.version === to\n ? moved\n : `${JSON.stringify({ ...json, version: to }, null, 2)}\\n`,\n );\n};\n\n/**\n * A plugin for coding agents, such as a Claude Code, Codex or Cursor plugin: a release versions it,\n * writes the version into each agent's manifest in the release PR, tags it and publishes its notes.\n * Nothing deploys it: agents install it from the repository, so merging the release PR ships it.\n */\nexport const agentPlugin = ({ name = \"agent-plugin\" }: Named = {}): ReleaseModule => ({\n type: \"module\",\n name,\n kind: \"agent-plugin\",\n provider: \"marketplace\",\n settings: z.object({}),\n adapters: [],\n releaseOnly: true,\n version: ({ root }, { unit, bump }) => {\n if (!bump) return Promise.resolve({ added: [], writes: [], summary: [], onMerge: \"\" });\n const manifests = AGENT_MANIFESTS.map((file) => path.posix.join(unit.dir, file)).flatMap(\n (file) => {\n const from = versionIn(path.join(root, file));\n return from === null ? [] : [{ file, from }];\n },\n );\n return Promise.resolve({\n added: [],\n writes: manifests.map(({ file, from }) => ({\n label: `${file} → ${bump.to}`,\n run: () => {\n setVersion(path.join(root, file), from, bump.to);\n return Promise.resolve();\n },\n })),\n summary: [],\n onMerge: \"Agents update to it: merging ships it\",\n });\n },\n ship: () => ({\n where: \"its tag and release notes; agents install it from the repository\",\n jobs: [],\n }),\n decide: () =>\n Promise.resolve({ action: \"none\", status: \"released, agents install it from the repository\" }),\n});\n","import { z } from \"zod\";\n\nimport type { Named } from \"../deliveryModule\";\nimport type { ReleaseModule } from \"../module\";\n\n/**\n * An app nothing deploys, such as a CLI run from the repository: a release versions it, tags it and\n * publishes its notes, and every environment counts it as shipped once tagged.\n */\nexport const internalTool = ({ name = \"internal-tool\" }: Named = {}): ReleaseModule => ({\n type: \"module\",\n name,\n kind: \"internal-tool\",\n // What output named it before modules: the release PR and status keep saying it.\n provider: \"release-only\",\n settings: z.object({}),\n adapters: [],\n releaseOnly: true,\n ship: () => ({ where: \"its tag and release notes, nothing deploys it\", jobs: [] }),\n decide: () => Promise.resolve({ action: \"none\", status: \"released, nothing deploys it\" }),\n});\n"],"mappings":";;;;;;AAsBA,MAAa,iBAAiB,WAAyC;;;;;;;ACXvE,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACD;AAED,MAAM,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;;AAGnD,MAAM,aAAa,SAAiB;AAClC,KAAI,CAAC,GAAG,WAAW,KAAK,CAAE,QAAO;CACjC,MAAM,SAAS,UAAU,UAAU,KAAK,MAAM,GAAG,aAAa,MAAM,OAAO,CAAC,CAAC;AAC7E,QAAO,OAAO,UAAU,OAAO,KAAK,UAAU;;AAGhD,MAAM,WAAW,SAAiB,KAAK,QAAQ,uBAAuB,OAAO;;AAG7E,MAAM,cAAc,MAAc,MAAc,OAAe;CAC7D,MAAM,OAAO,GAAG,aAAa,MAAM,OAAO;CAC1C,MAAM,QAAQ,KAAK,QACjB,IAAI,OAAO,wBAAwB,QAAQ,KAAK,CAAC,GAAG,EACpD,KAAK,KAAK,UAAU,GAAG,GACxB;CAED,MAAM,MAAM,UAAU,UAAU,KAAK,MAAM,MAAM,CAAC;CAClD,MAAM,OAAO,KAAK,MAAM,KAAK;AAC7B,IAAG,cACD,MACA,IAAI,WAAW,IAAI,KAAK,YAAY,KAChC,QACA,GAAG,KAAK,UAAU;EAAE,GAAG;EAAM,SAAS;EAAI,EAAE,MAAM,EAAE,CAAC,IAC1D;;;;;;;AAQH,MAAa,eAAe,EAAE,OAAO,mBAA0B,EAAE,MAAqB;CACpF,MAAM;CACN;CACA,MAAM;CACN,UAAU;CACV,UAAU,EAAE,OAAO,EAAE,CAAC;CACtB,UAAU,EAAE;CACZ,aAAa;CACb,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW;AACrC,MAAI,CAAC,KAAM,QAAO,QAAQ,QAAQ;GAAE,OAAO,EAAE;GAAE,QAAQ,EAAE;GAAE,SAAS,EAAE;GAAE,SAAS;GAAI,CAAC;EACtF,MAAM,YAAY,gBAAgB,KAAK,SAAS,KAAK,MAAM,KAAK,KAAK,KAAK,KAAK,CAAC,CAAC,SAC9E,SAAS;GACR,MAAM,OAAO,UAAU,KAAK,KAAK,MAAM,KAAK,CAAC;AAC7C,UAAO,SAAS,OAAO,EAAE,GAAG,CAAC;IAAE;IAAM;IAAM,CAAC;IAE/C;AACD,SAAO,QAAQ,QAAQ;GACrB,OAAO,EAAE;GACT,QAAQ,UAAU,KAAK,EAAE,MAAM,YAAY;IACzC,OAAO,GAAG,KAAK,KAAK,KAAK;IACzB,WAAW;AACT,gBAAW,KAAK,KAAK,MAAM,KAAK,EAAE,MAAM,KAAK,GAAG;AAChD,YAAO,QAAQ,SAAS;;IAE3B,EAAE;GACH,SAAS,EAAE;GACX,SAAS;GACV,CAAC;;CAEJ,aAAa;EACX,OAAO;EACP,MAAM,EAAE;EACT;CACD,cACE,QAAQ,QAAQ;EAAE,QAAQ;EAAQ,QAAQ;EAAmD,CAAC;CACjG;;;;;;;AC9ED,MAAa,gBAAgB,EAAE,OAAO,oBAA2B,EAAE,MAAqB;CACtF,MAAM;CACN;CACA,MAAM;CAEN,UAAU;CACV,UAAU,EAAE,OAAO,EAAE,CAAC;CACtB,UAAU,EAAE;CACZ,aAAa;CACb,aAAa;EAAE,OAAO;EAAiD,MAAM,EAAE;EAAE;CACjF,cAAc,QAAQ,QAAQ;EAAE,QAAQ;EAAQ,QAAQ;EAAgC,CAAC;CAC1F"}
@@ -1,125 +0,0 @@
1
- //#region src/domain/checkEnvBeforeDeploy.ts
2
- /** UPPER_SNAKE: a capital letter, then capitals, digits or underscores. */
3
- const ENV_VAR_NAME = /^[A-Z][A-Z0-9_]*$/;
4
- const isEnvVarName = (text) => ENV_VAR_NAME.test(text);
5
- /** The names a deploy checks on the platform before it ships, per environment. */
6
- var EnvToCheck = class {
7
- #all;
8
- #perEnvironment;
9
- constructor(input) {
10
- if (isList(input)) {
11
- this.#all = input;
12
- this.#perEnvironment = {};
13
- return;
14
- }
15
- const { all = [], ...perEnvironment } = input;
16
- this.#all = all;
17
- this.#perEnvironment = perEnvironment;
18
- }
19
- /** `all`, then that environment's own names. */
20
- for(environment) {
21
- return new Set([...this.#all, ...this.#perEnvironment[environment] ?? []]);
22
- }
23
- /** Names in `all` that an environment lists again. */
24
- listedTwice() {
25
- const extras = new Set(Object.values(this.#perEnvironment).flat());
26
- return [...new Set(this.#all)].filter((name) => extras.has(name));
27
- }
28
- };
29
- const isList = (input) => Array.isArray(input);
30
- /** Names a deploy checks that the platform does not hold. */
31
- var UnsetEnvVars = class {
32
- #names;
33
- constructor(names) {
34
- this.#names = names;
35
- }
36
- isEmpty() {
37
- return this.#names.length === 0;
38
- }
39
- names() {
40
- return this.#names;
41
- }
42
- };
43
- const findUnset = ({ expected, setOnPlatform }) => new UnsetEnvVars([...expected].filter((name) => !setOnPlatform.has(name)));
44
- //#endregion
45
- //#region src/application/releaseFlow.ts
46
- /** How the release itself runs, given an adapter for each port it runs on. */
47
- const releaseFlow = (ports) => ({
48
- type: "flow",
49
- ...ports,
50
- approval: ports.approval ?? "none"
51
- });
52
- //#endregion
53
- //#region src/modules/deliveryModule.ts
54
- /** The stages every delivery adapter answers: its settings, where a tag lands and its jobs. */
55
- const deliveryModule = (kind, adapter, name = kind) => ({
56
- type: "module",
57
- name,
58
- kind,
59
- provider: adapter.name,
60
- settings: adapter.settings,
61
- adapters: [adapter],
62
- decidedBy: adapter.decidedBy,
63
- typicalMinutes: adapter.typicalMinutes,
64
- ...adapter.env ? { env: adapter.env } : {},
65
- requirements: (apps) => apps.flatMap((unit) => adapter.requirements?.(unit) ?? []),
66
- ship: ({ open }, input) => {
67
- const port = open(adapter);
68
- return {
69
- where: port.describe(input),
70
- jobs: port.jobs(input)
71
- };
72
- }
73
- });
74
- //#endregion
75
- //#region src/modules/backend-service/backend-service.module.ts
76
- /** A long-lived service, such as an API: deployed from its tag, recorded with the code host. */
77
- const backendService = ({ name, serverHosting }) => deliveryModule("backend-service", serverHosting, name);
78
- //#endregion
79
- //#region src/modules/mobile-app/mobile-app.module.ts
80
- /**
81
- * A mobile app: its distribution decides between a store build and an over-the-air update, adds to
82
- * the release PR, and says how a version does before it is promoted.
83
- */
84
- const mobileApp = ({ name, mobileDistribution }) => ({
85
- ...deliveryModule("mobile-app", mobileDistribution, name),
86
- versionFiles: (unit, units, open) => open(mobileDistribution).versionFiles?.(unit, units) ?? [],
87
- version: async (context, input) => {
88
- const port = context.open(mobileDistribution);
89
- return port.beforeVersion ? port.beforeVersion(context, input) : {
90
- added: [],
91
- writes: [],
92
- summary: [],
93
- onMerge: ""
94
- };
95
- },
96
- decide: (context, input) => context.open(mobileDistribution).decide(context, input),
97
- live: async (context, input) => {
98
- const port = context.open(mobileDistribution);
99
- return port.live ? port.live(context, input) : true;
100
- },
101
- health: async (context, input) => {
102
- const port = context.open(mobileDistribution);
103
- return port.health ? port.health(context, input) : null;
104
- },
105
- inspect: async (context, input) => {
106
- const port = context.open(mobileDistribution);
107
- return port.inspect ? port.inspect(context, input) : void 0;
108
- }
109
- });
110
- //#endregion
111
- //#region src/modules/published-package/published-package.module.ts
112
- /** A package others install: its registry, not deploy records, knows what is out. */
113
- const publishedPackage = ({ name, packageRegistry }) => ({
114
- ...deliveryModule("published-package", packageRegistry, name),
115
- decide: (context, input) => context.open(packageRegistry).decide(context, input),
116
- live: (context, input) => context.open(packageRegistry).live(context, input)
117
- });
118
- //#endregion
119
- //#region src/modules/web-app/web-app.module.ts
120
- /** A static site, built against the environment it ships to. */
121
- const webApp = ({ name, staticHosting }) => deliveryModule("web-app", staticHosting, name);
122
- //#endregion
123
- export { releaseFlow as a, findUnset as c, backendService as i, isEnvVarName as l, publishedPackage as n, ENV_VAR_NAME as o, mobileApp as r, EnvToCheck as s, webApp as t };
124
-
125
- //# sourceMappingURL=web-app.module-BB1fY1Kd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"web-app.module-BB1fY1Kd.js","names":["#all","#perEnvironment","#names"],"sources":["../src/domain/checkEnvBeforeDeploy.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 type { Environment } from \"./environment\";\n\n/** A name an app reads from its environment, as platforms store it: `SENTRY_DSN`. */\nexport type EnvVarName = string & { readonly brand: \"EnvVarName\" };\n\n/** UPPER_SNAKE: a capital letter, then capitals, digits or underscores. */\nexport const ENV_VAR_NAME = /^[A-Z][A-Z0-9_]*$/;\n\nexport const isEnvVarName = (text: string): text is EnvVarName => ENV_VAR_NAME.test(text);\n\n/** As a unit file writes it: one list for every environment, or `all` plus a list per environment. */\nexport type EnvToCheckInput =\n | readonly EnvVarName[]\n | ({ all?: readonly EnvVarName[] } & Partial<Record<Environment, readonly EnvVarName[]>>);\n\n/** The names a deploy checks on the platform before it ships, per environment. */\nexport class EnvToCheck {\n readonly #all: readonly EnvVarName[];\n readonly #perEnvironment: Partial<Record<Environment, readonly EnvVarName[]>>;\n\n constructor(input: EnvToCheckInput) {\n if (isList(input)) {\n this.#all = input;\n this.#perEnvironment = {};\n return;\n }\n const { all = [], ...perEnvironment } = input;\n this.#all = all;\n this.#perEnvironment = perEnvironment;\n }\n\n /** `all`, then that environment's own names. */\n for(environment: Environment): ReadonlySet<EnvVarName> {\n return new Set([...this.#all, ...(this.#perEnvironment[environment] ?? [])]);\n }\n\n /** Names in `all` that an environment lists again. */\n listedTwice(): EnvVarName[] {\n const extras = new Set(Object.values(this.#perEnvironment).flat());\n return [...new Set(this.#all)].filter((name) => extras.has(name));\n }\n}\n\nconst isList = (input: EnvToCheckInput): input is readonly EnvVarName[] => Array.isArray(input);\n\n/** Names a deploy checks that the platform does not hold. */\nexport class UnsetEnvVars {\n readonly #names: readonly EnvVarName[];\n\n constructor(names: readonly EnvVarName[]) {\n this.#names = names;\n }\n\n isEmpty(): boolean {\n return this.#names.length === 0;\n }\n\n names(): readonly EnvVarName[] {\n return this.#names;\n }\n}\n\nexport const findUnset = ({\n expected,\n setOnPlatform,\n}: {\n expected: ReadonlySet<EnvVarName>;\n setOnPlatform: ReadonlySet<EnvVarName>;\n}): UnsetEnvVars => new UnsetEnvVars([...expected].filter((name) => !setOnPlatform.has(name)));\n","import type { Approval } from \"../domain/releasePr\";\nimport 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 /** \"required\" when someone else approves the release PR; \"none\", the default, merges it here. */\n approval?: Approval;\n}): ReleaseFlow => ({ type: \"flow\", ...ports, approval: ports.approval ?? \"none\" });\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 ...(adapter.env ? { env: adapter.env } : {}),\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 // A platform that cannot tell keeps the unit greyed, as before.\n live: async (context, input) => {\n const port = context.open(mobileDistribution);\n return port.live ? port.live(context, input) : true;\n },\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,\n}: Named & { staticHosting: DeliveryAdapter<StaticHostingPort> }): ReleaseModule =>\n deliveryModule(\"web-app\", staticHosting, name);\n"],"mappings":";;AAMA,MAAa,eAAe;AAE5B,MAAa,gBAAgB,SAAqC,aAAa,KAAK,KAAK;;AAQzF,IAAa,aAAb,MAAwB;CACtB;CACA;CAEA,YAAY,OAAwB;AAClC,MAAI,OAAO,MAAM,EAAE;AACjB,SAAA,MAAY;AACZ,SAAA,iBAAuB,EAAE;AACzB;;EAEF,MAAM,EAAE,MAAM,EAAE,EAAE,GAAG,mBAAmB;AACxC,QAAA,MAAY;AACZ,QAAA,iBAAuB;;;CAIzB,IAAI,aAAmD;AACrD,SAAO,IAAI,IAAI,CAAC,GAAG,MAAA,KAAW,GAAI,MAAA,eAAqB,gBAAgB,EAAE,CAAE,CAAC;;;CAI9E,cAA4B;EAC1B,MAAM,SAAS,IAAI,IAAI,OAAO,OAAO,MAAA,eAAqB,CAAC,MAAM,CAAC;AAClE,SAAO,CAAC,GAAG,IA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