@infracraft/pulumi 1.15.1 → 1.16.1

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 (59) hide show
  1. package/dist/deploy-command.cjs +50 -0
  2. package/dist/deploy-command.cjs.map +1 -0
  3. package/dist/deploy-command.d.cts +33 -0
  4. package/dist/deploy-command.d.cts.map +1 -0
  5. package/dist/deploy-command.d.mts +33 -0
  6. package/dist/deploy-command.d.mts.map +1 -0
  7. package/dist/deploy-command.mjs +47 -0
  8. package/dist/deploy-command.mjs.map +1 -0
  9. package/dist/fly/deploy.cjs +15 -25
  10. package/dist/fly/deploy.cjs.map +1 -1
  11. package/dist/fly/deploy.d.cts +7 -33
  12. package/dist/fly/deploy.d.cts.map +1 -1
  13. package/dist/fly/deploy.d.mts +7 -33
  14. package/dist/fly/deploy.d.mts.map +1 -1
  15. package/dist/fly/deploy.mjs +15 -24
  16. package/dist/fly/deploy.mjs.map +1 -1
  17. package/dist/git-guard.cjs +21 -280
  18. package/dist/git-guard.cjs.map +1 -1
  19. package/dist/git-guard.d.cts +11 -116
  20. package/dist/git-guard.d.cts.map +1 -1
  21. package/dist/git-guard.d.mts +11 -116
  22. package/dist/git-guard.d.mts.map +1 -1
  23. package/dist/git-guard.mjs +20 -267
  24. package/dist/git-guard.mjs.map +1 -1
  25. package/dist/hash.cjs +2 -2
  26. package/dist/hash.mjs +1 -1
  27. package/dist/railway/deploy.cjs +23 -33
  28. package/dist/railway/deploy.cjs.map +1 -1
  29. package/dist/railway/deploy.d.cts +10 -37
  30. package/dist/railway/deploy.d.cts.map +1 -1
  31. package/dist/railway/deploy.d.mts +10 -37
  32. package/dist/railway/deploy.d.mts.map +1 -1
  33. package/dist/railway/deploy.mjs +23 -32
  34. package/dist/railway/deploy.mjs.map +1 -1
  35. package/dist/sandbox.cjs +93 -0
  36. package/dist/sandbox.cjs.map +1 -0
  37. package/dist/sandbox.d.cts +49 -0
  38. package/dist/sandbox.d.cts.map +1 -0
  39. package/dist/sandbox.d.mts +49 -0
  40. package/dist/sandbox.d.mts.map +1 -0
  41. package/dist/sandbox.mjs +86 -0
  42. package/dist/sandbox.mjs.map +1 -0
  43. package/dist/vercel/deploy.cjs +15 -89
  44. package/dist/vercel/deploy.cjs.map +1 -1
  45. package/dist/vercel/deploy.d.cts +10 -82
  46. package/dist/vercel/deploy.d.cts.map +1 -1
  47. package/dist/vercel/deploy.d.mts +10 -82
  48. package/dist/vercel/deploy.d.mts.map +1 -1
  49. package/dist/vercel/deploy.mjs +16 -87
  50. package/dist/vercel/deploy.mjs.map +1 -1
  51. package/package.json +5 -1
  52. package/dist/stable-dir.cjs +0 -41
  53. package/dist/stable-dir.cjs.map +0 -1
  54. package/dist/stable-dir.d.cts +0 -34
  55. package/dist/stable-dir.d.cts.map +0 -1
  56. package/dist/stable-dir.d.mts +0 -34
  57. package/dist/stable-dir.d.mts.map +0 -1
  58. package/dist/stable-dir.mjs +0 -39
  59. package/dist/stable-dir.mjs.map +0 -1
