rampway 0.2.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 (143) hide show
  1. package/README.md +183 -0
  2. package/build/src/cli.d.ts +3 -0
  3. package/build/src/cli.d.ts.map +1 -0
  4. package/build/src/cli.js +104 -0
  5. package/build/src/cli.js.map +1 -0
  6. package/build/src/commands/context.d.ts +12 -0
  7. package/build/src/commands/context.d.ts.map +1 -0
  8. package/build/src/commands/context.js +16 -0
  9. package/build/src/commands/context.js.map +1 -0
  10. package/build/src/commands/deploy.d.ts +6 -0
  11. package/build/src/commands/deploy.d.ts.map +1 -0
  12. package/build/src/commands/deploy.js +14 -0
  13. package/build/src/commands/deploy.js.map +1 -0
  14. package/build/src/commands/doctor.d.ts +14 -0
  15. package/build/src/commands/doctor.d.ts.map +1 -0
  16. package/build/src/commands/doctor.js +54 -0
  17. package/build/src/commands/doctor.js.map +1 -0
  18. package/build/src/commands/init.d.ts +8 -0
  19. package/build/src/commands/init.d.ts.map +1 -0
  20. package/build/src/commands/init.js +42 -0
  21. package/build/src/commands/init.js.map +1 -0
  22. package/build/src/commands/plan.d.ts +6 -0
  23. package/build/src/commands/plan.d.ts.map +1 -0
  24. package/build/src/commands/plan.js +24 -0
  25. package/build/src/commands/plan.js.map +1 -0
  26. package/build/src/commands/releases.d.ts +27 -0
  27. package/build/src/commands/releases.d.ts.map +1 -0
  28. package/build/src/commands/releases.js +91 -0
  29. package/build/src/commands/releases.js.map +1 -0
  30. package/build/src/commands/rollback.d.ts +6 -0
  31. package/build/src/commands/rollback.d.ts.map +1 -0
  32. package/build/src/commands/rollback.js +12 -0
  33. package/build/src/commands/rollback.js.map +1 -0
  34. package/build/src/commands/rollbridge.d.ts +21 -0
  35. package/build/src/commands/rollbridge.d.ts.map +1 -0
  36. package/build/src/commands/rollbridge.js +69 -0
  37. package/build/src/commands/rollbridge.js.map +1 -0
  38. package/build/src/commands/validate.d.ts +6 -0
  39. package/build/src/commands/validate.d.ts.map +1 -0
  40. package/build/src/commands/validate.js +12 -0
  41. package/build/src/commands/validate.js.map +1 -0
  42. package/build/src/config/load-config.d.ts +10 -0
  43. package/build/src/config/load-config.d.ts.map +1 -0
  44. package/build/src/config/load-config.js +71 -0
  45. package/build/src/config/load-config.js.map +1 -0
  46. package/build/src/config/validate-config.d.ts +7 -0
  47. package/build/src/config/validate-config.d.ts.map +1 -0
  48. package/build/src/config/validate-config.js +117 -0
  49. package/build/src/config/validate-config.js.map +1 -0
  50. package/build/src/core/deploy-runner.d.ts +46 -0
  51. package/build/src/core/deploy-runner.d.ts.map +1 -0
  52. package/build/src/core/deploy-runner.js +221 -0
  53. package/build/src/core/deploy-runner.js.map +1 -0
  54. package/build/src/core/expo-web-artifacts.d.ts +10 -0
  55. package/build/src/core/expo-web-artifacts.d.ts.map +1 -0
  56. package/build/src/core/expo-web-artifacts.js +16 -0
  57. package/build/src/core/expo-web-artifacts.js.map +1 -0
  58. package/build/src/core/git-source.d.ts +22 -0
  59. package/build/src/core/git-source.d.ts.map +1 -0
  60. package/build/src/core/git-source.js +63 -0
  61. package/build/src/core/git-source.js.map +1 -0
  62. package/build/src/core/health-checks.d.ts +8 -0
  63. package/build/src/core/health-checks.d.ts.map +1 -0
  64. package/build/src/core/health-checks.js +19 -0
  65. package/build/src/core/health-checks.js.map +1 -0
  66. package/build/src/core/hooks.d.ts +12 -0
  67. package/build/src/core/hooks.d.ts.map +1 -0
  68. package/build/src/core/hooks.js +26 -0
  69. package/build/src/core/hooks.js.map +1 -0
  70. package/build/src/core/locks.d.ts +16 -0
  71. package/build/src/core/locks.d.ts.map +1 -0
  72. package/build/src/core/locks.js +32 -0
  73. package/build/src/core/locks.js.map +1 -0
  74. package/build/src/core/node-package-tasks.d.ts +26 -0
  75. package/build/src/core/node-package-tasks.d.ts.map +1 -0
  76. package/build/src/core/node-package-tasks.js +143 -0
  77. package/build/src/core/node-package-tasks.js.map +1 -0
  78. package/build/src/core/path-change-gate.d.ts +15 -0
  79. package/build/src/core/path-change-gate.d.ts.map +1 -0
  80. package/build/src/core/path-change-gate.js +95 -0
  81. package/build/src/core/path-change-gate.js.map +1 -0
  82. package/build/src/core/paths.d.ts +7 -0
  83. package/build/src/core/paths.d.ts.map +1 -0
  84. package/build/src/core/paths.js +20 -0
  85. package/build/src/core/paths.js.map +1 -0
  86. package/build/src/core/redaction.d.ts +22 -0
  87. package/build/src/core/redaction.d.ts.map +1 -0
  88. package/build/src/core/redaction.js +39 -0
  89. package/build/src/core/redaction.js.map +1 -0
  90. package/build/src/core/release-id.d.ts +6 -0
  91. package/build/src/core/release-id.d.ts.map +1 -0
  92. package/build/src/core/release-id.js +20 -0
  93. package/build/src/core/release-id.js.map +1 -0
  94. package/build/src/core/release-manager.d.ts +49 -0
  95. package/build/src/core/release-manager.d.ts.map +1 -0
  96. package/build/src/core/release-manager.js +115 -0
  97. package/build/src/core/release-manager.js.map +1 -0
  98. package/build/src/core/task-runner.d.ts +38 -0
  99. package/build/src/core/task-runner.d.ts.map +1 -0
  100. package/build/src/core/task-runner.js +102 -0
  101. package/build/src/core/task-runner.js.map +1 -0
  102. package/build/src/core/velocious-migrate.d.ts +11 -0
  103. package/build/src/core/velocious-migrate.d.ts.map +1 -0
  104. package/build/src/core/velocious-migrate.js +20 -0
  105. package/build/src/core/velocious-migrate.js.map +1 -0
  106. package/build/src/runtimes/index.d.ts +56 -0
  107. package/build/src/runtimes/index.d.ts.map +1 -0
  108. package/build/src/runtimes/index.js +132 -0
  109. package/build/src/runtimes/index.js.map +1 -0
  110. package/build/src/runtimes/none-runtime.d.ts +22 -0
  111. package/build/src/runtimes/none-runtime.d.ts.map +1 -0
  112. package/build/src/runtimes/none-runtime.js +23 -0
  113. package/build/src/runtimes/none-runtime.js.map +1 -0
  114. package/build/src/runtimes/rollbridge-runtime.d.ts +137 -0
  115. package/build/src/runtimes/rollbridge-runtime.d.ts.map +1 -0
  116. package/build/src/runtimes/rollbridge-runtime.js +224 -0
  117. package/build/src/runtimes/rollbridge-runtime.js.map +1 -0
  118. package/build/src/tasks.d.ts +5 -0
  119. package/build/src/tasks.d.ts.map +1 -0
  120. package/build/src/tasks.js +5 -0
  121. package/build/src/tasks.js.map +1 -0
  122. package/build/src/test-helpers.d.ts +25 -0
  123. package/build/src/test-helpers.d.ts.map +1 -0
  124. package/build/src/test-helpers.js +40 -0
  125. package/build/src/test-helpers.js.map +1 -0
  126. package/build/src/transports/local-transport.d.ts +67 -0
  127. package/build/src/transports/local-transport.d.ts.map +1 -0
  128. package/build/src/transports/local-transport.js +121 -0
  129. package/build/src/transports/local-transport.js.map +1 -0
  130. package/build/src/transports/ssh-transport.d.ts +189 -0
  131. package/build/src/transports/ssh-transport.d.ts.map +1 -0
  132. package/build/src/transports/ssh-transport.js +369 -0
  133. package/build/src/transports/ssh-transport.js.map +1 -0
  134. package/build/src/types.d.ts +290 -0
  135. package/build/src/types.d.ts.map +1 -0
  136. package/build/src/types.js +8 -0
  137. package/build/src/types.js.map +1 -0
  138. package/docs/config-reference.md +264 -0
  139. package/docs/migration-from-capistrano.md +167 -0
  140. package/docs/roadmap.md +27 -0
  141. package/examples/local/rampway.config.mjs +20 -0
  142. package/examples/monorepo/rampway.config.mjs +73 -0
  143. package/package.json +92 -0
