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.
- package/README.md +183 -0
- package/build/src/cli.d.ts +3 -0
- package/build/src/cli.d.ts.map +1 -0
- package/build/src/cli.js +104 -0
- package/build/src/cli.js.map +1 -0
- package/build/src/commands/context.d.ts +12 -0
- package/build/src/commands/context.d.ts.map +1 -0
- package/build/src/commands/context.js +16 -0
- package/build/src/commands/context.js.map +1 -0
- package/build/src/commands/deploy.d.ts +6 -0
- package/build/src/commands/deploy.d.ts.map +1 -0
- package/build/src/commands/deploy.js +14 -0
- package/build/src/commands/deploy.js.map +1 -0
- package/build/src/commands/doctor.d.ts +14 -0
- package/build/src/commands/doctor.d.ts.map +1 -0
- package/build/src/commands/doctor.js +54 -0
- package/build/src/commands/doctor.js.map +1 -0
- package/build/src/commands/init.d.ts +8 -0
- package/build/src/commands/init.d.ts.map +1 -0
- package/build/src/commands/init.js +42 -0
- package/build/src/commands/init.js.map +1 -0
- package/build/src/commands/plan.d.ts +6 -0
- package/build/src/commands/plan.d.ts.map +1 -0
- package/build/src/commands/plan.js +24 -0
- package/build/src/commands/plan.js.map +1 -0
- package/build/src/commands/releases.d.ts +27 -0
- package/build/src/commands/releases.d.ts.map +1 -0
- package/build/src/commands/releases.js +91 -0
- package/build/src/commands/releases.js.map +1 -0
- package/build/src/commands/rollback.d.ts +6 -0
- package/build/src/commands/rollback.d.ts.map +1 -0
- package/build/src/commands/rollback.js +12 -0
- package/build/src/commands/rollback.js.map +1 -0
- package/build/src/commands/rollbridge.d.ts +21 -0
- package/build/src/commands/rollbridge.d.ts.map +1 -0
- package/build/src/commands/rollbridge.js +69 -0
- package/build/src/commands/rollbridge.js.map +1 -0
- package/build/src/commands/validate.d.ts +6 -0
- package/build/src/commands/validate.d.ts.map +1 -0
- package/build/src/commands/validate.js +12 -0
- package/build/src/commands/validate.js.map +1 -0
- package/build/src/config/load-config.d.ts +10 -0
- package/build/src/config/load-config.d.ts.map +1 -0
- package/build/src/config/load-config.js +71 -0
- package/build/src/config/load-config.js.map +1 -0
- package/build/src/config/validate-config.d.ts +7 -0
- package/build/src/config/validate-config.d.ts.map +1 -0
- package/build/src/config/validate-config.js +117 -0
- package/build/src/config/validate-config.js.map +1 -0
- package/build/src/core/deploy-runner.d.ts +46 -0
- package/build/src/core/deploy-runner.d.ts.map +1 -0
- package/build/src/core/deploy-runner.js +221 -0
- package/build/src/core/deploy-runner.js.map +1 -0
- package/build/src/core/expo-web-artifacts.d.ts +10 -0
- package/build/src/core/expo-web-artifacts.d.ts.map +1 -0
- package/build/src/core/expo-web-artifacts.js +16 -0
- package/build/src/core/expo-web-artifacts.js.map +1 -0
- package/build/src/core/git-source.d.ts +22 -0
- package/build/src/core/git-source.d.ts.map +1 -0
- package/build/src/core/git-source.js +63 -0
- package/build/src/core/git-source.js.map +1 -0
- package/build/src/core/health-checks.d.ts +8 -0
- package/build/src/core/health-checks.d.ts.map +1 -0
- package/build/src/core/health-checks.js +19 -0
- package/build/src/core/health-checks.js.map +1 -0
- package/build/src/core/hooks.d.ts +12 -0
- package/build/src/core/hooks.d.ts.map +1 -0
- package/build/src/core/hooks.js +26 -0
- package/build/src/core/hooks.js.map +1 -0
- package/build/src/core/locks.d.ts +16 -0
- package/build/src/core/locks.d.ts.map +1 -0
- package/build/src/core/locks.js +32 -0
- package/build/src/core/locks.js.map +1 -0
- package/build/src/core/node-package-tasks.d.ts +26 -0
- package/build/src/core/node-package-tasks.d.ts.map +1 -0
- package/build/src/core/node-package-tasks.js +143 -0
- package/build/src/core/node-package-tasks.js.map +1 -0
- package/build/src/core/path-change-gate.d.ts +15 -0
- package/build/src/core/path-change-gate.d.ts.map +1 -0
- package/build/src/core/path-change-gate.js +95 -0
- package/build/src/core/path-change-gate.js.map +1 -0
- package/build/src/core/paths.d.ts +7 -0
- package/build/src/core/paths.d.ts.map +1 -0
- package/build/src/core/paths.js +20 -0
- package/build/src/core/paths.js.map +1 -0
- package/build/src/core/redaction.d.ts +22 -0
- package/build/src/core/redaction.d.ts.map +1 -0
- package/build/src/core/redaction.js +39 -0
- package/build/src/core/redaction.js.map +1 -0
- package/build/src/core/release-id.d.ts +6 -0
- package/build/src/core/release-id.d.ts.map +1 -0
- package/build/src/core/release-id.js +20 -0
- package/build/src/core/release-id.js.map +1 -0
- package/build/src/core/release-manager.d.ts +49 -0
- package/build/src/core/release-manager.d.ts.map +1 -0
- package/build/src/core/release-manager.js +115 -0
- package/build/src/core/release-manager.js.map +1 -0
- package/build/src/core/task-runner.d.ts +38 -0
- package/build/src/core/task-runner.d.ts.map +1 -0
- package/build/src/core/task-runner.js +102 -0
- package/build/src/core/task-runner.js.map +1 -0
- package/build/src/core/velocious-migrate.d.ts +11 -0
- package/build/src/core/velocious-migrate.d.ts.map +1 -0
- package/build/src/core/velocious-migrate.js +20 -0
- package/build/src/core/velocious-migrate.js.map +1 -0
- package/build/src/runtimes/index.d.ts +56 -0
- package/build/src/runtimes/index.d.ts.map +1 -0
- package/build/src/runtimes/index.js +132 -0
- package/build/src/runtimes/index.js.map +1 -0
- package/build/src/runtimes/none-runtime.d.ts +22 -0
- package/build/src/runtimes/none-runtime.d.ts.map +1 -0
- package/build/src/runtimes/none-runtime.js +23 -0
- package/build/src/runtimes/none-runtime.js.map +1 -0
- package/build/src/runtimes/rollbridge-runtime.d.ts +137 -0
- package/build/src/runtimes/rollbridge-runtime.d.ts.map +1 -0
- package/build/src/runtimes/rollbridge-runtime.js +224 -0
- package/build/src/runtimes/rollbridge-runtime.js.map +1 -0
- package/build/src/tasks.d.ts +5 -0
- package/build/src/tasks.d.ts.map +1 -0
- package/build/src/tasks.js +5 -0
- package/build/src/tasks.js.map +1 -0
- package/build/src/test-helpers.d.ts +25 -0
- package/build/src/test-helpers.d.ts.map +1 -0
- package/build/src/test-helpers.js +40 -0
- package/build/src/test-helpers.js.map +1 -0
- package/build/src/transports/local-transport.d.ts +67 -0
- package/build/src/transports/local-transport.d.ts.map +1 -0
- package/build/src/transports/local-transport.js +121 -0
- package/build/src/transports/local-transport.js.map +1 -0
- package/build/src/transports/ssh-transport.d.ts +189 -0
- package/build/src/transports/ssh-transport.d.ts.map +1 -0
- package/build/src/transports/ssh-transport.js +369 -0
- package/build/src/transports/ssh-transport.js.map +1 -0
- package/build/src/types.d.ts +290 -0
- package/build/src/types.d.ts.map +1 -0
- package/build/src/types.js +8 -0
- package/build/src/types.js.map +1 -0
- package/docs/config-reference.md +264 -0
- package/docs/migration-from-capistrano.md +167 -0
- package/docs/roadmap.md +27 -0
- package/examples/local/rampway.config.mjs +20 -0
- package/examples/monorepo/rampway.config.mjs +73 -0
- package/package.json +92 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { shellQuote } from "../transports/ssh-transport.js";
|
|
2
|
+
export class RollbridgeRuntime {
|
|
3
|
+
/** @type {"rollbridge"} */
|
|
4
|
+
static type = "rollbridge";
|
|
5
|
+
/**
|
|
6
|
+
* @param {Partial<import('#types').RollbridgeRuntimeConfig>} [config]
|
|
7
|
+
*/
|
|
8
|
+
constructor(config = {}) {
|
|
9
|
+
/** @type {import('#types').RollbridgeRuntimeConfig} */
|
|
10
|
+
this.config = {
|
|
11
|
+
type: "rollbridge",
|
|
12
|
+
...config,
|
|
13
|
+
command: config.command ?? "npx rollbridge",
|
|
14
|
+
packageDir: config.packageDir ?? "."
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @returns {string[]}
|
|
19
|
+
*/
|
|
20
|
+
plan() {
|
|
21
|
+
return [
|
|
22
|
+
"validate Rollbridge config",
|
|
23
|
+
"deploy Rollbridge release with --ensure-daemon",
|
|
24
|
+
"check Rollbridge runtime health"
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @param {{releasePath: string, releaseId: string, revision: string}} opts
|
|
29
|
+
* @returns {string}
|
|
30
|
+
*/
|
|
31
|
+
deployCommand({ releasePath, releaseId, revision }) {
|
|
32
|
+
const args = [
|
|
33
|
+
"--ensure-daemon",
|
|
34
|
+
"--release-path", releasePath,
|
|
35
|
+
"--release-id", releaseId,
|
|
36
|
+
"--revision", revision
|
|
37
|
+
];
|
|
38
|
+
if (this.config.daemonLogPath)
|
|
39
|
+
args.push("--daemon-log-path", this.config.daemonLogPath);
|
|
40
|
+
if (this.config.daemonPidPath)
|
|
41
|
+
args.push("--daemon-pid-path", this.config.daemonPidPath);
|
|
42
|
+
if (this.config.daemonStartTimeoutMs)
|
|
43
|
+
args.push("--daemon-start-timeout-ms", String(this.config.daemonStartTimeoutMs));
|
|
44
|
+
return this.rollbridgeCommand("deploy", args);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @returns {string}
|
|
48
|
+
*/
|
|
49
|
+
validateCommand() {
|
|
50
|
+
return this.rollbridgeCommand("validate");
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @returns {string}
|
|
54
|
+
*/
|
|
55
|
+
statusCommand() {
|
|
56
|
+
return this.rollbridgeCommand("status");
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @returns {string}
|
|
60
|
+
*/
|
|
61
|
+
logsCommand() {
|
|
62
|
+
return this.rollbridgeCommand("logs");
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @param {{force?: boolean}} [opts]
|
|
66
|
+
* @returns {string}
|
|
67
|
+
*/
|
|
68
|
+
recoverCommand({ force = true } = {}) {
|
|
69
|
+
const args = [];
|
|
70
|
+
if (force)
|
|
71
|
+
args.push("--force");
|
|
72
|
+
return this.rollbridgeCommand("recover", args);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* @returns {string}
|
|
76
|
+
*/
|
|
77
|
+
shutdownCommand() {
|
|
78
|
+
return this.rollbridgeCommand("shutdown");
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @returns {string}
|
|
82
|
+
*/
|
|
83
|
+
versionCommand() {
|
|
84
|
+
return `cd ${shellQuote(this.config.packageDir)} && node -p ${shellQuote("require('./package-lock.json').packages['node_modules/rollbridge']?.version || ''")}`;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @returns {string}
|
|
88
|
+
*/
|
|
89
|
+
terminateStuckDaemonCommand() {
|
|
90
|
+
const commands = [];
|
|
91
|
+
if (this.config.daemonPidPath) {
|
|
92
|
+
const pidPath = shellQuote(this.config.daemonPidPath);
|
|
93
|
+
commands.push(`if [ -f ${pidPath} ]; then pid=$(cat ${pidPath}); if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then kill "$pid" 2>/dev/null || true; fi; fi`);
|
|
94
|
+
}
|
|
95
|
+
if (this.config.socketPath)
|
|
96
|
+
commands.push(`rm -f ${shellQuote(this.config.socketPath)}`);
|
|
97
|
+
return commands.join("; ");
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @param {string} subcommand
|
|
101
|
+
* @param {string[]} [args]
|
|
102
|
+
* @returns {string}
|
|
103
|
+
*/
|
|
104
|
+
rollbridgeCommand(subcommand, args = []) {
|
|
105
|
+
const commandArgs = [subcommand];
|
|
106
|
+
if (this.config.config)
|
|
107
|
+
commandArgs.push("--config", this.config.config);
|
|
108
|
+
commandArgs.push(...args);
|
|
109
|
+
const quotedArgs = commandArgs.map(arg => shellQuote(String(arg))).join(" ");
|
|
110
|
+
return `cd ${shellQuote(this.config.packageDir)} && ${this.config.command} ${quotedArgs}`;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* @param {import('#types').Transport} transport
|
|
114
|
+
* @param {{releasePath: string, releaseId: string, revision: string, currentPath?: string}} opts
|
|
115
|
+
* @returns {Promise<{status: string}>}
|
|
116
|
+
*/
|
|
117
|
+
async deploy(transport, { releasePath, releaseId, revision, currentPath }) {
|
|
118
|
+
try {
|
|
119
|
+
await this.validate(transport, { releasePath });
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
throw new Error(`Rollbridge validation failed: ${ /** @type {Error} */(error).message}`);
|
|
123
|
+
}
|
|
124
|
+
const releaseVersion = await this.prepareVersionChange(transport, { releasePath, currentPath });
|
|
125
|
+
try {
|
|
126
|
+
await transport.run(this.deployCommand({ releasePath, releaseId, revision }), { cwd: releasePath });
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
throw new Error(`Rollbridge deploy failed: ${ /** @type {Error} */(error).message}`);
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
await this.healthCheck(transport, { releasePath });
|
|
133
|
+
if (releaseVersion && this.config.versionPath)
|
|
134
|
+
await transport.writeFile(this.config.versionPath, `${releaseVersion}\n`);
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
throw new Error(`Rollbridge health check failed: ${ /** @type {Error} */(error).message}`);
|
|
138
|
+
}
|
|
139
|
+
return { status: "deployed" };
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* @param {import('#types').Transport} transport
|
|
143
|
+
* @param {{releasePath: string}} opts
|
|
144
|
+
* @returns {Promise<import('#types').SpawnResult>}
|
|
145
|
+
*/
|
|
146
|
+
async healthCheck(transport, { releasePath }) {
|
|
147
|
+
return await this.status(transport, { releasePath });
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* @param {import('#types').Transport} transport
|
|
151
|
+
* @param {{releasePath: string, currentPath?: string}} opts
|
|
152
|
+
* @returns {Promise<string|undefined>}
|
|
153
|
+
*/
|
|
154
|
+
async prepareVersionChange(transport, { releasePath, currentPath }) {
|
|
155
|
+
if (!this.config.versionPath)
|
|
156
|
+
return undefined;
|
|
157
|
+
const releaseVersion = (await transport.run(this.versionCommand(), { cwd: releasePath })).output.trim();
|
|
158
|
+
if (!releaseVersion)
|
|
159
|
+
return undefined;
|
|
160
|
+
const deployedVersion = await this.deployedVersion(transport);
|
|
161
|
+
if (deployedVersion && deployedVersion !== releaseVersion && currentPath)
|
|
162
|
+
await this.shutdownChangedVersion(transport, { currentPath });
|
|
163
|
+
return releaseVersion;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* @param {import('#types').Transport} transport
|
|
167
|
+
* @returns {Promise<string|undefined>}
|
|
168
|
+
*/
|
|
169
|
+
async deployedVersion(transport) {
|
|
170
|
+
if (!this.config.versionPath || !await transport.exists(this.config.versionPath))
|
|
171
|
+
return undefined;
|
|
172
|
+
return (await transport.readFile(this.config.versionPath)).trim() || undefined;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* @param {import('#types').Transport} transport
|
|
176
|
+
* @param {{currentPath: string}} opts
|
|
177
|
+
* @returns {Promise<void>}
|
|
178
|
+
*/
|
|
179
|
+
async shutdownChangedVersion(transport, { currentPath }) {
|
|
180
|
+
try {
|
|
181
|
+
await this.status(transport, { releasePath: currentPath });
|
|
182
|
+
}
|
|
183
|
+
catch {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
await transport.run(this.shutdownCommand(), { cwd: currentPath });
|
|
187
|
+
const terminateCommand = this.terminateStuckDaemonCommand();
|
|
188
|
+
if (terminateCommand)
|
|
189
|
+
await transport.run(terminateCommand, { cwd: currentPath });
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* @param {import('#types').Transport} transport
|
|
193
|
+
* @param {{releasePath: string}} opts
|
|
194
|
+
* @returns {Promise<import('#types').SpawnResult>}
|
|
195
|
+
*/
|
|
196
|
+
async validate(transport, { releasePath }) {
|
|
197
|
+
return await transport.run(this.validateCommand(), { cwd: releasePath });
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* @param {import('#types').Transport} transport
|
|
201
|
+
* @param {{releasePath: string}} opts
|
|
202
|
+
* @returns {Promise<import('#types').SpawnResult>}
|
|
203
|
+
*/
|
|
204
|
+
async status(transport, { releasePath }) {
|
|
205
|
+
return await transport.run(this.statusCommand(), { cwd: releasePath });
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* @param {import('#types').Transport} transport
|
|
209
|
+
* @param {{releasePath: string}} opts
|
|
210
|
+
* @returns {Promise<import('#types').SpawnResult>}
|
|
211
|
+
*/
|
|
212
|
+
async logs(transport, { releasePath }) {
|
|
213
|
+
return await transport.run(this.logsCommand(), { cwd: releasePath });
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* @param {import('#types').Transport} transport
|
|
217
|
+
* @param {{releasePath: string, force?: boolean}} opts
|
|
218
|
+
* @returns {Promise<import('#types').SpawnResult>}
|
|
219
|
+
*/
|
|
220
|
+
async recover(transport, { releasePath, force = true }) {
|
|
221
|
+
return await transport.run(this.recoverCommand({ force }), { cwd: releasePath });
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=rollbridge-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollbridge-runtime.js","sourceRoot":"","sources":["../../../src/runtimes/rollbridge-runtime.js"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,gCAAgC,CAAA;AAEzD,MAAM,OAAO,iBAAiB;IAC5B,2BAA2B;IAC3B,MAAM,CAAC,IAAI,GAAG,YAAY,CAAA;IAE1B;;OAEG;IACH,YAAY,MAAM,GAAG,EAAE;QACrB,uDAAuD;QACvD,IAAI,CAAC,MAAM,GAAG;YACZ,IAAI,EAAE,YAAY;YAClB,GAAG,MAAM;YACT,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,gBAAgB;YAC3C,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,GAAG;SACrC,CAAA;IACH,CAAC;IAED;;OAEG;IACH,IAAI;QACF,OAAO;YACL,4BAA4B;YAC5B,gDAAgD;YAChD,iCAAiC;SAClC,CAAA;IACH,CAAC;IAED;;;OAGG;IACH,aAAa,CAAC,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC;QAC9C,MAAM,IAAI,GAAG;YACX,iBAAiB;YACjB,gBAAgB,EAAE,WAAW;YAC7B,cAAc,EAAE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C9E,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { checkExpoWebArtifacts } from "./core/expo-web-artifacts.js";
|
|
2
|
+
export { velociousMigrate } from "./core/velocious-migrate.js";
|
|
3
|
+
export { onlyIfChanged } from "./core/path-change-gate.js";
|
|
4
|
+
export { nodePackageInstall, npmInstall, pnpmInstall, yarnInstall, bunInstall } from "./core/node-package-tasks.js";
|
|
5
|
+
//# sourceMappingURL=tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/tasks.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { nodePackageInstall, npmInstall, pnpmInstall, yarnInstall, bunInstall } from "./core/node-package-tasks.js";
|
|
2
|
+
export { checkExpoWebArtifacts } from "./core/expo-web-artifacts.js";
|
|
3
|
+
export { velociousMigrate } from "./core/velocious-migrate.js";
|
|
4
|
+
export { onlyIfChanged } from "./core/path-change-gate.js";
|
|
5
|
+
//# sourceMappingURL=tasks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../src/tasks.js"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAC,MAAM,8BAA8B,CAAA;AACjH,OAAO,EAAC,qBAAqB,EAAC,MAAM,8BAA8B,CAAA;AAClE,OAAO,EAAC,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run a shell command and return the result.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} command
|
|
5
|
+
* @param {string} cwd
|
|
6
|
+
* @returns {import("node:child_process").SpawnSyncReturns<string>}
|
|
7
|
+
*/
|
|
8
|
+
export function runShell(command: string, cwd: string): import("node:child_process").SpawnSyncReturns<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Create a temporary directory that is cleaned up after the test.
|
|
11
|
+
*
|
|
12
|
+
* @param {import("node:test").TestContext} t
|
|
13
|
+
* @param {string} prefix
|
|
14
|
+
* @returns {string}
|
|
15
|
+
*/
|
|
16
|
+
export function makeTempDir(t: import("node:test").TestContext, prefix: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Retrieve and validate a named task group from a stage config.
|
|
19
|
+
*
|
|
20
|
+
* @param {import('#types').StageConfig} stageConfig
|
|
21
|
+
* @param {string} groupName
|
|
22
|
+
* @returns {import('#types').TaskEntry[]}
|
|
23
|
+
*/
|
|
24
|
+
export function taskEntries(stageConfig: import("#types").StageConfig, groupName: string): import("#types").TaskEntry[];
|
|
25
|
+
//# sourceMappingURL=test-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../../src/test-helpers.js"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,kCAJW,MAAM,OACN,MAAM,GACJ,OAAO,oBAAoB,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAIjE;AAED;;;;;;GAMG;AACH,+BAJW,OAAO,WAAW,EAAE,WAAW,UAC/B,MAAM,GACJ,MAAM,CAMlB;AAED;;;;;;GAMG;AACH,yCAJW,OAAO,QAAQ,EAAE,WAAW,aAC5B,MAAM,GACJ,OAAO,QAAQ,EAAE,SAAS,EAAE,CAMxC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
/**
|
|
7
|
+
* Run a shell command and return the result.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} command
|
|
10
|
+
* @param {string} cwd
|
|
11
|
+
* @returns {import("node:child_process").SpawnSyncReturns<string>}
|
|
12
|
+
*/
|
|
13
|
+
export function runShell(command, cwd) {
|
|
14
|
+
return spawnSync("bash", ["-c", command], { cwd, encoding: "utf8" });
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Create a temporary directory that is cleaned up after the test.
|
|
18
|
+
*
|
|
19
|
+
* @param {import("node:test").TestContext} t
|
|
20
|
+
* @param {string} prefix
|
|
21
|
+
* @returns {string}
|
|
22
|
+
*/
|
|
23
|
+
export function makeTempDir(t, prefix) {
|
|
24
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
|
|
25
|
+
t.after(() => fs.rmSync(dir, { recursive: true, force: true }));
|
|
26
|
+
return dir;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Retrieve and validate a named task group from a stage config.
|
|
30
|
+
*
|
|
31
|
+
* @param {import('#types').StageConfig} stageConfig
|
|
32
|
+
* @param {string} groupName
|
|
33
|
+
* @returns {import('#types').TaskEntry[]}
|
|
34
|
+
*/
|
|
35
|
+
export function taskEntries(stageConfig, groupName) {
|
|
36
|
+
const entries = stageConfig.tasks[groupName];
|
|
37
|
+
assert.ok(Array.isArray(entries), `expected task group '${groupName}' to be an array`);
|
|
38
|
+
return entries;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=test-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-helpers.js","sourceRoot":"","sources":["../../src/test-helpers.js"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAO,EAAE,GAAG;IACnC,OAAO,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAA;AACpE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,CAAC,EAAE,MAAM;IACnC,MAAM,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,CAAA;IAC1D,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,EAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC,CAAA;IAC7D,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,WAAW,EAAE,SAAS;IAChD,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IAC5C,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,wBAAwB,SAAS,kBAAkB,CAAC,CAAA;IACtF,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export class LocalTransport {
|
|
2
|
+
/**
|
|
3
|
+
* @param {string} targetPath
|
|
4
|
+
* @returns {Promise<void>}
|
|
5
|
+
*/
|
|
6
|
+
mkdirp(targetPath: string): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* @param {string} targetPath
|
|
9
|
+
* @returns {Promise<boolean>}
|
|
10
|
+
*/
|
|
11
|
+
exists(targetPath: string): Promise<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} target
|
|
14
|
+
* @param {string} linkPath
|
|
15
|
+
* @param {string} [type]
|
|
16
|
+
* @returns {Promise<void>}
|
|
17
|
+
*/
|
|
18
|
+
symlink(target: string, linkPath: string, type?: string): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* @param {string} linkPath
|
|
21
|
+
* @returns {Promise<string>}
|
|
22
|
+
*/
|
|
23
|
+
readlink(linkPath: string): Promise<string>;
|
|
24
|
+
/**
|
|
25
|
+
* @param {string} targetPath
|
|
26
|
+
* @returns {Promise<void>}
|
|
27
|
+
*/
|
|
28
|
+
rm(targetPath: string): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* @param {string} from
|
|
31
|
+
* @param {string} to
|
|
32
|
+
* @returns {Promise<void>}
|
|
33
|
+
*/
|
|
34
|
+
rename(from: string, to: string): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* @param {string} filePath
|
|
37
|
+
* @param {string} content
|
|
38
|
+
* @returns {Promise<void>}
|
|
39
|
+
*/
|
|
40
|
+
writeFile(filePath: string, content: string): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* @param {string} filePath
|
|
43
|
+
* @returns {Promise<string>}
|
|
44
|
+
*/
|
|
45
|
+
readFile(filePath: string): Promise<string>;
|
|
46
|
+
/**
|
|
47
|
+
* @param {string} targetPath
|
|
48
|
+
* @returns {Promise<string[]>}
|
|
49
|
+
*/
|
|
50
|
+
list(targetPath: string): Promise<string[]>;
|
|
51
|
+
/**
|
|
52
|
+
* @param {string} from
|
|
53
|
+
* @param {string} to
|
|
54
|
+
* @returns {Promise<void>}
|
|
55
|
+
*/
|
|
56
|
+
copyDir(from: string, to: string): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* @param {string} command
|
|
59
|
+
* @param {{cwd?: string, env?: Record<string, string>}} [opts]
|
|
60
|
+
* @returns {Promise<import('#types').SpawnResult>}
|
|
61
|
+
*/
|
|
62
|
+
run(command: string, { cwd, env }?: {
|
|
63
|
+
cwd?: string;
|
|
64
|
+
env?: Record<string, string>;
|
|
65
|
+
}): Promise<import("#types").SpawnResult>;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=local-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-transport.d.ts","sourceRoot":"","sources":["../../../src/transports/local-transport.js"],"names":[],"mappings":"AAKA;IACE;;;OAGG;IACH,mBAHW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAIzB;IAED;;;OAGG;IACH,mBAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAW5B;IAED;;;;;OAKG;IACH,gBALW,MAAM,YACN,MAAM,SACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAIzB;IAED;;;OAGG;IACH,mBAHW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAI3B;IAED;;;OAGG;IACH,eAHW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAIzB;IAED;;;;OAIG;IACH,aAJW,MAAM,MACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAIzB;IAED;;;;OAIG;IACH,oBAJW,MAAM,WACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAKzB;IAED;;;OAGG;IACH,mBAHW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAI3B;IAED;;;OAGG;IACH,iBAHW,MAAM,GACJ,OAAO,CAAC,MAAM,EAAE,CAAC,CAU7B;IAED;;;;OAIG;IACH,cAJW,MAAM,MACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAIzB;IAED;;;;OAIG;IACH,aAJW,MAAM,iBACN;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAC,GAC1C,OAAO,CAAC,OAAO,QAAQ,EAAE,WAAW,CAAC,CAejD;CACF"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import { redactText } from "../core/redaction.js";
|
|
5
|
+
export class LocalTransport {
|
|
6
|
+
/**
|
|
7
|
+
* @param {string} targetPath
|
|
8
|
+
* @returns {Promise<void>}
|
|
9
|
+
*/
|
|
10
|
+
async mkdirp(targetPath) {
|
|
11
|
+
await fs.mkdir(targetPath, { recursive: true });
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @param {string} targetPath
|
|
15
|
+
* @returns {Promise<boolean>}
|
|
16
|
+
*/
|
|
17
|
+
async exists(targetPath) {
|
|
18
|
+
try {
|
|
19
|
+
await fs.lstat(targetPath);
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
const err = /** @type {{code?: string}} */ (error);
|
|
24
|
+
if (err.code === "ENOENT")
|
|
25
|
+
return false;
|
|
26
|
+
throw err;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @param {string} target
|
|
31
|
+
* @param {string} linkPath
|
|
32
|
+
* @param {string} [type]
|
|
33
|
+
* @returns {Promise<void>}
|
|
34
|
+
*/
|
|
35
|
+
async symlink(target, linkPath, type = undefined) {
|
|
36
|
+
await fs.symlink(target, linkPath, type);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @param {string} linkPath
|
|
40
|
+
* @returns {Promise<string>}
|
|
41
|
+
*/
|
|
42
|
+
async readlink(linkPath) {
|
|
43
|
+
return await fs.readlink(linkPath);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @param {string} targetPath
|
|
47
|
+
* @returns {Promise<void>}
|
|
48
|
+
*/
|
|
49
|
+
async rm(targetPath) {
|
|
50
|
+
await fs.rm(targetPath, { recursive: true, force: true });
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @param {string} from
|
|
54
|
+
* @param {string} to
|
|
55
|
+
* @returns {Promise<void>}
|
|
56
|
+
*/
|
|
57
|
+
async rename(from, to) {
|
|
58
|
+
await fs.rename(from, to);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @param {string} filePath
|
|
62
|
+
* @param {string} content
|
|
63
|
+
* @returns {Promise<void>}
|
|
64
|
+
*/
|
|
65
|
+
async writeFile(filePath, content) {
|
|
66
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
67
|
+
await fs.writeFile(filePath, content);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @param {string} filePath
|
|
71
|
+
* @returns {Promise<string>}
|
|
72
|
+
*/
|
|
73
|
+
async readFile(filePath) {
|
|
74
|
+
return await fs.readFile(filePath, "utf8");
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @param {string} targetPath
|
|
78
|
+
* @returns {Promise<string[]>}
|
|
79
|
+
*/
|
|
80
|
+
async list(targetPath) {
|
|
81
|
+
try {
|
|
82
|
+
return await fs.readdir(targetPath);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
const err = /** @type {{code?: string}} */ (error);
|
|
86
|
+
if (err.code === "ENOENT")
|
|
87
|
+
return [];
|
|
88
|
+
throw err;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @param {string} from
|
|
93
|
+
* @param {string} to
|
|
94
|
+
* @returns {Promise<void>}
|
|
95
|
+
*/
|
|
96
|
+
async copyDir(from, to) {
|
|
97
|
+
await fs.cp(from, to, { recursive: true, force: false, errorOnExist: true });
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @param {string} command
|
|
101
|
+
* @param {{cwd?: string, env?: Record<string, string>}} [opts]
|
|
102
|
+
* @returns {Promise<import('#types').SpawnResult>}
|
|
103
|
+
*/
|
|
104
|
+
async run(command, { cwd, env = {} } = {}) {
|
|
105
|
+
return await new Promise((resolve, reject) => {
|
|
106
|
+
const child = spawn(command, { cwd, env: { ...process.env, ...env }, shell: true });
|
|
107
|
+
let output = "";
|
|
108
|
+
child.stdout.on("data", /** @param {Buffer|string} chunk */ /** @param {Buffer|string} chunk */ chunk => { output += chunk.toString(); process.stdout.write(redactText(chunk.toString())); });
|
|
109
|
+
child.stderr.on("data", /** @param {Buffer|string} chunk */ /** @param {Buffer|string} chunk */ chunk => { output += chunk.toString(); process.stderr.write(redactText(chunk.toString())); });
|
|
110
|
+
child.on("error", reject);
|
|
111
|
+
child.on("close", /** @param {number|null} code */ /** @param {number|null} code */ code => {
|
|
112
|
+
if (code === 0)
|
|
113
|
+
resolve({ code, output: redactText(output) });
|
|
114
|
+
else
|
|
115
|
+
reject(new Error(`Command failed with exit ${code}: ${redactText(command)}
|
|
116
|
+
${redactText(output)}`));
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=local-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-transport.js","sourceRoot":"","sources":["../../../src/transports/local-transport.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAA;AACjC,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAA;AACxC,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAA;AAE/C,MAAM,OAAO,cAAc;IACzB;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,UAAU;QACrB,MAAM,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAA;IAC/C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,UAAU;QACrB,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;YAC1B,OAAO,IAAI,CAAA;QACb,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,8BAA8B,CAAC,CAAC,KAAK,CAAC,CAAA;YAClD,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;gBAAE,OAAO,KAAK,CAAA;YACv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