@@ -0,0 +1,50 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_chunk = require('./chunk-BVYJZCqc.cjs');
3
+ const require_git_guard = require('./git-guard.cjs');
4
+ const require_sandbox = require('./sandbox.cjs');
5
+ let _pulumi_command = require("@pulumi/command");
6
+ _pulumi_command = require_chunk.__toESM(_pulumi_command, 1);
7
+ let _pulumi_pulumi = require("@pulumi/pulumi");
8
+ _pulumi_pulumi = require_chunk.__toESM(_pulumi_pulumi, 1);
9
+
10
+ //#region src/deploy-command.ts
11
+ /** Reads a `dependsOn` opt into a flat array of resource instances. */
12
+ function dependsOnList(opts) {
13
+ const dep = opts.dependsOn;
14
+ if (Array.isArray(dep)) return dep;
15
+ return dep ? [dep] : [];
16
+ }
17
+ /**
18
+ * Builds a sandboxed deploy command. Inspects `opts.dependsOn` by brand:
19
+ * a DeploySandbox → isolate; a GitGuard → stub `.git`; GitGuard alone → throw.
20
+ * The platform deploy resources call ONLY this; they never touch the sandbox.
21
+ */
22
+ function createDeployCommand(args, opts) {
23
+ const deps = dependsOnList(opts);
24
+ const sandbox = deps.some(require_sandbox.isDeploySandbox);
25
+ const gitGuard = deps.some(require_git_guard.isGitGuard);
26
+ if (gitGuard && !sandbox) throw new Error(`[infracraft] ${args.name}: GitGuard has no effect without a DeploySandbox in dependsOn`);
27
+ const env = _pulumi_pulumi.getStack();
28
+ const create = _pulumi_pulumi.output(args.cli).apply((cli) => require_sandbox.buildSandboxScript({
29
+ sandbox,
30
+ gitGuard,
31
+ appName: args.name.replace(/-deploy$/, ""),
32
+ env,
33
+ excludePaths: args.excludePaths,
34
+ setup: args.setup,
35
+ cli
36
+ }));
37
+ const cmd = new _pulumi_command.local.Command(args.name, {
38
+ create,
39
+ triggers: args.triggers,
40
+ environment: args.environment
41
+ }, opts);
42
+ return {
43
+ command: cmd,
44
+ deploymentUrl: cmd.stdout.apply((out) => out.trim().split("\n").pop() ?? "")
45
+ };
46
+ }
47
+
48
+ //#endregion
49
+ exports.createDeployCommand = createDeployCommand;
50
+ //# sourceMappingURL=deploy-command.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-command.cjs","names":["isDeploySandbox","isGitGuard","pulumi","buildSandboxScript","command"],"sources":["../src/deploy-command.ts"],"sourcesContent":["// src/deploy-command.ts\nimport * as command from \"@pulumi/command\";\nimport * as pulumi from \"@pulumi/pulumi\";\n\nimport { isGitGuard } from \"./git-guard\";\nimport { buildSandboxScript, isDeploySandbox } from \"./sandbox\";\n\nexport interface CreateDeployCommandArgs {\n\t/** Resource name; the child command is `<name>` and the sandbox dir uses it. */\n\tname: string;\n\t/** Fully-formed platform deploy command (may be an Output, e.g. Railway). */\n\tcli: pulumi.Input<string>;\n\t/** Redeploy triggers (source/env hashes). */\n\ttriggers: pulumi.Input<pulumi.Input<string>[]>;\n\t/** Upload-scoping excludes (applied only in stub mode). */\n\texcludePaths?: string[];\n\t/** Shell run in the working dir before `cli` (e.g. write railpack.json). */\n\tsetup?: string;\n\t/** Env passed to the command (secrets that survive preview; not the inlined ones). */\n\tenvironment?: Record<string, pulumi.Input<string>>;\n}\n\nexport interface CreateDeployCommandResult {\n\tcommand: command.local.Command;\n\t/** The deploy CLI's final stdout line (the production URL for Vercel/Fly). */\n\tdeploymentUrl: pulumi.Output<string>;\n}\n\n/** Reads a `dependsOn` opt into a flat array of resource instances. */\nfunction dependsOnList(opts: pulumi.ComponentResourceOptions): unknown[] {\n\tconst dep = opts.dependsOn;\n\n\tif (Array.isArray(dep)) {\n\t\treturn dep;\n\t}\n\n\treturn dep ? [dep] : [];\n}\n\n/**\n * Builds a sandboxed deploy command. Inspects `opts.dependsOn` by brand:\n * a DeploySandbox → isolate; a GitGuard → stub `.git`; GitGuard alone → throw.\n * The platform deploy resources call ONLY this; they never touch the sandbox.\n */\nexport function createDeployCommand(\n\targs: CreateDeployCommandArgs,\n\topts: pulumi.ComponentResourceOptions,\n): CreateDeployCommandResult {\n\tconst deps = dependsOnList(opts);\n\tconst sandbox = deps.some(isDeploySandbox);\n\tconst gitGuard = deps.some(isGitGuard);\n\n\tif (gitGuard && !sandbox) {\n\t\tthrow new Error(\n\t\t\t`[infracraft] ${args.name}: GitGuard has no effect without a DeploySandbox in dependsOn`,\n\t\t);\n\t}\n\n\tconst env = pulumi.getStack();\n\n\tconst create = pulumi.output(args.cli).apply((cli) =>\n\t\tbuildSandboxScript({\n\t\t\tsandbox,\n\t\t\tgitGuard,\n\t\t\tappName: args.name.replace(/-deploy$/, \"\"),\n\t\t\tenv,\n\t\t\texcludePaths: args.excludePaths,\n\t\t\tsetup: args.setup,\n\t\t\tcli,\n\t\t}),\n\t);\n\n\tconst cmd = new command.local.Command(\n\t\targs.name,\n\t\t{ create, triggers: args.triggers, environment: args.environment },\n\t\topts,\n\t);\n\n\tconst deploymentUrl = cmd.stdout.apply(\n\t\t(out) => out.trim().split(\"\\n\").pop() ?? \"\",\n\t);\n\n\treturn { command: cmd, deploymentUrl };\n}\n"],"mappings":";;;;;;;;;;;AA6BA,SAAS,cAAc,MAAkD;CACxE,MAAM,MAAM,KAAK;CAEjB,IAAI,MAAM,QAAQ,GAAG,GACpB,OAAO;CAGR,OAAO,MAAM,CAAC,GAAG,IAAI,CAAC;AACvB;;;;;;AAOA,SAAgB,oBACf,MACA,MAC4B;CAC5B,MAAM,OAAO,cAAc,IAAI;CAC/B,MAAM,UAAU,KAAK,KAAKA,+BAAe;CACzC,MAAM,WAAW,KAAK,KAAKC,4BAAU;CAErC,IAAI,YAAY,CAAC,SAChB,MAAM,IAAI,MACT,gBAAgB,KAAK,KAAK,8DAC3B;CAGD,MAAM,MAAMC,eAAO,SAAS;CAE5B,MAAM,SAASA,eAAO,OAAO,KAAK,GAAG,EAAE,OAAO,QAC7CC,mCAAmB;EAClB;EACA;EACA,SAAS,KAAK,KAAK,QAAQ,YAAY,EAAE;EACzC;EACA,cAAc,KAAK;EACnB,OAAO,KAAK;EACZ;CACD,CAAC,CACF;CAEA,MAAM,MAAM,IAAIC,gBAAQ,MAAM,QAC7B,KAAK,MACL;EAAE;EAAQ,UAAU,KAAK;EAAU,aAAa,KAAK;CAAY,GACjE,IACD;CAMA,OAAO;EAAE,SAAS;EAAK,eAJD,IAAI,OAAO,OAC/B,QAAQ,IAAI,KAAK,EAAE,MAAM,IAAI,EAAE,IAAI,KAAK,EAGP;CAAE;AACtC"}
@@ -0,0 +1,33 @@
1
+ import { t as __name } from "./chunk-OPjESj5l.cjs";
2
+ import * as command from "@pulumi/command";
3
+ import * as pulumi from "@pulumi/pulumi";
4
+
5
+ //#region src/deploy-command.d.ts
6
+ interface CreateDeployCommandArgs {
7
+ /** Resource name; the child command is `<name>` and the sandbox dir uses it. */
8
+ name: string;
9
+ /** Fully-formed platform deploy command (may be an Output, e.g. Railway). */
10
+ cli: pulumi.Input<string>;
11
+ /** Redeploy triggers (source/env hashes). */
12
+ triggers: pulumi.Input<pulumi.Input<string>[]>;
13
+ /** Upload-scoping excludes (applied only in stub mode). */
14
+ excludePaths?: string[];
15
+ /** Shell run in the working dir before `cli` (e.g. write railpack.json). */
16
+ setup?: string;
17
+ /** Env passed to the command (secrets that survive preview; not the inlined ones). */
18
+ environment?: Record<string, pulumi.Input<string>>;
19
+ }
20
+ interface CreateDeployCommandResult {
21
+ command: command.local.Command;
22
+ /** The deploy CLI's final stdout line (the production URL for Vercel/Fly). */
23
+ deploymentUrl: pulumi.Output<string>;
24
+ }
25
+ /**
26
+ * Builds a sandboxed deploy command. Inspects `opts.dependsOn` by brand:
27
+ * a DeploySandbox → isolate; a GitGuard → stub `.git`; GitGuard alone → throw.
28
+ * The platform deploy resources call ONLY this; they never touch the sandbox.
29
+ */
30
+ declare function createDeployCommand(args: CreateDeployCommandArgs, opts: pulumi.ComponentResourceOptions): CreateDeployCommandResult;
31
+ //#endregion
32
+ export { CreateDeployCommandArgs, CreateDeployCommandResult, createDeployCommand };
33
+ //# sourceMappingURL=deploy-command.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-command.d.cts","names":[],"sources":["../src/deploy-command.ts"],"mappings":";;;;;UAOiB,uBAAA;;EAEhB,IAAA;EAFgB;EAIhB,GAAA,EAAK,MAAA,CAAO,KAAA;;EAEZ,QAAA,EAAU,MAAA,CAAO,KAAA,CAAM,MAAA,CAAO,KAAA;EAAP;EAEvB,YAAA;EAI6B;EAF7B,KAAA;EAEoB;EAApB,WAAA,GAAc,MAAA,SAAe,MAAA,CAAO,KAAA;AAAA;AAAA,UAGpB,yBAAA;EAChB,OAAA,EAAS,OAAA,CAAQ,KAAA,CAAM,OAAA;EAZX;EAcZ,aAAA,EAAe,MAAA,CAAO,MAAM;AAAA;;;;;;iBAmBb,mBAAA,CACf,IAAA,EAAM,uBAAA,EACN,IAAA,EAAM,MAAA,CAAO,wBAAA,GACX,yBAAA"}
@@ -0,0 +1,33 @@
1
+ import { t as __name } from "./chunk-OPjESj5l.mjs";
2
+ import * as command from "@pulumi/command";
3
+ import * as pulumi from "@pulumi/pulumi";
4
+
5
+ //#region src/deploy-command.d.ts
6
+ interface CreateDeployCommandArgs {
7
+ /** Resource name; the child command is `<name>` and the sandbox dir uses it. */
8
+ name: string;
9
+ /** Fully-formed platform deploy command (may be an Output, e.g. Railway). */
10
+ cli: pulumi.Input<string>;
11
+ /** Redeploy triggers (source/env hashes). */
12
+ triggers: pulumi.Input<pulumi.Input<string>[]>;
13
+ /** Upload-scoping excludes (applied only in stub mode). */
14
+ excludePaths?: string[];
15
+ /** Shell run in the working dir before `cli` (e.g. write railpack.json). */
16
+ setup?: string;
17
+ /** Env passed to the command (secrets that survive preview; not the inlined ones). */
18
+ environment?: Record<string, pulumi.Input<string>>;
19
+ }
20
+ interface CreateDeployCommandResult {
21
+ command: command.local.Command;
22
+ /** The deploy CLI's final stdout line (the production URL for Vercel/Fly). */
23
+ deploymentUrl: pulumi.Output<string>;
24
+ }
25
+ /**
26
+ * Builds a sandboxed deploy command. Inspects `opts.dependsOn` by brand:
27
+ * a DeploySandbox → isolate; a GitGuard → stub `.git`; GitGuard alone → throw.
28
+ * The platform deploy resources call ONLY this; they never touch the sandbox.
29
+ */
30
+ declare function createDeployCommand(args: CreateDeployCommandArgs, opts: pulumi.ComponentResourceOptions): CreateDeployCommandResult;
31
+ //#endregion
32
+ export { CreateDeployCommandArgs, CreateDeployCommandResult, createDeployCommand };
33
+ //# sourceMappingURL=deploy-command.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-command.d.mts","names":[],"sources":["../src/deploy-command.ts"],"mappings":";;;;;UAOiB,uBAAA;;EAEhB,IAAA;EAFgB;EAIhB,GAAA,EAAK,MAAA,CAAO,KAAA;;EAEZ,QAAA,EAAU,MAAA,CAAO,KAAA,CAAM,MAAA,CAAO,KAAA;EAAP;EAEvB,YAAA;EAI6B;EAF7B,KAAA;EAEoB;EAApB,WAAA,GAAc,MAAA,SAAe,MAAA,CAAO,KAAA;AAAA;AAAA,UAGpB,yBAAA;EAChB,OAAA,EAAS,OAAA,CAAQ,KAAA,CAAM,OAAA;EAZX;EAcZ,aAAA,EAAe,MAAA,CAAO,MAAM;AAAA;;;;;;iBAmBb,mBAAA,CACf,IAAA,EAAM,uBAAA,EACN,IAAA,EAAM,MAAA,CAAO,wBAAA,GACX,yBAAA"}
@@ -0,0 +1,47 @@
1
+ import { t as __name } from "./chunk-OPjESj5l.mjs";
2
+ import { isGitGuard } from "./git-guard.mjs";
3
+ import { buildSandboxScript, isDeploySandbox } from "./sandbox.mjs";
4
+ import * as command from "@pulumi/command";
5
+ import * as pulumi from "@pulumi/pulumi";
6
+
7
+ //#region src/deploy-command.ts
8
+ /** Reads a `dependsOn` opt into a flat array of resource instances. */
9
+ function dependsOnList(opts) {
10
+ const dep = opts.dependsOn;
11
+ if (Array.isArray(dep)) return dep;
12
+ return dep ? [dep] : [];
13
+ }
14
+ /**
15
+ * Builds a sandboxed deploy command. Inspects `opts.dependsOn` by brand:
16
+ * a DeploySandbox → isolate; a GitGuard → stub `.git`; GitGuard alone → throw.
17
+ * The platform deploy resources call ONLY this; they never touch the sandbox.
18
+ */
19
+ function createDeployCommand(args, opts) {
20
+ const deps = dependsOnList(opts);
21
+ const sandbox = deps.some(isDeploySandbox);
22
+ const gitGuard = deps.some(isGitGuard);
23
+ if (gitGuard && !sandbox) throw new Error(`[infracraft] ${args.name}: GitGuard has no effect without a DeploySandbox in dependsOn`);
24
+ const env = pulumi.getStack();
25
+ const create = pulumi.output(args.cli).apply((cli) => buildSandboxScript({
26
+ sandbox,
27
+ gitGuard,
28
+ appName: args.name.replace(/-deploy$/, ""),
29
+ env,
30
+ excludePaths: args.excludePaths,
31
+ setup: args.setup,
32
+ cli
33
+ }));
34
+ const cmd = new command.local.Command(args.name, {
35
+ create,
36
+ triggers: args.triggers,
37
+ environment: args.environment
38
+ }, opts);
39
+ return {
40
+ command: cmd,
41
+ deploymentUrl: cmd.stdout.apply((out) => out.trim().split("\n").pop() ?? "")
42
+ };
43
+ }
44
+
45
+ //#endregion
46
+ export { createDeployCommand };
47
+ //# sourceMappingURL=deploy-command.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-command.mjs","names":[],"sources":["../src/deploy-command.ts"],"sourcesContent":["// src/deploy-command.ts\nimport * as command from \"@pulumi/command\";\nimport * as pulumi from \"@pulumi/pulumi\";\n\nimport { isGitGuard } from \"./git-guard\";\nimport { buildSandboxScript, isDeploySandbox } from \"./sandbox\";\n\nexport interface CreateDeployCommandArgs {\n\t/** Resource name; the child command is `<name>` and the sandbox dir uses it. */\n\tname: string;\n\t/** Fully-formed platform deploy command (may be an Output, e.g. Railway). */\n\tcli: pulumi.Input<string>;\n\t/** Redeploy triggers (source/env hashes). */\n\ttriggers: pulumi.Input<pulumi.Input<string>[]>;\n\t/** Upload-scoping excludes (applied only in stub mode). */\n\texcludePaths?: string[];\n\t/** Shell run in the working dir before `cli` (e.g. write railpack.json). */\n\tsetup?: string;\n\t/** Env passed to the command (secrets that survive preview; not the inlined ones). */\n\tenvironment?: Record<string, pulumi.Input<string>>;\n}\n\nexport interface CreateDeployCommandResult {\n\tcommand: command.local.Command;\n\t/** The deploy CLI's final stdout line (the production URL for Vercel/Fly). */\n\tdeploymentUrl: pulumi.Output<string>;\n}\n\n/** Reads a `dependsOn` opt into a flat array of resource instances. */\nfunction dependsOnList(opts: pulumi.ComponentResourceOptions): unknown[] {\n\tconst dep = opts.dependsOn;\n\n\tif (Array.isArray(dep)) {\n\t\treturn dep;\n\t}\n\n\treturn dep ? [dep] : [];\n}\n\n/**\n * Builds a sandboxed deploy command. Inspects `opts.dependsOn` by brand:\n * a DeploySandbox → isolate; a GitGuard → stub `.git`; GitGuard alone → throw.\n * The platform deploy resources call ONLY this; they never touch the sandbox.\n */\nexport function createDeployCommand(\n\targs: CreateDeployCommandArgs,\n\topts: pulumi.ComponentResourceOptions,\n): CreateDeployCommandResult {\n\tconst deps = dependsOnList(opts);\n\tconst sandbox = deps.some(isDeploySandbox);\n\tconst gitGuard = deps.some(isGitGuard);\n\n\tif (gitGuard && !sandbox) {\n\t\tthrow new Error(\n\t\t\t`[infracraft] ${args.name}: GitGuard has no effect without a DeploySandbox in dependsOn`,\n\t\t);\n\t}\n\n\tconst env = pulumi.getStack();\n\n\tconst create = pulumi.output(args.cli).apply((cli) =>\n\t\tbuildSandboxScript({\n\t\t\tsandbox,\n\t\t\tgitGuard,\n\t\t\tappName: args.name.replace(/-deploy$/, \"\"),\n\t\t\tenv,\n\t\t\texcludePaths: args.excludePaths,\n\t\t\tsetup: args.setup,\n\t\t\tcli,\n\t\t}),\n\t);\n\n\tconst cmd = new command.local.Command(\n\t\targs.name,\n\t\t{ create, triggers: args.triggers, environment: args.environment },\n\t\topts,\n\t);\n\n\tconst deploymentUrl = cmd.stdout.apply(\n\t\t(out) => out.trim().split(\"\\n\").pop() ?? \"\",\n\t);\n\n\treturn { command: cmd, deploymentUrl };\n}\n"],"mappings":";;;;;;;;AA6BA,SAAS,cAAc,MAAkD;CACxE,MAAM,MAAM,KAAK;CAEjB,IAAI,MAAM,QAAQ,GAAG,GACpB,OAAO;CAGR,OAAO,MAAM,CAAC,GAAG,IAAI,CAAC;AACvB;;;;;;AAOA,SAAgB,oBACf,MACA,MAC4B;CAC5B,MAAM,OAAO,cAAc,IAAI;CAC/B,MAAM,UAAU,KAAK,KAAK,eAAe;CACzC,MAAM,WAAW,KAAK,KAAK,UAAU;CAErC,IAAI,YAAY,CAAC,SAChB,MAAM,IAAI,MACT,gBAAgB,KAAK,KAAK,8DAC3B;CAGD,MAAM,MAAM,OAAO,SAAS;CAE5B,MAAM,SAAS,OAAO,OAAO,KAAK,GAAG,EAAE,OAAO,QAC7C,mBAAmB;EAClB;EACA;EACA,SAAS,KAAK,KAAK,QAAQ,YAAY,EAAE;EACzC;EACA,cAAc,KAAK;EACnB,OAAO,KAAK;EACZ;CACD,CAAC,CACF;CAEA,MAAM,MAAM,IAAI,QAAQ,MAAM,QAC7B,KAAK,MACL;EAAE;EAAQ,UAAU,KAAK;EAAU,aAAa,KAAK;CAAY,GACjE,IACD;CAMA,OAAO;EAAE,SAAS;EAAK,eAJD,IAAI,OAAO,OAC/B,QAAQ,IAAI,KAAK,EAAE,MAAM,IAAI,EAAE,IAAI,KAAK,EAGP;CAAE;AACtC"}
@@ -1,27 +1,14 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_chunk = require('../chunk-BVYJZCqc.cjs');
3
- const require_stable_dir = require('../stable-dir.cjs');
3
+ const require_deploy_command = require('../deploy-command.cjs');
4
4
  const require_fly_toml = require('./toml.cjs');