@@ -0,0 +1,91 @@
1
+ import { commandContext as defaultCommandContext } from "./context.js";
2
+ import { listReleases, currentReleaseId } from "../core/release-manager.js";
3
+ import { deployPaths } from "../core/paths.js";
4
+ /**
5
+ * @param {import('#types').CommandArgs} args
6
+ * @returns {Promise<void>}
7
+ */
8
+ export async function releasesCommand({ stageName, options, commandContext = defaultCommandContext }) {
9
+ const { stage, transport } = await commandContext(options, stageName);
10
+ const report = await releasesReport({ stage, transport });
11
+ if (options.json) {
12
+ console.log(JSON.stringify(report, null, 2));
13
+ return;
14
+ }
15
+ console.log(`Application: ${report.application}`);
16
+ console.log(`Stage: ${report.stage}`);
17
+ console.log(`Current: ${report.current ?? "none"}`);
18
+ console.log(`Releases path: ${report.paths.releases}`);
19
+ console.log(`Release count: ${report.releaseCount}`);
20
+ console.log("");
21
+ for (const release of report.releases)
22
+ console.log(`${release}${release === report.current ? " current" : ""}`);
23
+ }
24
+ /**
25
+ * @param {{stage: import('#types').StageConfig, transport: import('#types').Transport}} opts
26
+ * @returns {Promise<import('#types').ReleasesReport>}
27
+ */
28
+ export async function releasesReport({ stage, transport }) {
29
+ const paths = deployPaths(stage);
30
+ const releases = await listReleases(transport, stage);
31
+ const current = await currentReleaseId(transport, stage);
32
+ return {
33
+ application: stage.application,
34
+ stage: stage.stageName,
35
+ current,
36
+ releases,
37
+ releaseCount: releases.length,
38
+ paths: {
39
+ releases: paths.releasesPath,
40
+ current: paths.currentPath
41
+ }
42
+ };
43
+ }
44
+ /**
45
+ * @param {import('#types').CommandArgs} args
46
+ * @returns {Promise<void>}
47
+ */
48
+ export async function statusCommand({ stageName, options, commandContext = defaultCommandContext }) {
49
+ const { stage, transport } = await commandContext(options, stageName);
50
+ const report = await statusReport({ stage, transport });
51
+ if (options.json) {
52
+ console.log(JSON.stringify(report, null, 2));
53
+ return;
54
+ }
55
+ console.log(`Application: ${report.application}`);
56
+ console.log(`Stage: ${report.stage}`);
57
+ console.log(`Current: ${report.current ?? "none"}`);
58
+ console.log(`Latest release: ${report.latestRelease ?? "none"}`);
59
+ console.log(`Release count: ${report.releaseCount}`);
60
+ console.log(`Deploy path: ${report.deployTo}`);
61
+ console.log(`Current path: ${report.paths.current}`);
62
+ console.log(`Shared path: ${report.paths.shared}`);
63
+ console.log(`Lock path: ${report.paths.lock}`);
64
+ console.log(`Runtime: ${report.runtime.type}`);
65
+ }
66
+ /**
67
+ * @param {{stage: import('#types').StageConfig, transport: import('#types').Transport}} opts
68
+ * @returns {Promise<import('#types').StatusReport>}
69
+ */
70
+ export async function statusReport({ stage, transport }) {
71
+ const paths = deployPaths(stage);
72
+ const releases = await listReleases(transport, stage);
73
+ const current = await currentReleaseId(transport, stage);
74
+ return {
75
+ application: stage.application,
76
+ stage: stage.stageName,
77
+ deployTo: stage.deployTo,
78
+ current,
79
+ releases,
80
+ releaseCount: releases.length,
81
+ latestRelease: releases.at(-1),
82
+ paths: {
83
+ current: paths.currentPath,
84
+ releases: paths.releasesPath,
85
+ shared: paths.sharedPath,
86
+ lock: paths.lockPath
87
+ },
88
+ runtime: { type: stage.runtime.type }
89
+ };
90
+ }
91
+ //# sourceMappingURL=releases.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"releases.js","sourceRoot":"","sources":["../../../src/commands/releases.js"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,IAAI,qBAAqB,EAAC,MAAM,cAAc,CAAA;AACpE,OAAO,EAAC,YAAY,EAAE,gBAAgB,EAAC,MAAM,4BAA4B,CAAA;AACzE,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAA;AAE5C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EAAC,SAAS,EAAE,OAAO,EAAE,cAAc,GAAG,qBAAqB,EAAC;IAChG,MAAM,EAAC,KAAK,EAAE,SAAS,EAAC,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IACnE,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC,CAAA;IACvD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;QAC5C,OAAM;IACR,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,gBAAgB,MAAM,CAAC,WAAW,EAAE,CAAC,CAAA;IACjD,OAAO,CAAC,GAAG,CAAC,UAAU,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;IACrC,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,OAAO,IAAI,MAAM,EAAE,CAAC,CAAA;IACnD,OAAO,CAAC,GAAG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MAAM,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;IACxD,OAAO;QACL,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,KAAK,EAAE,KAAK,CAAC,SAAS;QACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,OAAO;QACP,QAAQ;QACR,YAAY,EAAE,QAAQ,CAAC,MAAM;QAC7B,aAAa,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9B,KAAK,EAAE;YACL,OAAO,EAAE,KAAK,CAAC,WAAW;YAC1B,QAAQ,EAAE,KAAK,CAAC,YAAY;YAC5B,MAAM,EAAE,KAAK,CAAC,UAAU;YACxB,IAAI,EAAE,KAAK,CAAC,QAAQ;SACrB;QACD,OAAO,EAAE,EAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,EAAC;KACpC,CAAA;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @param {import('#types').CommandArgs} args
3
+ * @returns {Promise<void>}
4
+ */
5
+ export function rollbackCommand({ stageName, options }: import("#types").CommandArgs): Promise<void>;
6
+ //# sourceMappingURL=rollback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollback.d.ts","sourceRoot":"","sources":["../../../src/commands/rollback.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wDAHW,OAAO,QAAQ,EAAE,WAAW,GAC1B,OAAO,CAAC,IAAI,CAAC,CAMzB"}
@@ -0,0 +1,12 @@
1
+ import { commandContext } from "./context.js";
2
+ import { rollback } from "../core/deploy-runner.js";
3
+ /**
4
+ * @param {import('#types').CommandArgs} args
5
+ * @returns {Promise<void>}
6
+ */
7
+ export async function rollbackCommand({ stageName, options }) {
8
+ const { stage, transport } = await commandContext(options, stageName);
9
+ const report = await rollback({ transport, stage, to: options.to });
10
+ console.log(JSON.stringify(report, null, 2));
11
+ }
12
+ //# sourceMappingURL=rollback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollback.js","sourceRoot":"","sources":["../../../src/commands/rollback.js"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAA;AAEjD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EAAC,SAAS,EAAE,OAAO,EAAC;IACxD,MAAM,EAAC,KAAK,EAAE,SAAS,EAAC,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IACnE,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,EAAC,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAC,CAAC,CAAA;IACjE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;AAC9C,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @param {import('#types').CommandArgs} args
3
+ * @returns {Promise<void>}
4
+ */
5
+ export function rollbridgeValidateCommand({ stageName, options, commandContext }: import("#types").CommandArgs): Promise<void>;
6
+ /**
7
+ * @param {import('#types').CommandArgs} args
8
+ * @returns {Promise<void>}
9
+ */
10
+ export function rollbridgeStatusCommand({ stageName, options, commandContext }: import("#types").CommandArgs): Promise<void>;
11
+ /**
12
+ * @param {import('#types').CommandArgs} args
13
+ * @returns {Promise<void>}
14
+ */
15
+ export function rollbridgeLogsCommand({ stageName, options, commandContext }: import("#types").CommandArgs): Promise<void>;
16
+ /**
17
+ * @param {import('#types').CommandArgs} args
18
+ * @returns {Promise<void>}
19
+ */
20
+ export function rollbridgeRecoverCommand({ stageName, options, commandContext }: import("#types").CommandArgs): Promise<void>;
21
+ //# sourceMappingURL=rollbridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollbridge.d.ts","sourceRoot":"","sources":["../../../src/commands/rollbridge.js"],"names":[],"mappings":"AAKA;;;GAGG;AACH,kFAHW,OAAO,QAAQ,EAAE,WAAW,GAC1B,OAAO,CAAC,IAAI,CAAC,CAIzB;AAED;;;GAGG;AACH,gFAHW,OAAO,QAAQ,EAAE,WAAW,GAC1B,OAAO,CAAC,IAAI,CAAC,CAIzB;AAED;;;GAGG;AACH,8EAHW,OAAO,QAAQ,EAAE,WAAW,GAC1B,OAAO,CAAC,IAAI,CAAC,CAIzB;AAED;;;GAGG;AACH,iFAHW,OAAO,QAAQ,EAAE,WAAW,GAC1B,OAAO,CAAC,IAAI,CAAC,CAKzB"}
@@ -0,0 +1,69 @@
1
+ import path from "node:path";
2
+ import { commandContext as defaultCommandContext } from "./context.js";
3
+ import { runtimeFor } from "../runtimes/index.js";
4
+ import { deployPaths } from "../core/paths.js";
5
+ /**
6
+ * @param {import('#types').CommandArgs} args
7
+ * @returns {Promise<void>}
8
+ */
9
+ export async function rollbridgeValidateCommand({ stageName, options, commandContext = defaultRuntimeCommandContext }) {
10
+ await runRollbridgeCommand({ stageName, options, commandContext, method: "validate" });
11
+ }
12
+ /**
13
+ * @param {import('#types').CommandArgs} args
14
+ * @returns {Promise<void>}
15
+ */
16
+ export async function rollbridgeStatusCommand({ stageName, options, commandContext = defaultRuntimeCommandContext }) {
17
+ await runRollbridgeCommand({ stageName, options, commandContext, method: "status" });
18
+ }
19
+ /**
20
+ * @param {import('#types').CommandArgs} args
21
+ * @returns {Promise<void>}
22
+ */
23
+ export async function rollbridgeLogsCommand({ stageName, options, commandContext = defaultRuntimeCommandContext }) {
24
+ await runRollbridgeCommand({ stageName, options, commandContext, method: "logs" });
25
+ }
26
+ /**
27
+ * @param {import('#types').CommandArgs} args
28
+ * @returns {Promise<void>}
29
+ */
30
+ export async function rollbridgeRecoverCommand({ stageName, options, commandContext = defaultRuntimeCommandContext }) {
31
+ if (!options.yes && stageName === "production")
32
+ throw new Error("Refusing production Rollbridge recover without --yes in non-interactive MVP mode.");
33
+ await runRollbridgeCommand({ stageName, options, commandContext, method: "recover", runtimeOptions: { force: true } });
34
+ }
35
+ /**
36
+ * @param {import('#types').CommandOptions} options
37
+ * @param {string} stageName
38
+ * @returns {Promise<{config: object, configPath: string, stage: import('#types').StageConfig, transport: import('#types').Transport, runtime: import('#types').RuntimeAdapter}>}
39
+ */
40
+ async function defaultRuntimeCommandContext(options, stageName) {
41
+ const context = await defaultCommandContext(options, stageName);
42
+ return { ...context, runtime: runtimeFor(context.stage) };
43
+ }
44
+ /**
45
+ * @param {{stageName: string, options: import('#types').CommandOptions, commandContext: Function, method: string, runtimeOptions?: object}} opts
46
+ * @returns {Promise<void>}
47
+ */
48
+ async function runRollbridgeCommand({ stageName, options, commandContext, method, runtimeOptions = {} }) {
49
+ const { stage, transport, runtime } = await commandContext(options, stageName);
50
+ if (stage.runtime.type !== "rollbridge")
51
+ throw new Error(`Stage '${stageName}' does not use the Rollbridge runtime.`);
52
+ const releasePath = pathForRollbridgeCommand(stage, options);
53
+ const result = await runtime[method](transport, { releasePath, ...runtimeOptions });
54
+ if (result?.output)
55
+ process.stdout.write(result.output);
56
+ }
57
+ /**
58
+ * @param {import('#types').StageConfig} stage
59
+ * @param {import('#types').CommandOptions} options
60
+ * @returns {string}
61
+ */
62
+ function pathForRollbridgeCommand(stage, options) {
63
+ if (options.releasePath)
64
+ return options.releasePath;
65
+ if (options.releaseId)
66
+ return path.join(deployPaths(stage).releasesPath, options.releaseId);
67
+ return deployPaths(stage).currentPath;
68
+ }
69
+ //# sourceMappingURL=rollbridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollbridge.js","sourceRoot":"","sources":["../../../src/commands/rollbridge.js"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAC,cAAc,IAAI,qBAAqB,EAAC,MAAM,cAAc,CAAA;AACpE,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAA;AAE5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,EAAC,GAAG,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAC,CAAA;AACzD,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,oBAAoB,CAAC,EAAC,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,GAAG,EAAE,EAAC;IACnG,MAAM,EAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAC,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IAC5E,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,YAAY;QAAE,MAAM,IAAI,KAAK,CAAC,UAAU,SAAS,wCAAwC,CAAC,CAAA;IAErH,MAAM,WAAW,GAAG,wBAAwB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAC5D,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAC,WAAW,EAAE,GAAG,cAAc,EAAC,CAAC,CAAA;IACjF,IAAI,MAAM,EAAE,MAAM;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AACzD,CAAC;AAED;;;;GAIG;AACH,SAAS,wBAAwB,CAAC,KAAK,EAAE,OAAO;IAC9C,IAAI,OAAO,CAAC,WAAW;QAAE,OAAO,OAAO,CAAC,WAAW,CAAA;IACnD,IAAI,OAAO,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;IAC3F,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,WAAW,CAAA;AACvC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @param {import('#types').CommandArgs} args
3
+ * @returns {Promise<void>}
4
+ */
5
+ export function validateCommand({ stageName, options }: import("#types").CommandArgs): Promise<void>;
6
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/commands/validate.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wDAHW,OAAO,QAAQ,EAAE,WAAW,GAC1B,OAAO,CAAC,IAAI,CAAC,CAOzB"}
@@ -0,0 +1,12 @@
1
+ import { commandContext } from "./context.js";
2
+ /**
3
+ * @param {import('#types').CommandArgs} args
4
+ * @returns {Promise<void>}
5
+ */
6
+ export async function validateCommand({ stageName, options }) {
7
+ const { configPath, stage } = await commandContext(options, stageName);
8
+ console.log(`Valid Rampway config: ${configPath}`);
9
+ console.log(`Application: ${stage.application}`);
10
+ console.log(`Stage: ${stage.stageName}`);
11
+ }
12
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/commands/validate.js"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAA;AAE3C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EAAC,SAAS,EAAE,OAAO,EAAC;IACxD,MAAM,EAAC,UAAU,EAAE,KAAK,EAAC,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IACpE,OAAO,CAAC,GAAG,CAAC,yBAAyB,UAAU,EAAE,CAAC,CAAA;IAClD,OAAO,CAAC,GAAG,CAAC,gBAAgB,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;IAChD,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,CAAC,SAAS,EAAE,CAAC,CAAA;AAC1C,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @param {string|undefined} configPath
3
+ * @param {string} stageName
4
+ * @returns {Promise<{config: object, configPath: string}>}
5
+ */
6
+ export function loadConfig(configPath: string | undefined, stageName: string): Promise<{
7
+ config: object;
8
+ configPath: string;
9
+ }>;
10
+ //# sourceMappingURL=load-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-config.d.ts","sourceRoot":"","sources":["../../../src/config/load-config.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH,uCAJW,MAAM,GAAC,SAAS,aAChB,MAAM,GACJ,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CAAC,CAuBzD"}
@@ -0,0 +1,71 @@
1
+ import { pathToFileURL } from "node:url";
2
+ import path from "node:path";
3
+ import fs from "node:fs";
4
+ /**
5
+ * @returns {string}
6
+ */
7
+ function resolveDeployDir() {
8
+ let dir = process.cwd();
9
+ for (let i = 0; i < 5; i++) {
10
+ const candidate = path.join(dir, "deploy", "config.js");
11
+ if (fs.existsSync(candidate))
12
+ return path.join(dir, "deploy");
13
+ const parent = path.dirname(dir);
14
+ if (parent === dir)
15
+ break;
16
+ dir = parent;
17
+ }
18
+ throw new Error(`No --config given and deploy/config.js not found from ${process.cwd()}. Run 'rampway init' or create deploy/config.js.`);
19
+ }
20
+ /**
21
+ * @param {string|undefined} configPath
22
+ * @param {string} stageName
23
+ * @returns {Promise<{config: object, configPath: string}>}
24
+ */
25
+ export async function loadConfig(configPath, stageName) {
26
+ if (configPath) {
27
+ const resolvedPath = path.resolve(configPath);
28
+ return await loadFile(resolvedPath);
29
+ }
30
+ const deployDir = resolveDeployDir();
31
+ const resolvedPath = path.join(deployDir, "config.js");
32
+ const sharedConfig = await loadFile(resolvedPath);
33
+ // Capistrano-style: stage configs live in deploy/environments/<stage>.js
34
+ const stageFile = path.join(deployDir, "environments", `${stageName}.js`);
35
+ let stageOverrides = /** @type {Record<string, unknown>} */ ({});
36
+ if (fs.existsSync(stageFile)) {
37
+ const stageModule = await loadFile(stageFile);
38
+ stageOverrides = /** @type {Record<string, unknown>} */ (stageModule.config);
39
+ }
40
+ const config = mergeConfigs(/** @type {Record<string, unknown>} */ (sharedConfig.config), stageOverrides, stageName);
41
+ return { config, configPath: resolvedPath };
42
+ }
43
+ /**
44
+ * @param {string} filePath
45
+ * @returns {Promise<import('#types').ConfigModule>}
46
+ */
47
+ async function loadFile(filePath) {
48
+ const moduleUrl = pathToFileURL(filePath).href + `?rampwayLoad=${Date.now()}`;
49
+ // Dynamic import boundary – module shape is validated at runtime below.
50
+ const raw = await import(moduleUrl);
51
+ const module = /** @type {{default: Record<string, unknown>}} */ (raw);
52
+ if (!module.default || typeof module.default !== "object") {
53
+ throw new Error(`Config ${filePath} must default-export an object.`);
54
+ }
55
+ return { config: module.default, configPath: filePath };
56
+ }
57
+ /**
58
+ * @param {Record<string, unknown>} shared
59
+ * @param {Record<string, unknown>} stage
60
+ * @param {string} stageName
61
+ * @returns {object}
62
+ */
63
+ function mergeConfigs(shared, stage, stageName) {
64
+ // Stage file overrides specific keys from shared config.
65
+ // The entire merged object (shared + stage overrides) becomes stages.<stageName>.
66
+ const stageConfig = { ...shared, ...stage };
67
+ const merged = { ...shared };
68
+ merged.stages = { [stageName]: stageConfig };
69
+ return merged;
70
+ }
71
+ //# sourceMappingURL=load-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-config.js","sourceRoot":"","sources":["../../../src/config/load-config.js"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAA;AACtC,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,MAAM,SAAS,CAAA;AAExB;;GAEG;AACH,SAAS,gBAAgB;IACvB,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;IACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;QACvD,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,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AY,EAAC,CAAA;AAC3C,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,QAAQ,CAAC,QAAQ;IAC9B,MAAM,SAAS,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC,IAAI,GAAG,gBAAgB,IAAI,CAAC,GAAG,EAAE,EAAE,CAAA;IAC7E,wEAAwE;IACxE,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAA;IACnC,MAAM,MAAM,GAAG,iDAAiD,CAAC,CAAC,GAAG,CAAC,CAAA;IACtE,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,UAAU,QAAQ,iCAAiC,CAAC,CAAA;IACtE,CAAC;IACD,OAAO,EAAC,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAC,CAAA;AACvD,CAAC;AAED;;;;;GAKG;AACH,SAAS,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS;IAC5C,yDAAyD;IACzD,kFAAkF;IAClF,MAAM,WAAW,GAAG,EAAC,GAAG,MAAM,EAAE,GAAG,KAAK,EAAC,CAAA;IACzC,MAAM,MAAM,GAAG,EAAC,GAAG,MAAM,EAAC,CAAA;IAC1B,MAAM,CAAC,MAAM,GAAG,EAAC,CAAC,SAAS,CAAC,EAAE,WAAW,EAAC,CAAA;IAC1C,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @param {Record<string, unknown>} config
3
+ * @param {string} stageName
4
+ * @returns {import('#types').StageConfig}
5
+ */
6
+ export function validateConfig(config: Record<string, unknown>, stageName: string): import("#types").StageConfig;
7
+ //# sourceMappingURL=validate-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-config.d.ts","sourceRoot":"","sources":["../../../src/config/validate-config.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,uCAJW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,aACvB,MAAM,GACJ,OAAO,QAAQ,EAAE,WAAW,CAcxC"}
@@ -0,0 +1,117 @@
1
+ import { runtimeTypeNames } from "../runtimes/index.js";
2
+ import { isGitRevision } from "../core/git-source.js";
3
+ const SUPPORTED_TRANSPORTS = new Set(["local", "ssh"]);
4
+ const SUPPORTED_STRATEGIES = new Set(["local-copy", "remote-git", "archive-upload"]);
5
+ /**
6
+ * @param {Record<string, unknown>} config
7
+ * @param {string} stageName
8
+ * @returns {import('#types').StageConfig}
9
+ */
10
+ export function validateConfig(config, stageName) {
11
+ const errors = [];
12
+ if (!config.application || typeof config.application !== "string")
13
+ errors.push("application must be a non-empty string");
14
+ if (!config.stages || typeof config.stages !== "object")
15
+ errors.push("stages must be an object");
16
+ const stages = config.stages && typeof config.stages === "object"
17
+ ? /** @type {Record<string, Record<string, unknown>>} */ (config.stages)
18
+ : {};
19
+ const stage = stages[stageName];
20
+ if (!stage)
21
+ errors.push(`stage '${stageName}' does not exist`);
22
+ if (stage)
23
+ validateStage(stage, errors);
24
+ if (errors.length)
25
+ throw new Error(`Invalid Rampway config:\n- ${errors.join("\n- ")}`);
26
+ return normalizedStage(config, stageName);
27
+ }
28
+ /**
29
+ * @param {Record<string, unknown>} stage
30
+ * @param {string[]} errors
31
+ * @returns {void}
32
+ */
33
+ function validateStage(stage, errors) {
34
+ if (!stage.deployTo || typeof stage.deployTo !== "string")
35
+ errors.push("stage.deployTo must be a non-empty string");
36
+ const transportCfg = /** @type {{type?: string}|string|undefined} */ (stage.transport);
37
+ const transportType = String(typeof transportCfg === "string" ? transportCfg : (transportCfg?.type ?? "ssh"));
38
+ if (!SUPPORTED_TRANSPORTS.has(transportType))
39
+ errors.push(`stage.transport.type must be one of ${Array.from(SUPPORTED_TRANSPORTS).join(", ")}`);
40
+ const strategy = String(stage.strategy ?? (transportType === "local" ? "local-copy" : "remote-git"));
41
+ if (!SUPPORTED_STRATEGIES.has(strategy))
42
+ errors.push(`stage.strategy must be one of ${Array.from(SUPPORTED_STRATEGIES).join(", ")}`);
43
+ if (strategy !== "local-copy" && (!stage.repo || typeof stage.repo !== "string"))
44
+ errors.push("stage.repo must be a non-empty string unless strategy is local-copy");
45
+ if (stage.branch != null && (typeof stage.branch !== "string" || !stage.branch))
46
+ errors.push("stage.branch must be a non-empty string when provided");
47
+ if (stage.revision != null && !isGitRevision(String(stage.revision)))
48
+ errors.push("stage.revision must be a Git commit SHA when provided");
49
+ if (stage.hosts && !Array.isArray(stage.hosts))
50
+ errors.push("stage.hosts must be an array");
51
+ if (transportType === "ssh" && !primarySshHost(stage))
52
+ errors.push("stage.transport.host or stage.hosts[0].host is required for ssh transport");
53
+ if (stage.linkedFiles && !Array.isArray(stage.linkedFiles))
54
+ errors.push("stage.linkedFiles must be an array");
55
+ if (stage.linkedDirs && !Array.isArray(stage.linkedDirs))
56
+ errors.push("stage.linkedDirs must be an array");
57
+ if (stage.tasks && typeof stage.tasks !== "object")
58
+ errors.push("stage.tasks must be an object");
59
+ const runtimeType = String(/** @type {{type?: string}|undefined} */ (stage.runtime)?.type ?? (stage.rollbridge ? "rollbridge" : "none"));
60
+ const supportedRuntimes = runtimeTypeNames();
61
+ if (!supportedRuntimes.includes(runtimeType))
62
+ errors.push(`stage.runtime.type must be one of ${supportedRuntimes.join(", ")}`);
63
+ }
64
+ /**
65
+ * @param {Record<string, unknown>} config
66
+ * @param {string} stageName
67
+ * @returns {import('#types').StageConfig}
68
+ */
69
+ function normalizedStage(config, stageName) {
70
+ const stages = /** @type {Record<string, Record<string, unknown>>} */ (config.stages);
71
+ const stage = stages[stageName];
72
+ const transportCfg2 = /** @type {{type?: string}|string|undefined} */ (stage.transport);
73
+ const transportType = String(typeof transportCfg2 === "string" ? transportCfg2 : (transportCfg2?.type ?? "ssh"));
74
+ const transportObj = /** @type {Record<string, unknown>} */ (typeof stage.transport === "string" ? { type: String(stage.transport) } : { type: transportType, ...( /** @type {Record<string, unknown>} */(stage.transport ?? {})) });
75
+ if (transportType === "ssh" && !transportObj.host && primarySshHost(stage)) {
76
+ const hostsArr = /** @type {Array<Record<string, unknown>>} */ (stage.hosts);
77
+ Object.assign(transportObj, hostsArr[0]);
78
+ }
79
+ const rollbridgeObj = /** @type {Record<string, unknown>|undefined} */ (stage.rollbridge);
80
+ /** @type {import('#types').TransportConfig} */
81
+ const transport = /** @type {import('#types').TransportConfig} */ (transportObj);
82
+ return {
83
+ application: String(config.application),
84
+ stageName,
85
+ repo: /** @type {string|undefined} */ (stage.repo),
86
+ branch: String(stage.branch ?? "master"),
87
+ revision: /** @type {string|undefined} */ (stage.revision),
88
+ deployTo: String(stage.deployTo),
89
+ strategy: /** @type {"local-copy"|"remote-git"|"archive-upload"} */ (stage.strategy ?? (transportType === "local" ? "local-copy" : "remote-git")),
90
+ transport,
91
+ hosts: /** @type {Array<{host: string, user?: string, port?: number, roles?: string[]}>} */ (stage.hosts ?? []),
92
+ keepReleases: Number(stage.keepReleases ?? 5),
93
+ linkedFiles: normalizeLinkedEntries(/** @type {Array<string|{path: string, required?: boolean}>} */ (stage.linkedFiles ?? [])),
94
+ linkedDirs: normalizeLinkedEntries(/** @type {Array<string|{path: string, required?: boolean}>} */ (stage.linkedDirs ?? [])),
95
+ tasks: /** @type {Record<string, import('#types').TaskEntry[]>} */ (stage.tasks ?? {}),
96
+ hooks: /** @type {Record<string, import('#types').TaskEntry[]>} */ (stage.hooks ?? {}),
97
+ healthChecks: /** @type {import('#types').HealthCheckEntry[]} */ (stage.healthChecks ?? []),
98
+ runtime: /** @type {import('#types').RuntimeConfig} */ (stage.runtime ?? (rollbridgeObj ? { type: "rollbridge", ...rollbridgeObj } : { type: "none" }))
99
+ };
100
+ }
101
+ /**
102
+ * @param {Array<string|{path: string, required?: boolean}>} entries
103
+ * @returns {import('#types').LinkedEntry[]}
104
+ */
105
+ function normalizeLinkedEntries(entries) {
106
+ return entries.map(entry => typeof entry === "string" ? { path: entry, required: true } : { required: entry.required ?? true, ...entry });
107
+ }
108
+ /**
109
+ * @param {Record<string, unknown>} stage
110
+ * @returns {string|undefined}
111
+ */
112
+ function primarySshHost(stage) {
113
+ const transportHost = /** @type {{host?: string}|undefined} */ (stage.transport);
114
+ const hostsArr = /** @type {Array<{host?: string}>|undefined} */ (stage.hosts);
115
+ return transportHost?.host ?? (Array.isArray(hostsArr) ? hostsArr[0]?.host : undefined);
116
+ }
117
+ //# sourceMappingURL=validate-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-config.js","sourceRoot":"","sources":["../../../src/config/validate-config.js"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAA;AAEnD,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;AACtD,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC,CAAA;AAEpF;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,MAAM,EAAE,SAAS;IAC9C,MAAM,MAAM,GAAG,EAAE,CAAA;IACjB,IAAI,CAAC,MAAM,CAAC,WAAW,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ;QAAE,MAAM,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAA;IACxH,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ;QAAE,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAA;IAChG,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ;QAC/D,CAAC,CAAC,sDAAsD,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;QACxE,CAAC,CAAC,EAAE,CAAA;IACN,MAAM,KAAK,GAA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AAC;QACtF,KAAK,EAAE,2DAA2D,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;QACtF,YAAY,EAAE,kDAAkD,CAAC,CAAC,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC;QAC3F,OAAO,EAAE,6CAA6C,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,YAAY,EAAE,GAAG,aAAa,EAAC,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC,CAAC;KACpJ,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,sBAAsB,CAAC,OAAO;IACrC,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC,EAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,IAAI,EAAE,GAAG,KAAK,EAAC,CAAC,CAAA;AACvI,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc,CAAC,KAAK;IAC3B,MAAM,aAAa,GAAG,wCAAwC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IAChF,MAAM,QAAQ,GAAG,+CAA+C,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAC9E,OAAO,aAAa,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;AACzF,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @param {import('#types').StageConfig} stage
3
+ * @param {{revision?: string, releaseId?: string}} [opts]
4
+ * @returns {string[]}
5
+ */
6
+ export function createDeployPlan(stage: import("#types").StageConfig, { revision, releaseId }?: {
7
+ revision?: string;
8
+ releaseId?: string;
9
+ }): string[];
10
+ /**
11
+ * @param {import('#types').StageConfig} stage
12
+ * @param {{revision?: string, releaseId?: string}} [opts]
13
+ * @returns {import('#types').DeployPlanStep[]}
14
+ */
15
+ export function createDeployPlanDetails(stage: import("#types").StageConfig, { revision, releaseId }?: {
16
+ revision?: string;
17
+ releaseId?: string;
18
+ }): import("#types").DeployPlanStep[];
19
+ /**
20
+ * @param {import('#types').DeployOptions} opts
21
+ * @returns {Promise<import('#types').DeployReport|{plan: string[]}>}
22
+ */
23
+ export function deploy({ transport, stage, sourcePath, revision, branch, dryRun, releaseId, force }: import("#types").DeployOptions): Promise<import("#types").DeployReport | {
24
+ plan: string[];
25
+ }>;
26
+ /**
27
+ * @param {{transport: import('#types').Transport, stage: import('#types').StageConfig, to?: string}} opts
28
+ * @returns {Promise<import('#types').RollbackReport>}
29
+ */
30
+ export function rollback({ transport, stage, to }: {
31
+ transport: import("#types").Transport;
32
+ stage: import("#types").StageConfig;
33
+ to?: string;
34
+ }): Promise<import("#types").RollbackReport>;
35
+ /**
36
+ * @param {{error: Error, published: boolean, releaseCreated?: boolean, stage: import('#types').StageConfig, releaseId: string}} opts
37
+ * @returns {string}
38
+ */
39
+ export function deployFailureMessage({ error, published, releaseCreated, stage, releaseId }: {
40
+ error: Error;
41
+ published: boolean;
42
+ releaseCreated?: boolean;
43
+ stage: import("#types").StageConfig;
44
+ releaseId: string;
45
+ }): string;
46
+ //# sourceMappingURL=deploy-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-runner.d.ts","sourceRoot":"","sources":["../../../src/core/deploy-runner.js"],"names":[],"mappings":"AAcA;;;;GAIG;AACH,wCAJW,OAAO,QAAQ,EAAE,WAAW,4BAC5B;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAC,GACrC,MAAM,EAAE,CAIpB;AAED;;;;GAIG;AACH,+CAJW,OAAO,QAAQ,EAAE,WAAW,4BAC5B;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAC,GACrC,OAAO,QAAQ,EAAE,cAAc,EAAE,CAkB7C;AAaD;;;GAGG;AACH,qGAHW,OAAO,QAAQ,EAAE,aAAa,GAC5B,OAAO,CAAC,OAAO,QAAQ,EAAE,YAAY,GAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAC,CAAC,CA4DnE;AAED;;;GAGG;AACH,mDAHW;IAAC,SAAS,EAAE,OAAO,QAAQ,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,OAAO,QAAQ,EAAE,WAAW,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAC,GACvF,OAAO,CAAC,OAAO,QAAQ,EAAE,cAAc,CAAC,CAkBpD;AAED;;;GAGG;AACH,6FAHW;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,QAAQ,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAC,GAClH,MAAM,CAqBlB"}