5
- let _pulumi_command = require("@pulumi/command");
6
- _pulumi_command = require_chunk.__toESM(_pulumi_command, 1);
7
5
  let _pulumi_pulumi = require("@pulumi/pulumi");
8
6
  _pulumi_pulumi = require_chunk.__toESM(_pulumi_pulumi, 1);
9
7
 
10
8
  //#region src/fly/deploy.ts
11
9
  /**
12
- * Deploys a Fly app via `fly deploy --remote-only`, driven by a generated
13
- * fly.toml. The toml is written by the deploy command itself (at execution
14
- * time, not during `pulumi preview`) to `<monorepoRoot>/.fly/<app>.toml`, and
15
- * its content is added to the redeploy triggers (so config changes redeploy).
16
- *
17
- * @example
18
- * ```typescript
19
- * new FlyDeploy("api-deploy", {
20
- * monorepoRoot,
21
- * config: { app: "rby-api", primaryRegion: "iad", build: { dockerfile: "apps/api/Dockerfile" } },
22
- * triggers: [hashDirectory("apps/api"), secrets.version],
23
- * }, { provider, app, dependsOn: [secrets] });
24
- * ```
10
+ * Deploys a Fly app via `fly deploy --remote-only` from a generated fly.toml.
11
+ * Isolation/git are the seam's job (list a `DeploySandbox`, optionally a `GitGuard`).
25
12
  */
26
13
  var FlyDeploy = class extends _pulumi_pulumi.ComponentResource {
27
14
  constructor(name, args, opts) {
@@ -32,23 +19,26 @@ var FlyDeploy = class extends _pulumi_pulumi.ComponentResource {
32
19
  const waitTimeout = args.waitTimeout ?? 300;
33
20
  const releaseCommandTimeout = args.releaseCommandTimeout ?? 600;
34
21
  const highAvailability = args.highAvailability ?? false;
35
- const deployCommand = [
36
- "mkdir -p .fly",
37
- `printf '%s' "$FLY_TOML_CONTENT" > ${configPath}`,
38
- `fly deploy --config ${configPath} --remote-only --ha=${highAvailability} --wait-timeout ${waitTimeout} --release-command-timeout ${releaseCommandTimeout}`
39
- ].join(" && ");
22
+ const setup = `mkdir -p .fly && printf '%s' "$FLY_TOML_CONTENT" > ${configPath}`;
23
+ const cli = `fly deploy --config ${configPath} --remote-only --ha=${highAvailability} --wait-timeout ${waitTimeout} --release-command-timeout ${releaseCommandTimeout}`;
40
24
  const triggers = _pulumi_pulumi.output(args.triggers).apply((values) => [...values, tomlContent]);
41
- new _pulumi_command.local.Command(`${name}-deploy`, {
42
- create: deployCommand,
25
+ let consumerDeps;
26
+ if (Array.isArray(pulumiOpts.dependsOn)) consumerDeps = pulumiOpts.dependsOn;
27
+ else if (pulumiOpts.dependsOn) consumerDeps = [pulumiOpts.dependsOn];
28
+ else consumerDeps = [];
29
+ require_deploy_command.createDeployCommand({
30
+ name: `${name}-deploy`,
31
+ cli,
43
32
  triggers,
44
- dir: require_stable_dir.stableDir(args.monorepoRoot),
33
+ setup,
45
34
  environment: {
46
35
  FLY_API_TOKEN: provider.token,
47
36
  FLY_TOML_CONTENT: tomlContent
48
37
  }
49
38
  }, {
39
+ ...pulumiOpts,
50
40
  parent: this,
51
- dependsOn: [app]
41
+ dependsOn: [app, ...consumerDeps]
52
42
  });
53
43
  this.registerOutputs({});
54
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.cjs","names":["pulumi","generateFlyToml","command","stableDir"],"sources":["../../src/fly/deploy.ts"],"sourcesContent":["import * as command from \"@pulumi/command\";\nimport * as pulumi from \"@pulumi/pulumi\";\n\nimport { stableDir } from \"../stable-dir\";\nimport type { FlyApp } from \"./app\";\nimport type { FlyProvider } from \"./provider\";\nimport { type FlyTomlConfig, generateFlyToml } from \"./toml\";\n\n/** Options type for FlyDeploy. */\ntype FlyDeployOptions = Omit<pulumi.ComponentResourceOptions, \"provider\"> & {\n\t/** Fly authentication context. */\n\tprovider: FlyProvider;\n\n\t/** App to deploy into. */\n\tapp: FlyApp;\n};\n\n/** Args for FlyDeploy. */\nexport interface FlyDeployArgs {\n\t/**\n\t * Absolute path to the repo root (working directory for `fly deploy`).\n\t * Stored relative to the Pulumi program directory so the command stays stable\n\t * across machines and CI (see {@link stableDir}).\n\t */\n\tmonorepoRoot: string;\n\n\t/**\n\t * fly.toml configuration. `config.app` must equal the FlyApp name. All values\n\t * are plain (not `pulumi.Input`) — resolve Outputs before constructing this.\n\t */\n\tconfig: FlyTomlConfig;\n\n\t/**\n\t * Values that force a redeploy when changed (e.g. a source hash from\n\t * `hashDirectory()` and `FlySecret.version`). The generated toml content is\n\t * appended automatically.\n\t */\n\ttriggers: pulumi.Input<pulumi.Input<string>[]>;\n\n\t/** `fly deploy --wait-timeout` in seconds (default 300). */\n\twaitTimeout?: number;\n\n\t/** `fly deploy --release-command-timeout` in seconds (default 600). */\n\treleaseCommandTimeout?: number;\n\n\t/** `fly deploy --ha` (default false). */\n\thighAvailability?: boolean;\n}\n\n/**\n * Deploys a Fly app via `fly deploy --remote-only`, driven by a generated\n * fly.toml. The toml is written by the deploy command itself (at execution\n * time, not during `pulumi preview`) to `<monorepoRoot>/.fly/<app>.toml`, and\n * its content is added to the redeploy triggers (so config changes redeploy).\n *\n * @example\n * ```typescript\n * new FlyDeploy(\"api-deploy\", {\n * monorepoRoot,\n * config: { app: \"rby-api\", primaryRegion: \"iad\", build: { dockerfile: \"apps/api/Dockerfile\" } },\n * triggers: [hashDirectory(\"apps/api\"), secrets.version],\n * }, { provider, app, dependsOn: [secrets] });\n * ```\n */\nexport class FlyDeploy extends pulumi.ComponentResource {\n\tconstructor(name: string, args: FlyDeployArgs, opts: FlyDeployOptions) {\n\t\tconst { provider, app, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:fly:Deploy\", name, {}, pulumiOpts);\n\n\t\tconst tomlContent = generateFlyToml(args.config);\n\t\tconst configPath = `.fly/${args.config.app}.toml`;\n\n\t\tconst waitTimeout = args.waitTimeout ?? 300;\n\t\tconst releaseCommandTimeout = args.releaseCommandTimeout ?? 600;\n\t\tconst highAvailability = args.highAvailability ?? false;\n\n\t\t// The toml is written by the command at execution time. The content\n\t\t// arrives via the FLY_TOML_CONTENT env var (avoiding shell escaping) so\n\t\t// no file is touched during `pulumi preview`.\n\t\tconst deployCommand = [\n\t\t\t\"mkdir -p .fly\",\n\t\t\t`printf '%s' \"$FLY_TOML_CONTENT\" > ${configPath}`,\n\t\t\t`fly deploy --config ${configPath} --remote-only --ha=${highAvailability} --wait-timeout ${waitTimeout} --release-command-timeout ${releaseCommandTimeout}`,\n\t\t].join(\" && \");\n\n\t\tconst triggers = pulumi\n\t\t\t.output(args.triggers)\n\t\t\t.apply((values) => [...values, tomlContent]);\n\n\t\tnew command.local.Command(\n\t\t\t`${name}-deploy`,\n\t\t\t{\n\t\t\t\tcreate: deployCommand,\n\t\t\t\ttriggers,\n\t\t\t\tdir: stableDir(args.monorepoRoot),\n\t\t\t\tenvironment: {\n\t\t\t\t\tFLY_API_TOKEN: provider.token,\n\t\t\t\t\tFLY_TOML_CONTENT: tomlContent,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ parent: this, dependsOn: [app] },\n\t\t);\n\n\t\tthis.registerOutputs({});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,IAAa,YAAb,cAA+BA,eAAO,kBAAkB;CACvD,YAAY,MAAc,MAAqB,MAAwB;EACtE,MAAM,EAAE,UAAU,KAAK,GAAG,eAAe;EAEzC,MAAM,yBAAyB,MAAM,CAAC,GAAG,UAAU;EAEnD,MAAM,cAAcC,iCAAgB,KAAK,MAAM;EAC/C,MAAM,aAAa,QAAQ,KAAK,OAAO,IAAI;EAE3C,MAAM,cAAc,KAAK,eAAe;EACxC,MAAM,wBAAwB,KAAK,yBAAyB;EAC5D,MAAM,mBAAmB,KAAK,oBAAoB;EAKlD,MAAM,gBAAgB;GACrB;GACA,qCAAqC;GACrC,uBAAuB,WAAW,sBAAsB,iBAAiB,kBAAkB,YAAY,6BAA6B;EACrI,EAAE,KAAK,MAAM;EAEb,MAAM,WAAWD,eACf,OAAO,KAAK,QAAQ,EACpB,OAAO,WAAW,CAAC,GAAG,QAAQ,WAAW,CAAC;EAE5C,IAAIE,gBAAQ,MAAM,QACjB,GAAG,KAAK,UACR;GACC,QAAQ;GACR;GACA,KAAKC,6BAAU,KAAK,YAAY;GAChC,aAAa;IACZ,eAAe,SAAS;IACxB,kBAAkB;GACnB;EACD,GACA;GAAE,QAAQ;GAAM,WAAW,CAAC,GAAG;EAAE,CAClC;EAEA,KAAK,gBAAgB,CAAC,CAAC;CACxB;AACD"}
1
+ {"version":3,"file":"deploy.cjs","names":["pulumi","generateFlyToml"],"sources":["../../src/fly/deploy.ts"],"sourcesContent":["// src/fly/deploy.ts (replace entire file)\nimport * as pulumi from \"@pulumi/pulumi\";\n\nimport { createDeployCommand } from \"../deploy-command\";\nimport type { FlyApp } from \"./app\";\nimport type { FlyProvider } from \"./provider\";\nimport { type FlyTomlConfig, generateFlyToml } from \"./toml\";\n\ntype FlyDeployOptions = Omit<pulumi.ComponentResourceOptions, \"provider\"> & {\n\tprovider: FlyProvider;\n\tapp: FlyApp;\n};\n\nexport interface FlyDeployArgs {\n\t/** fly.toml configuration. `config.app` must equal the FlyApp name. */\n\tconfig: FlyTomlConfig;\n\t/** Redeploy triggers; the generated toml content is appended automatically. */\n\ttriggers: pulumi.Input<pulumi.Input<string>[]>;\n\t/** `fly deploy --wait-timeout` seconds (default 300). */\n\twaitTimeout?: number;\n\t/** `fly deploy --release-command-timeout` seconds (default 600). */\n\treleaseCommandTimeout?: number;\n\t/** `fly deploy --ha` (default false). */\n\thighAvailability?: boolean;\n}\n\n/**\n * Deploys a Fly app via `fly deploy --remote-only` from a generated fly.toml.\n * Isolation/git are the seam's job (list a `DeploySandbox`, optionally a `GitGuard`).\n */\nexport class FlyDeploy extends pulumi.ComponentResource {\n\tconstructor(name: string, args: FlyDeployArgs, opts: FlyDeployOptions) {\n\t\tconst { provider, app, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:fly:Deploy\", name, {}, pulumiOpts);\n\n\t\tconst tomlContent = generateFlyToml(args.config);\n\t\tconst configPath = `.fly/${args.config.app}.toml`;\n\n\t\tconst waitTimeout = args.waitTimeout ?? 300;\n\t\tconst releaseCommandTimeout = args.releaseCommandTimeout ?? 600;\n\t\tconst highAvailability = args.highAvailability ?? false;\n\n\t\t// The toml content arrives via FLY_TOML_CONTENT (avoids shell escaping).\n\t\tconst setup = `mkdir -p .fly && printf '%s' \"$FLY_TOML_CONTENT\" > ${configPath}`;\n\t\tconst cli = `fly deploy --config ${configPath} --remote-only --ha=${highAvailability} --wait-timeout ${waitTimeout} --release-command-timeout ${releaseCommandTimeout}`;\n\n\t\tconst triggers = pulumi\n\t\t\t.output(args.triggers)\n\t\t\t.apply((values) => [...values, tomlContent]);\n\n\t\tlet consumerDeps: pulumi.Resource[];\n\n\t\tif (Array.isArray(pulumiOpts.dependsOn)) {\n\t\t\tconsumerDeps = pulumiOpts.dependsOn as pulumi.Resource[];\n\t\t} else if (pulumiOpts.dependsOn) {\n\t\t\tconsumerDeps = [pulumiOpts.dependsOn as pulumi.Resource];\n\t\t} else {\n\t\t\tconsumerDeps = [];\n\t\t}\n\n\t\tcreateDeployCommand(\n\t\t\t{\n\t\t\t\tname: `${name}-deploy`,\n\t\t\t\tcli,\n\t\t\t\ttriggers,\n\t\t\t\tsetup,\n\t\t\t\tenvironment: {\n\t\t\t\t\tFLY_API_TOKEN: provider.token,\n\t\t\t\t\tFLY_TOML_CONTENT: tomlContent,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ ...pulumiOpts, parent: this, dependsOn: [app, ...consumerDeps] },\n\t\t);\n\n\t\tthis.registerOutputs({});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;AA8BA,IAAa,YAAb,cAA+BA,eAAO,kBAAkB;CACvD,YAAY,MAAc,MAAqB,MAAwB;EACtE,MAAM,EAAE,UAAU,KAAK,GAAG,eAAe;EAEzC,MAAM,yBAAyB,MAAM,CAAC,GAAG,UAAU;EAEnD,MAAM,cAAcC,iCAAgB,KAAK,MAAM;EAC/C,MAAM,aAAa,QAAQ,KAAK,OAAO,IAAI;EAE3C,MAAM,cAAc,KAAK,eAAe;EACxC,MAAM,wBAAwB,KAAK,yBAAyB;EAC5D,MAAM,mBAAmB,KAAK,oBAAoB;EAGlD,MAAM,QAAQ,sDAAsD;EACpE,MAAM,MAAM,uBAAuB,WAAW,sBAAsB,iBAAiB,kBAAkB,YAAY,6BAA6B;EAEhJ,MAAM,WAAWD,eACf,OAAO,KAAK,QAAQ,EACpB,OAAO,WAAW,CAAC,GAAG,QAAQ,WAAW,CAAC;EAE5C,IAAI;EAEJ,IAAI,MAAM,QAAQ,WAAW,SAAS,GACrC,eAAe,WAAW;OACpB,IAAI,WAAW,WACrB,eAAe,CAAC,WAAW,SAA4B;OAEvD,eAAe,CAAC;EAGjB,2CACC;GACC,MAAM,GAAG,KAAK;GACd;GACA;GACA;GACA,aAAa;IACZ,eAAe,SAAS;IACxB,kBAAkB;GACnB;EACD,GACA;GAAE,GAAG;GAAY,QAAQ;GAAM,WAAW,CAAC,KAAK,GAAG,YAAY;EAAE,CAClE;EAEA,KAAK,gBAAgB,CAAC,CAAC;CACxB;AACD"}
@@ -5,51 +5,25 @@ import { FlyTomlConfig } from "./toml.cjs";
5
5
  import * as pulumi from "@pulumi/pulumi";
6
6
 
7
7
  //#region src/fly/deploy.d.ts
8
- /** Options type for FlyDeploy. */
9
8
  type FlyDeployOptions = Omit<pulumi.ComponentResourceOptions, "provider"> & {
10
- /** Fly authentication context. */provider: FlyProvider; /** App to deploy into. */
9
+ provider: FlyProvider;
11
10
  app: FlyApp;
12
11
  };
13
- /** Args for FlyDeploy. */
14
12
  interface FlyDeployArgs {
15
- /**
16
- * Absolute path to the repo root (working directory for `fly deploy`).
17
- * Stored relative to the Pulumi program directory so the command stays stable
18
- * across machines and CI (see {@link stableDir}).
19
- */
20
- monorepoRoot: string;
21
- /**
22
- * fly.toml configuration. `config.app` must equal the FlyApp name. All values
23
- * are plain (not `pulumi.Input`) — resolve Outputs before constructing this.
24
- */
13
+ /** fly.toml configuration. `config.app` must equal the FlyApp name. */
25
14
  config: FlyTomlConfig;
26
- /**
27
- * Values that force a redeploy when changed (e.g. a source hash from
28
- * `hashDirectory()` and `FlySecret.version`). The generated toml content is
29
- * appended automatically.
30
- */
15
+ /** Redeploy triggers; the generated toml content is appended automatically. */
31
16
  triggers: pulumi.Input<pulumi.Input<string>[]>;
32
- /** `fly deploy --wait-timeout` in seconds (default 300). */
17
+ /** `fly deploy --wait-timeout` seconds (default 300). */
33
18
  waitTimeout?: number;
34
- /** `fly deploy --release-command-timeout` in seconds (default 600). */
19
+ /** `fly deploy --release-command-timeout` seconds (default 600). */
35
20
  releaseCommandTimeout?: number;
36
21
  /** `fly deploy --ha` (default false). */
37
22
  highAvailability?: boolean;
38
23
  }
39
24
  /**
40
- * Deploys a Fly app via `fly deploy --remote-only`, driven by a generated
41
- * fly.toml. The toml is written by the deploy command itself (at execution
42
- * time, not during `pulumi preview`) to `<monorepoRoot>/.fly/<app>.toml`, and
43
- * its content is added to the redeploy triggers (so config changes redeploy).
44
- *
45
- * @example
46
- * ```typescript
47
- * new FlyDeploy("api-deploy", {
48
- * monorepoRoot,
49
- * config: { app: "rby-api", primaryRegion: "iad", build: { dockerfile: "apps/api/Dockerfile" } },
50
- * triggers: [hashDirectory("apps/api"), secrets.version],
51
- * }, { provider, app, dependsOn: [secrets] });
52
- * ```
25
+ * Deploys a Fly app via `fly deploy --remote-only` from a generated fly.toml.
26
+ * Isolation/git are the seam's job (list a `DeploySandbox`, optionally a `GitGuard`).
53
27
  */
54
28
  declare class FlyDeploy extends pulumi.ComponentResource {
55
29
  constructor(name: string, args: FlyDeployArgs, opts: FlyDeployOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.cts","names":[],"sources":["../../src/fly/deploy.ts"],"mappings":";;;;;;;;KASK,gBAAA,GAAmB,IAAA,CAAK,MAAA,CAAO,wBAAA;oCAEnC,QAAA,EAAU,WAAA,EAFU;EAKpB,GAAA,EAAK,MAAA;AAAA;;UAIW,aAAA;EAJX;;;;;EAUL,YAAA;EAbA;;;;EAmBA,MAAA,EAAQ,aAAA;EAhBG;AAIZ;;;;EAmBC,QAAA,EAAU,MAAA,CAAO,KAAA,CAAM,MAAA,CAAO,KAAA;EAApB;EAGV,WAAA;EAHsB;EAMtB,qBAAA;EAbA;EAgBA,gBAAA;AAAA;;;;;;;;;AAAgB;AAkBjB;;;;;;cAAa,SAAA,SAAkB,MAAA,CAAO,iBAAA;cACzB,IAAA,UAAc,IAAA,EAAM,aAAA,EAAe,IAAA,EAAM,gBAAA;AAAA"}
1
+ {"version":3,"file":"deploy.d.cts","names":[],"sources":["../../src/fly/deploy.ts"],"mappings":";;;;;;;KAQK,gBAAA,GAAmB,IAAA,CAAK,MAAA,CAAO,wBAAA;EACnC,QAAA,EAAU,WAAA;EACV,GAAA,EAAK,MAAA;AAAA;AAAA,UAGW,aAAA;;EAEhB,MAAA,EAAQ,aAAA;EAPe;EASvB,QAAA,EAAU,MAAA,CAAO,KAAA,CAAM,MAAA,CAAO,KAAA;EAPzB;EASL,WAAA;EATW;EAWX,qBAAA;EAb4B;EAe5B,gBAAA;AAAA;;;;;cAOY,SAAA,SAAkB,MAAA,CAAO,iBAAA;cACzB,IAAA,UAAc,IAAA,EAAM,aAAA,EAAe,IAAA,EAAM,gBAAA;AAAA"}
@@ -5,51 +5,25 @@ import { FlyTomlConfig } from "./toml.mjs";
5
5
  import * as pulumi from "@pulumi/pulumi";
6
6
 
7
7
  //#region src/fly/deploy.d.ts
8
- /** Options type for FlyDeploy. */
9
8
  type FlyDeployOptions = Omit<pulumi.ComponentResourceOptions, "provider"> & {
10
- /** Fly authentication context. */provider: FlyProvider; /** App to deploy into. */
9
+ provider: FlyProvider;
11
10
  app: FlyApp;
12
11
  };
13
- /** Args for FlyDeploy. */
14
12
  interface FlyDeployArgs {
15
- /**
16
- * Absolute path to the repo root (working directory for `fly deploy`).
17
- * Stored relative to the Pulumi program directory so the command stays stable
18
- * across machines and CI (see {@link stableDir}).
19
- */
20
- monorepoRoot: string;
21
- /**
22
- * fly.toml configuration. `config.app` must equal the FlyApp name. All values
23
- * are plain (not `pulumi.Input`) — resolve Outputs before constructing this.
24
- */
13
+ /** fly.toml configuration. `config.app` must equal the FlyApp name. */
25
14
  config: FlyTomlConfig;
26
- /**
27
- * Values that force a redeploy when changed (e.g. a source hash from
28
- * `hashDirectory()` and `FlySecret.version`). The generated toml content is
29
- * appended automatically.
30
- */
15
+ /** Redeploy triggers; the generated toml content is appended automatically. */
31
16
  triggers: pulumi.Input<pulumi.Input<string>[]>;
32
- /** `fly deploy --wait-timeout` in seconds (default 300). */
17
+ /** `fly deploy --wait-timeout` seconds (default 300). */
33
18
  waitTimeout?: number;
34
- /** `fly deploy --release-command-timeout` in seconds (default 600). */
19
+ /** `fly deploy --release-command-timeout` seconds (default 600). */
35
20
  releaseCommandTimeout?: number;
36
21
  /** `fly deploy --ha` (default false). */
37
22
  highAvailability?: boolean;
38
23
  }
39
24
  /**
40
- * Deploys a Fly app via `fly deploy --remote-only`, driven by a generated
41
- * fly.toml. The toml is written by the deploy command itself (at execution
42
- * time, not during `pulumi preview`) to `<monorepoRoot>/.fly/<app>.toml`, and
43
- * its content is added to the redeploy triggers (so config changes redeploy).
44
- *
45
- * @example
46
- * ```typescript
47
- * new FlyDeploy("api-deploy", {
48
- * monorepoRoot,
49
- * config: { app: "rby-api", primaryRegion: "iad", build: { dockerfile: "apps/api/Dockerfile" } },
50
- * triggers: [hashDirectory("apps/api"), secrets.version],
51
- * }, { provider, app, dependsOn: [secrets] });
52
- * ```
25
+ * Deploys a Fly app via `fly deploy --remote-only` from a generated fly.toml.
26
+ * Isolation/git are the seam's job (list a `DeploySandbox`, optionally a `GitGuard`).
53
27
  */
54
28
  declare class FlyDeploy extends pulumi.ComponentResource {
55
29
  constructor(name: string, args: FlyDeployArgs, opts: FlyDeployOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.mts","names":[],"sources":["../../src/fly/deploy.ts"],"mappings":";;;;;;;;KASK,gBAAA,GAAmB,IAAA,CAAK,MAAA,CAAO,wBAAA;oCAEnC,QAAA,EAAU,WAAA,EAFU;EAKpB,GAAA,EAAK,MAAA;AAAA;;UAIW,aAAA;EAJX;;;;;EAUL,YAAA;EAbA;;;;EAmBA,MAAA,EAAQ,aAAA;EAhBG;AAIZ;;;;EAmBC,QAAA,EAAU,MAAA,CAAO,KAAA,CAAM,MAAA,CAAO,KAAA;EAApB;EAGV,WAAA;EAHsB;EAMtB,qBAAA;EAbA;EAgBA,gBAAA;AAAA;;;;;;;;;AAAgB;AAkBjB;;;;;;cAAa,SAAA,SAAkB,MAAA,CAAO,iBAAA;cACzB,IAAA,UAAc,IAAA,EAAM,aAAA,EAAe,IAAA,EAAM,gBAAA;AAAA"}
1
+ {"version":3,"file":"deploy.d.mts","names":[],"sources":["../../src/fly/deploy.ts"],"mappings":";;;;;;;KAQK,gBAAA,GAAmB,IAAA,CAAK,MAAA,CAAO,wBAAA;EACnC,QAAA,EAAU,WAAA;EACV,GAAA,EAAK,MAAA;AAAA;AAAA,UAGW,aAAA;;EAEhB,MAAA,EAAQ,aAAA;EAPe;EASvB,QAAA,EAAU,MAAA,CAAO,KAAA,CAAM,MAAA,CAAO,KAAA;EAPzB;EASL,WAAA;EATW;EAWX,qBAAA;EAb4B;EAe5B,gBAAA;AAAA;;;;;cAOY,SAAA,SAAkB,MAAA,CAAO,iBAAA;cACzB,IAAA,UAAc,IAAA,EAAM,aAAA,EAAe,IAAA,EAAM,gBAAA;AAAA"}
@@ -1,24 +1,12 @@
1
1
  import { t as __name } from "../chunk-OPjESj5l.mjs";
2
- import { stableDir } from "../stable-dir.mjs";
2
+ import { createDeployCommand } from "../deploy-command.mjs";
3
3
  import { generateFlyToml } from "./toml.mjs";
4
- import * as command from "@pulumi/command";
5
4
  import * as pulumi from "@pulumi/pulumi";
6
5
 
7
6
  //#region src/fly/deploy.ts
8
7
  /**
9
- * Deploys a Fly app via `fly deploy --remote-only`, driven by a generated
10
- * fly.toml. The toml is written by the deploy command itself (at execution
11
- * time, not during `pulumi preview`) to `<monorepoRoot>/.fly/<app>.toml`, and
12
- * its content is added to the redeploy triggers (so config changes redeploy).
13
- *
14
- * @example
15
- * ```typescript
16
- * new FlyDeploy("api-deploy", {
17
- * monorepoRoot,
18
- * config: { app: "rby-api", primaryRegion: "iad", build: { dockerfile: "apps/api/Dockerfile" } },
19
- * triggers: [hashDirectory("apps/api"), secrets.version],
20
- * }, { provider, app, dependsOn: [secrets] });
21
- * ```
8
+ * Deploys a Fly app via `fly deploy --remote-only` from a generated fly.toml.
9
+ * Isolation/git are the seam's job (list a `DeploySandbox`, optionally a `GitGuard`).
22
10
  */
23
11
  var FlyDeploy = class extends pulumi.ComponentResource {
24
12
  constructor(name, args, opts) {
@@ -29,23 +17,26 @@ var FlyDeploy = class extends pulumi.ComponentResource {
29
17
  const waitTimeout = args.waitTimeout ?? 300;
30
18
  const releaseCommandTimeout = args.releaseCommandTimeout ?? 600;
31
19
  const highAvailability = args.highAvailability ?? false;
32
- const deployCommand = [
33
- "mkdir -p .fly",
34
- `printf '%s' "$FLY_TOML_CONTENT" > ${configPath}`,
35
- `fly deploy --config ${configPath} --remote-only --ha=${highAvailability} --wait-timeout ${waitTimeout} --release-command-timeout ${releaseCommandTimeout}`
36
- ].join(" && ");
20
+ const setup = `mkdir -p .fly && printf '%s' "$FLY_TOML_CONTENT" > ${configPath}`;
21
+ const cli = `fly deploy --config ${configPath} --remote-only --ha=${highAvailability} --wait-timeout ${waitTimeout} --release-command-timeout ${releaseCommandTimeout}`;
37
22
  const triggers = pulumi.output(args.triggers).apply((values) => [...values, tomlContent]);
38
- new command.local.Command(`${name}-deploy`, {
39
- create: deployCommand,
23
+ let consumerDeps;
24
+ if (Array.isArray(pulumiOpts.dependsOn)) consumerDeps = pulumiOpts.dependsOn;
25
+ else if (pulumiOpts.dependsOn) consumerDeps = [pulumiOpts.dependsOn];
26
+ else consumerDeps = [];
27
+ createDeployCommand({
28
+ name: `${name}-deploy`,
29
+ cli,
40
30
  triggers,
41
- dir: stableDir(args.monorepoRoot),
31
+ setup,
42
32
  environment: {
43
33
  FLY_API_TOKEN: provider.token,
44
34
  FLY_TOML_CONTENT: tomlContent
45
35
  }
46
36
  }, {
37
+ ...pulumiOpts,
47
38
  parent: this,
48
- dependsOn: [app]
39
+ dependsOn: [app, ...consumerDeps]
49
40
  });
50
41
  this.registerOutputs({});
51
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.mjs","names":[],"sources":["../../src/fly/deploy.ts"],"sourcesContent":["import * as command from \"@pulumi/command\";\nimport * as pulumi from \"@pulumi/pulumi\";\n\nimport { stableDir } from \"../stable-dir\";\nimport type { FlyApp } from \"./app\";\nimport type { FlyProvider } from \"./provider\";\nimport { type FlyTomlConfig, generateFlyToml } from \"./toml\";\n\n/** Options type for FlyDeploy. */\ntype FlyDeployOptions = Omit<pulumi.ComponentResourceOptions, \"provider\"> & {\n\t/** Fly authentication context. */\n\tprovider: FlyProvider;\n\n\t/** App to deploy into. */\n\tapp: FlyApp;\n};\n\n/** Args for FlyDeploy. */\nexport interface FlyDeployArgs {\n\t/**\n\t * Absolute path to the repo root (working directory for `fly deploy`).\n\t * Stored relative to the Pulumi program directory so the command stays stable\n\t * across machines and CI (see {@link stableDir}).\n\t */\n\tmonorepoRoot: string;\n\n\t/**\n\t * fly.toml configuration. `config.app` must equal the FlyApp name. All values\n\t * are plain (not `pulumi.Input`) — resolve Outputs before constructing this.\n\t */\n\tconfig: FlyTomlConfig;\n\n\t/**\n\t * Values that force a redeploy when changed (e.g. a source hash from\n\t * `hashDirectory()` and `FlySecret.version`). The generated toml content is\n\t * appended automatically.\n\t */\n\ttriggers: pulumi.Input<pulumi.Input<string>[]>;\n\n\t/** `fly deploy --wait-timeout` in seconds (default 300). */\n\twaitTimeout?: number;\n\n\t/** `fly deploy --release-command-timeout` in seconds (default 600). */\n\treleaseCommandTimeout?: number;\n\n\t/** `fly deploy --ha` (default false). */\n\thighAvailability?: boolean;\n}\n\n/**\n * Deploys a Fly app via `fly deploy --remote-only`, driven by a generated\n * fly.toml. The toml is written by the deploy command itself (at execution\n * time, not during `pulumi preview`) to `<monorepoRoot>/.fly/<app>.toml`, and\n * its content is added to the redeploy triggers (so config changes redeploy).\n *\n * @example\n * ```typescript\n * new FlyDeploy(\"api-deploy\", {\n * monorepoRoot,\n * config: { app: \"rby-api\", primaryRegion: \"iad\", build: { dockerfile: \"apps/api/Dockerfile\" } },\n * triggers: [hashDirectory(\"apps/api\"), secrets.version],\n * }, { provider, app, dependsOn: [secrets] });\n * ```\n */\nexport class FlyDeploy extends pulumi.ComponentResource {\n\tconstructor(name: string, args: FlyDeployArgs, opts: FlyDeployOptions) {\n\t\tconst { provider, app, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:fly:Deploy\", name, {}, pulumiOpts);\n\n\t\tconst tomlContent = generateFlyToml(args.config);\n\t\tconst configPath = `.fly/${args.config.app}.toml`;\n\n\t\tconst waitTimeout = args.waitTimeout ?? 300;\n\t\tconst releaseCommandTimeout = args.releaseCommandTimeout ?? 600;\n\t\tconst highAvailability = args.highAvailability ?? false;\n\n\t\t// The toml is written by the command at execution time. The content\n\t\t// arrives via the FLY_TOML_CONTENT env var (avoiding shell escaping) so\n\t\t// no file is touched during `pulumi preview`.\n\t\tconst deployCommand = [\n\t\t\t\"mkdir -p .fly\",\n\t\t\t`printf '%s' \"$FLY_TOML_CONTENT\" > ${configPath}`,\n\t\t\t`fly deploy --config ${configPath} --remote-only --ha=${highAvailability} --wait-timeout ${waitTimeout} --release-command-timeout ${releaseCommandTimeout}`,\n\t\t].join(\" && \");\n\n\t\tconst triggers = pulumi\n\t\t\t.output(args.triggers)\n\t\t\t.apply((values) => [...values, tomlContent]);\n\n\t\tnew command.local.Command(\n\t\t\t`${name}-deploy`,\n\t\t\t{\n\t\t\t\tcreate: deployCommand,\n\t\t\t\ttriggers,\n\t\t\t\tdir: stableDir(args.monorepoRoot),\n\t\t\t\tenvironment: {\n\t\t\t\t\tFLY_API_TOKEN: provider.token,\n\t\t\t\t\tFLY_TOML_CONTENT: tomlContent,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ parent: this, dependsOn: [app] },\n\t\t);\n\n\t\tthis.registerOutputs({});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgEA,IAAa,YAAb,cAA+B,OAAO,kBAAkB;CACvD,YAAY,MAAc,MAAqB,MAAwB;EACtE,MAAM,EAAE,UAAU,KAAK,GAAG,eAAe;EAEzC,MAAM,yBAAyB,MAAM,CAAC,GAAG,UAAU;EAEnD,MAAM,cAAc,gBAAgB,KAAK,MAAM;EAC/C,MAAM,aAAa,QAAQ,KAAK,OAAO,IAAI;EAE3C,MAAM,cAAc,KAAK,eAAe;EACxC,MAAM,wBAAwB,KAAK,yBAAyB;EAC5D,MAAM,mBAAmB,KAAK,oBAAoB;EAKlD,MAAM,gBAAgB;GACrB;GACA,qCAAqC;GACrC,uBAAuB,WAAW,sBAAsB,iBAAiB,kBAAkB,YAAY,6BAA6B;EACrI,EAAE,KAAK,MAAM;EAEb,MAAM,WAAW,OACf,OAAO,KAAK,QAAQ,EACpB,OAAO,WAAW,CAAC,GAAG,QAAQ,WAAW,CAAC;EAE5C,IAAI,QAAQ,MAAM,QACjB,GAAG,KAAK,UACR;GACC,QAAQ;GACR;GACA,KAAK,UAAU,KAAK,YAAY;GAChC,aAAa;IACZ,eAAe,SAAS;IACxB,kBAAkB;GACnB;EACD,GACA;GAAE,QAAQ;GAAM,WAAW,CAAC,GAAG;EAAE,CAClC;EAEA,KAAK,gBAAgB,CAAC,CAAC;CACxB;AACD"}
1
+ {"version":3,"file":"deploy.mjs","names":[],"sources":["../../src/fly/deploy.ts"],"sourcesContent":["// src/fly/deploy.ts (replace entire file)\nimport * as pulumi from \"@pulumi/pulumi\";\n\nimport { createDeployCommand } from \"../deploy-command\";\nimport type { FlyApp } from \"./app\";\nimport type { FlyProvider } from \"./provider\";\nimport { type FlyTomlConfig, generateFlyToml } from \"./toml\";\n\ntype FlyDeployOptions = Omit<pulumi.ComponentResourceOptions, \"provider\"> & {\n\tprovider: FlyProvider;\n\tapp: FlyApp;\n};\n\nexport interface FlyDeployArgs {\n\t/** fly.toml configuration. `config.app` must equal the FlyApp name. */\n\tconfig: FlyTomlConfig;\n\t/** Redeploy triggers; the generated toml content is appended automatically. */\n\ttriggers: pulumi.Input<pulumi.Input<string>[]>;\n\t/** `fly deploy --wait-timeout` seconds (default 300). */\n\twaitTimeout?: number;\n\t/** `fly deploy --release-command-timeout` seconds (default 600). */\n\treleaseCommandTimeout?: number;\n\t/** `fly deploy --ha` (default false). */\n\thighAvailability?: boolean;\n}\n\n/**\n * Deploys a Fly app via `fly deploy --remote-only` from a generated fly.toml.\n * Isolation/git are the seam's job (list a `DeploySandbox`, optionally a `GitGuard`).\n */\nexport class FlyDeploy extends pulumi.ComponentResource {\n\tconstructor(name: string, args: FlyDeployArgs, opts: FlyDeployOptions) {\n\t\tconst { provider, app, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:fly:Deploy\", name, {}, pulumiOpts);\n\n\t\tconst tomlContent = generateFlyToml(args.config);\n\t\tconst configPath = `.fly/${args.config.app}.toml`;\n\n\t\tconst waitTimeout = args.waitTimeout ?? 300;\n\t\tconst releaseCommandTimeout = args.releaseCommandTimeout ?? 600;\n\t\tconst highAvailability = args.highAvailability ?? false;\n\n\t\t// The toml content arrives via FLY_TOML_CONTENT (avoids shell escaping).\n\t\tconst setup = `mkdir -p .fly && printf '%s' \"$FLY_TOML_CONTENT\" > ${configPath}`;\n\t\tconst cli = `fly deploy --config ${configPath} --remote-only --ha=${highAvailability} --wait-timeout ${waitTimeout} --release-command-timeout ${releaseCommandTimeout}`;\n\n\t\tconst triggers = pulumi\n\t\t\t.output(args.triggers)\n\t\t\t.apply((values) => [...values, tomlContent]);\n\n\t\tlet consumerDeps: pulumi.Resource[];\n\n\t\tif (Array.isArray(pulumiOpts.dependsOn)) {\n\t\t\tconsumerDeps = pulumiOpts.dependsOn as pulumi.Resource[];\n\t\t} else if (pulumiOpts.dependsOn) {\n\t\t\tconsumerDeps = [pulumiOpts.dependsOn as pulumi.Resource];\n\t\t} else {\n\t\t\tconsumerDeps = [];\n\t\t}\n\n\t\tcreateDeployCommand(\n\t\t\t{\n\t\t\t\tname: `${name}-deploy`,\n\t\t\t\tcli,\n\t\t\t\ttriggers,\n\t\t\t\tsetup,\n\t\t\t\tenvironment: {\n\t\t\t\t\tFLY_API_TOKEN: provider.token,\n\t\t\t\t\tFLY_TOML_CONTENT: tomlContent,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ ...pulumiOpts, parent: this, dependsOn: [app, ...consumerDeps] },\n\t\t);\n\n\t\tthis.registerOutputs({});\n\t}\n}\n"],"mappings":";;;;;;;;;;AA8BA,IAAa,YAAb,cAA+B,OAAO,kBAAkB;CACvD,YAAY,MAAc,MAAqB,MAAwB;EACtE,MAAM,EAAE,UAAU,KAAK,GAAG,eAAe;EAEzC,MAAM,yBAAyB,MAAM,CAAC,GAAG,UAAU;EAEnD,MAAM,cAAc,gBAAgB,KAAK,MAAM;EAC/C,MAAM,aAAa,QAAQ,KAAK,OAAO,IAAI;EAE3C,MAAM,cAAc,KAAK,eAAe;EACxC,MAAM,wBAAwB,KAAK,yBAAyB;EAC5D,MAAM,mBAAmB,KAAK,oBAAoB;EAGlD,MAAM,QAAQ,sDAAsD;EACpE,MAAM,MAAM,uBAAuB,WAAW,sBAAsB,iBAAiB,kBAAkB,YAAY,6BAA6B;EAEhJ,MAAM,WAAW,OACf,OAAO,KAAK,QAAQ,EACpB,OAAO,WAAW,CAAC,GAAG,QAAQ,WAAW,CAAC;EAE5C,IAAI;EAEJ,IAAI,MAAM,QAAQ,WAAW,SAAS,GACrC,eAAe,WAAW;OACpB,IAAI,WAAW,WACrB,eAAe,CAAC,WAAW,SAA4B;OAEvD,eAAe,CAAC;EAGjB,oBACC;GACC,MAAM,GAAG,KAAK;GACd;GACA;GACA;GACA,aAAa;IACZ,eAAe,SAAS;IACxB,kBAAkB;GACnB;EACD,GACA;GAAE,GAAG;GAAY,QAAQ;GAAM,WAAW,CAAC,KAAK,GAAG,YAAY;EAAE,CAClE;EAEA,KAAK,gBAAgB,CAAC,CAAC;CACxB;AACD"}