@memberjunction/installer 0.0.1 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/InstallerEngine.d.ts +182 -0
- package/dist/InstallerEngine.d.ts.map +1 -0
- package/dist/InstallerEngine.js +571 -0
- package/dist/InstallerEngine.js.map +1 -0
- package/dist/adapters/FileSystemAdapter.d.ts +197 -0
- package/dist/adapters/FileSystemAdapter.d.ts.map +1 -0
- package/dist/adapters/FileSystemAdapter.js +355 -0
- package/dist/adapters/FileSystemAdapter.js.map +1 -0
- package/dist/adapters/GitHubReleaseProvider.d.ts +197 -0
- package/dist/adapters/GitHubReleaseProvider.d.ts.map +1 -0
- package/dist/adapters/GitHubReleaseProvider.js +348 -0
- package/dist/adapters/GitHubReleaseProvider.js.map +1 -0
- package/dist/adapters/ProcessRunner.d.ts +174 -0
- package/dist/adapters/ProcessRunner.d.ts.map +1 -0
- package/dist/adapters/ProcessRunner.js +264 -0
- package/dist/adapters/ProcessRunner.js.map +1 -0
- package/dist/adapters/SqlServerAdapter.d.ts +78 -0
- package/dist/adapters/SqlServerAdapter.d.ts.map +1 -0
- package/dist/adapters/SqlServerAdapter.js +120 -0
- package/dist/adapters/SqlServerAdapter.js.map +1 -0
- package/dist/errors/InstallerError.d.ts +92 -0
- package/dist/errors/InstallerError.d.ts.map +1 -0
- package/dist/errors/InstallerError.js +66 -0
- package/dist/errors/InstallerError.js.map +1 -0
- package/dist/events/InstallerEvents.d.ts +255 -0
- package/dist/events/InstallerEvents.d.ts.map +1 -0
- package/dist/events/InstallerEvents.js +96 -0
- package/dist/events/InstallerEvents.js.map +1 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -0
- package/dist/models/Diagnostics.d.ts +121 -0
- package/dist/models/Diagnostics.d.ts.map +1 -0
- package/dist/models/Diagnostics.js +75 -0
- package/dist/models/Diagnostics.js.map +1 -0
- package/dist/models/InstallConfig.d.ts +139 -0
- package/dist/models/InstallConfig.d.ts.map +1 -0
- package/dist/models/InstallConfig.js +207 -0
- package/dist/models/InstallConfig.js.map +1 -0
- package/dist/models/InstallPlan.d.ts +189 -0
- package/dist/models/InstallPlan.d.ts.map +1 -0
- package/dist/models/InstallPlan.js +117 -0
- package/dist/models/InstallPlan.js.map +1 -0
- package/dist/models/InstallState.d.ts +173 -0
- package/dist/models/InstallState.d.ts.map +1 -0
- package/dist/models/InstallState.js +203 -0
- package/dist/models/InstallState.js.map +1 -0
- package/dist/models/VersionInfo.d.ts +53 -0
- package/dist/models/VersionInfo.d.ts.map +1 -0
- package/dist/models/VersionInfo.js +2 -0
- package/dist/models/VersionInfo.js.map +1 -0
- package/dist/phases/CodeGenPhase.d.ts +364 -0
- package/dist/phases/CodeGenPhase.d.ts.map +1 -0
- package/dist/phases/CodeGenPhase.js +1086 -0
- package/dist/phases/CodeGenPhase.js.map +1 -0
- package/dist/phases/ConfigurePhase.d.ts +86 -0
- package/dist/phases/ConfigurePhase.d.ts.map +1 -0
- package/dist/phases/ConfigurePhase.js +439 -0
- package/dist/phases/ConfigurePhase.js.map +1 -0
- package/dist/phases/DatabaseProvisionPhase.d.ts +82 -0
- package/dist/phases/DatabaseProvisionPhase.d.ts.map +1 -0
- package/dist/phases/DatabaseProvisionPhase.js +284 -0
- package/dist/phases/DatabaseProvisionPhase.js.map +1 -0
- package/dist/phases/DependencyPhase.d.ts +88 -0
- package/dist/phases/DependencyPhase.d.ts.map +1 -0
- package/dist/phases/DependencyPhase.js +237 -0
- package/dist/phases/DependencyPhase.js.map +1 -0
- package/dist/phases/MigratePhase.d.ts +70 -0
- package/dist/phases/MigratePhase.d.ts.map +1 -0
- package/dist/phases/MigratePhase.js +96 -0
- package/dist/phases/MigratePhase.js.map +1 -0
- package/dist/phases/PlatformCompatPhase.d.ts +193 -0
- package/dist/phases/PlatformCompatPhase.d.ts.map +1 -0
- package/dist/phases/PlatformCompatPhase.js +587 -0
- package/dist/phases/PlatformCompatPhase.js.map +1 -0
- package/dist/phases/PreflightPhase.d.ts +119 -0
- package/dist/phases/PreflightPhase.d.ts.map +1 -0
- package/dist/phases/PreflightPhase.js +394 -0
- package/dist/phases/PreflightPhase.js.map +1 -0
- package/dist/phases/ScaffoldPhase.d.ts +99 -0
- package/dist/phases/ScaffoldPhase.d.ts.map +1 -0
- package/dist/phases/ScaffoldPhase.js +235 -0
- package/dist/phases/ScaffoldPhase.js.map +1 -0
- package/dist/phases/SmokeTestPhase.d.ts +111 -0
- package/dist/phases/SmokeTestPhase.d.ts.map +1 -0
- package/dist/phases/SmokeTestPhase.js +426 -0
- package/dist/phases/SmokeTestPhase.js.map +1 -0
- package/package.json +26 -7
- package/README.md +0 -45
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase I — Smoke Test
|
|
3
|
+
*
|
|
4
|
+
* The final phase in the install pipeline. Starts MJAPI and Explorer as
|
|
5
|
+
* background processes, verifies they become ready, then cleans up.
|
|
6
|
+
* This confirms the install is functional end-to-end.
|
|
7
|
+
*
|
|
8
|
+
* Key behaviors:
|
|
9
|
+
* - **Pre-check**: Verifies `mj_generatedentities` exists (MJAPI can't start without it).
|
|
10
|
+
* - **Port detection**: Reads actual port numbers from project files (`.env`, `package.json`)
|
|
11
|
+
* rather than trusting installer config defaults.
|
|
12
|
+
* - **Stdout-based readiness**: Watches process stdout for service-specific readiness markers
|
|
13
|
+
* (e.g., "Server ready at" for MJAPI, "Compiled successfully" for Explorer). Falls back to
|
|
14
|
+
* a single HTTP health check as confirmation.
|
|
15
|
+
* - **Parallel startup**: Both services are started concurrently to minimize total wait time.
|
|
16
|
+
* - **Error reporting**: On failure, the last 20 lines of captured output are included in the
|
|
17
|
+
* warning so users can diagnose what went wrong.
|
|
18
|
+
* - **Port-based cleanup**: Kills processes by port number after verification, since
|
|
19
|
+
* on Windows `child.kill()` only terminates the shell, not turbo/node grandchildren.
|
|
20
|
+
*
|
|
21
|
+
* This phase is automatically skipped in `--fast` mode.
|
|
22
|
+
*
|
|
23
|
+
* @module phases/SmokeTestPhase
|
|
24
|
+
* @see ProcessRunner — handles process spawning and port-based cleanup.
|
|
25
|
+
* @see CodeGenPhase — produces the generated entities required by the pre-check.
|
|
26
|
+
*/
|
|
27
|
+
import path from 'node:path';
|
|
28
|
+
import { InstallerError } from '../errors/InstallerError.js';
|
|
29
|
+
import { ProcessRunner } from '../adapters/ProcessRunner.js';
|
|
30
|
+
import { FileSystemAdapter } from '../adapters/FileSystemAdapter.js';
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Timeout constants
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
/** Maximum time to wait for MJAPI stdout readiness marker (ms). */
|
|
35
|
+
const API_READINESS_TIMEOUT = 120_000;
|
|
36
|
+
/** Maximum time to keep the MJAPI process alive — readiness + 30s buffer (ms). */
|
|
37
|
+
const API_PROCESS_TIMEOUT = 150_000;
|
|
38
|
+
/** Maximum time to wait for Explorer stdout readiness marker (ms). */
|
|
39
|
+
const EXPLORER_READINESS_TIMEOUT = 240_000;
|
|
40
|
+
/** Maximum time to keep the Explorer process alive — readiness + 30s buffer (ms). */
|
|
41
|
+
const EXPLORER_PROCESS_TIMEOUT = 270_000;
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
// Readiness patterns (from MJServer/src/index.ts and Angular CLI output)
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
/** Stdout patterns indicating MJAPI is ready. */
|
|
46
|
+
const API_READY_PATTERNS = [/Server ready at/i];
|
|
47
|
+
/** Stdout patterns indicating Explorer dev server is ready. */
|
|
48
|
+
const EXPLORER_READY_PATTERNS = [
|
|
49
|
+
/Compiled successfully/i,
|
|
50
|
+
/Application bundle generation complete/i,
|
|
51
|
+
/Local:\s+http/i,
|
|
52
|
+
];
|
|
53
|
+
/** Stdout/stderr patterns indicating a fatal startup error (no point waiting). */
|
|
54
|
+
const FATAL_ERROR_PATTERNS = [
|
|
55
|
+
/EADDRINUSE/i,
|
|
56
|
+
/Cannot find module/i,
|
|
57
|
+
/FATAL ERROR/i,
|
|
58
|
+
/Error: listen/i,
|
|
59
|
+
];
|
|
60
|
+
/** Maximum output lines to keep in the ring buffer for error reporting. */
|
|
61
|
+
const MAX_CAPTURED_LINES = 50;
|
|
62
|
+
/** Maximum output lines to include in failure diagnostics. */
|
|
63
|
+
const MAX_DIAGNOSTIC_LINES = 20;
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
// ReadinessWatcher
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
/**
|
|
68
|
+
* Watches process stdout/stderr for readiness or fatal-error patterns.
|
|
69
|
+
*
|
|
70
|
+
* Resolves its {@link Promise} with `{ Ready: true }` when a readiness pattern
|
|
71
|
+
* matches, or `{ Ready: false, Reason }` when a fatal error is detected, the
|
|
72
|
+
* process exits prematurely, or the timeout expires.
|
|
73
|
+
*/
|
|
74
|
+
class ReadinessWatcher {
|
|
75
|
+
constructor(readyPatterns, fatalPatterns, timeoutMs) {
|
|
76
|
+
this.readyPatterns = readyPatterns;
|
|
77
|
+
this.fatalPatterns = fatalPatterns;
|
|
78
|
+
this.settled = false;
|
|
79
|
+
this.capturedOutput = [];
|
|
80
|
+
this.timeoutMs = timeoutMs;
|
|
81
|
+
this.Promise = new Promise((resolve) => {
|
|
82
|
+
this.resolvePromise = resolve;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/** Feed a line of stdout to check against readiness/fatal patterns. */
|
|
86
|
+
OnStdout(line) {
|
|
87
|
+
this.pushLine(line);
|
|
88
|
+
if (this.settled)
|
|
89
|
+
return;
|
|
90
|
+
if (this.matchesAny(line, this.readyPatterns)) {
|
|
91
|
+
this.settle({ Ready: true, Output: this.capturedOutput });
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
this.checkFatal(line);
|
|
95
|
+
}
|
|
96
|
+
/** Feed a line of stderr. */
|
|
97
|
+
OnStderr(line) {
|
|
98
|
+
this.pushLine(`[stderr] ${line}`);
|
|
99
|
+
if (this.settled)
|
|
100
|
+
return;
|
|
101
|
+
this.checkFatal(line);
|
|
102
|
+
}
|
|
103
|
+
/** Called when the process exits before readiness is detected. */
|
|
104
|
+
OnProcessExit(exitCode) {
|
|
105
|
+
if (this.settled)
|
|
106
|
+
return;
|
|
107
|
+
this.settle({
|
|
108
|
+
Ready: false,
|
|
109
|
+
Reason: `Process exited with code ${exitCode} before becoming ready`,
|
|
110
|
+
Output: this.capturedOutput,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/** Called when the readiness timeout expires. */
|
|
114
|
+
OnTimeout() {
|
|
115
|
+
if (this.settled)
|
|
116
|
+
return;
|
|
117
|
+
this.settle({
|
|
118
|
+
Ready: false,
|
|
119
|
+
Reason: `Readiness timeout (${Math.round(this.timeoutMs / 1000)}s) expired`,
|
|
120
|
+
Output: this.capturedOutput,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/** Get a copy of all captured output. */
|
|
124
|
+
GetCapturedOutput() {
|
|
125
|
+
return [...this.capturedOutput];
|
|
126
|
+
}
|
|
127
|
+
settle(result) {
|
|
128
|
+
this.settled = true;
|
|
129
|
+
this.resolvePromise(result);
|
|
130
|
+
}
|
|
131
|
+
pushLine(line) {
|
|
132
|
+
this.capturedOutput.push(line);
|
|
133
|
+
if (this.capturedOutput.length > MAX_CAPTURED_LINES) {
|
|
134
|
+
this.capturedOutput.shift();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
checkFatal(line) {
|
|
138
|
+
if (this.matchesAny(line, this.fatalPatterns)) {
|
|
139
|
+
this.settle({
|
|
140
|
+
Ready: false,
|
|
141
|
+
Reason: `Fatal error detected: ${line.trim()}`,
|
|
142
|
+
Output: this.capturedOutput,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
matchesAny(line, patterns) {
|
|
147
|
+
return patterns.some((p) => p.test(line));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// ---------------------------------------------------------------------------
|
|
151
|
+
// SmokeTestPhase
|
|
152
|
+
// ---------------------------------------------------------------------------
|
|
153
|
+
/**
|
|
154
|
+
* Phase I — Starts MJAPI and Explorer in parallel, detects readiness via
|
|
155
|
+
* stdout markers, confirms with HTTP, then cleans up.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* const smokeTest = new SmokeTestPhase();
|
|
160
|
+
* const result = await smokeTest.Run({
|
|
161
|
+
* Dir: '/path/to/install',
|
|
162
|
+
* Config: { APIPort: 4000, ExplorerPort: 4200 },
|
|
163
|
+
* Emitter: emitter,
|
|
164
|
+
* });
|
|
165
|
+
* if (result.ApiRunning && result.ExplorerRunning) {
|
|
166
|
+
* console.log('Smoke test passed!');
|
|
167
|
+
* }
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export class SmokeTestPhase {
|
|
171
|
+
constructor() {
|
|
172
|
+
this.processRunner = new ProcessRunner();
|
|
173
|
+
this.fileSystem = new FileSystemAdapter();
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Execute the smoke test phase: pre-check, detect ports, start services
|
|
177
|
+
* in parallel, verify readiness, clean up.
|
|
178
|
+
*
|
|
179
|
+
* @param context - Smoke test input with directory, config, and emitter.
|
|
180
|
+
* @returns Health check results for MJAPI and Explorer.
|
|
181
|
+
* @throws {InstallerError} With code `MISSING_GENERATED_ENTITIES` if the pre-check fails.
|
|
182
|
+
*/
|
|
183
|
+
async Run(context) {
|
|
184
|
+
const { Config: config, Emitter: emitter } = context;
|
|
185
|
+
// Pre-check: verify generated entities exist
|
|
186
|
+
await this.preCheck(context.Dir, emitter);
|
|
187
|
+
// Detect actual ports from project files
|
|
188
|
+
const ports = await this.detectServicePorts(context.Dir, config, emitter);
|
|
189
|
+
const apiUrl = `http://localhost:${ports.ApiPort}/`;
|
|
190
|
+
const explorerUrl = `http://localhost:${ports.ExplorerPort}/`;
|
|
191
|
+
// Start both services in parallel
|
|
192
|
+
emitter.Emit('step:progress', {
|
|
193
|
+
Type: 'step:progress',
|
|
194
|
+
Phase: 'smoke_test',
|
|
195
|
+
Message: 'Starting MJAPI and Explorer in parallel...',
|
|
196
|
+
});
|
|
197
|
+
const [apiResult, explorerResult] = await Promise.all([
|
|
198
|
+
this.verifyService(context.Dir, 'npm', ['run', 'start:api'], apiUrl, 'MJAPI', API_READINESS_TIMEOUT, API_PROCESS_TIMEOUT, API_READY_PATTERNS, emitter),
|
|
199
|
+
this.verifyService(context.Dir, 'npm', ['run', 'start:explorer'], explorerUrl, 'Explorer', EXPLORER_READINESS_TIMEOUT, EXPLORER_PROCESS_TIMEOUT, EXPLORER_READY_PATTERNS, emitter),
|
|
200
|
+
]);
|
|
201
|
+
// Report failures with diagnostic output
|
|
202
|
+
if (!apiResult.Running) {
|
|
203
|
+
this.reportServiceFailure('MJAPI', apiResult, emitter);
|
|
204
|
+
}
|
|
205
|
+
if (!explorerResult.Running) {
|
|
206
|
+
this.reportServiceFailure('Explorer', explorerResult, emitter);
|
|
207
|
+
}
|
|
208
|
+
// Clean up all processes by port
|
|
209
|
+
this.cleanupServices(ports.ApiPort, ports.ExplorerPort, emitter);
|
|
210
|
+
// Summary
|
|
211
|
+
if (apiResult.Running && explorerResult.Running) {
|
|
212
|
+
emitter.Emit('log', {
|
|
213
|
+
Type: 'log',
|
|
214
|
+
Level: 'info',
|
|
215
|
+
Message: `Smoke test passed. Services verified:\n MJAPI: ${apiUrl}\n Explorer: ${explorerUrl}`,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
ApiRunning: apiResult.Running,
|
|
220
|
+
ExplorerRunning: explorerResult.Running,
|
|
221
|
+
ApiUrl: apiUrl,
|
|
222
|
+
ExplorerUrl: explorerUrl,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
// ---------------------------------------------------------------------------
|
|
226
|
+
// Pre-check
|
|
227
|
+
// ---------------------------------------------------------------------------
|
|
228
|
+
async preCheck(dir, emitter) {
|
|
229
|
+
const genEntitiesPath = path.join(dir, 'node_modules', 'mj_generatedentities');
|
|
230
|
+
const exists = await this.fileSystem.DirectoryExists(genEntitiesPath);
|
|
231
|
+
if (!exists) {
|
|
232
|
+
const altPath = path.join(dir, 'GeneratedEntities');
|
|
233
|
+
const altExists = await this.fileSystem.DirectoryExists(altPath);
|
|
234
|
+
if (!altExists) {
|
|
235
|
+
throw new InstallerError('smoke_test', 'MISSING_GENERATED_ENTITIES', 'mj_generatedentities not found. MJAPI cannot start without generated entities.', 'Run "mj codegen" to generate entity artifacts, then re-run the installer.');
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
emitter.Emit('step:progress', {
|
|
239
|
+
Type: 'step:progress',
|
|
240
|
+
Phase: 'smoke_test',
|
|
241
|
+
Message: 'Pre-check passed: generated entities found.',
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
// ---------------------------------------------------------------------------
|
|
245
|
+
// Port detection
|
|
246
|
+
// ---------------------------------------------------------------------------
|
|
247
|
+
/**
|
|
248
|
+
* Detect actual service ports by reading project files.
|
|
249
|
+
*
|
|
250
|
+
* - MJAPI: reads `.env` for `GRAPHQL_PORT` (primary), `PORT` (fallback).
|
|
251
|
+
* - Explorer: reads `MJExplorer/package.json` start script for `--port`.
|
|
252
|
+
* - Falls back to config values, then hardcoded defaults.
|
|
253
|
+
*/
|
|
254
|
+
async detectServicePorts(dir, config, emitter) {
|
|
255
|
+
const apiPort = await this.detectApiPort(dir, config);
|
|
256
|
+
const explorerPort = await this.detectExplorerPort(dir, config);
|
|
257
|
+
emitter.Emit('log', {
|
|
258
|
+
Type: 'log',
|
|
259
|
+
Level: 'info',
|
|
260
|
+
Message: `Detected ports — MJAPI: ${apiPort}, Explorer: ${explorerPort}`,
|
|
261
|
+
});
|
|
262
|
+
return { ApiPort: apiPort, ExplorerPort: explorerPort };
|
|
263
|
+
}
|
|
264
|
+
async detectApiPort(dir, config) {
|
|
265
|
+
const envPaths = [
|
|
266
|
+
path.join(dir, 'packages', 'MJAPI', '.env'),
|
|
267
|
+
path.join(dir, '.env'),
|
|
268
|
+
];
|
|
269
|
+
for (const envPath of envPaths) {
|
|
270
|
+
try {
|
|
271
|
+
if (await this.fileSystem.FileExists(envPath)) {
|
|
272
|
+
const content = await this.fileSystem.ReadText(envPath);
|
|
273
|
+
// Primary: GRAPHQL_PORT (what MJServer actually reads)
|
|
274
|
+
const graphqlMatch = content.match(/^GRAPHQL_PORT\s*=\s*(\d+)/m);
|
|
275
|
+
if (graphqlMatch)
|
|
276
|
+
return parseInt(graphqlMatch[1], 10);
|
|
277
|
+
// Fallback: PORT (legacy variable name)
|
|
278
|
+
const portMatch = content.match(/^PORT\s*=\s*(\d+)/m);
|
|
279
|
+
if (portMatch)
|
|
280
|
+
return parseInt(portMatch[1], 10);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
catch {
|
|
284
|
+
// File read failed, try next path
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return config.APIPort ?? 4000;
|
|
288
|
+
}
|
|
289
|
+
async detectExplorerPort(dir, config) {
|
|
290
|
+
const pkgJsonPath = path.join(dir, 'packages', 'MJExplorer', 'package.json');
|
|
291
|
+
try {
|
|
292
|
+
if (await this.fileSystem.FileExists(pkgJsonPath)) {
|
|
293
|
+
const content = await this.fileSystem.ReadText(pkgJsonPath);
|
|
294
|
+
const pkg = JSON.parse(content);
|
|
295
|
+
const startScript = pkg.scripts?.start ?? '';
|
|
296
|
+
const match = startScript.match(/--port\s+(\d+)/);
|
|
297
|
+
if (match)
|
|
298
|
+
return parseInt(match[1], 10);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
catch {
|
|
302
|
+
// File read or parse failed, fall through
|
|
303
|
+
}
|
|
304
|
+
return config.ExplorerPort ?? 4200;
|
|
305
|
+
}
|
|
306
|
+
// ---------------------------------------------------------------------------
|
|
307
|
+
// Service verification
|
|
308
|
+
// ---------------------------------------------------------------------------
|
|
309
|
+
async verifyService(dir, command, args, url, label, readinessTimeoutMs, processTimeoutMs, readyPatterns, emitter) {
|
|
310
|
+
emitter.Emit('step:progress', {
|
|
311
|
+
Type: 'step:progress',
|
|
312
|
+
Phase: 'smoke_test',
|
|
313
|
+
Message: `Starting ${label}...`,
|
|
314
|
+
});
|
|
315
|
+
const watcher = new ReadinessWatcher(readyPatterns, FATAL_ERROR_PATTERNS, readinessTimeoutMs);
|
|
316
|
+
// Readiness timeout — separate from process lifetime timeout
|
|
317
|
+
const readinessTimer = setTimeout(() => watcher.OnTimeout(), readinessTimeoutMs);
|
|
318
|
+
// Start the service in the background
|
|
319
|
+
const processPromise = this.processRunner.Run(command, args, {
|
|
320
|
+
Cwd: dir,
|
|
321
|
+
TimeoutMs: processTimeoutMs,
|
|
322
|
+
OnStdout: (line) => {
|
|
323
|
+
watcher.OnStdout(line);
|
|
324
|
+
emitter.Emit('step:progress', {
|
|
325
|
+
Type: 'step:progress',
|
|
326
|
+
Phase: 'smoke_test',
|
|
327
|
+
Message: `[${label}] ${line.trim()}`,
|
|
328
|
+
});
|
|
329
|
+
},
|
|
330
|
+
OnStderr: (line) => {
|
|
331
|
+
watcher.OnStderr(line);
|
|
332
|
+
emitter.Emit('log', {
|
|
333
|
+
Type: 'log',
|
|
334
|
+
Level: 'verbose',
|
|
335
|
+
Message: `[${label}:stderr] ${line.trim()}`,
|
|
336
|
+
});
|
|
337
|
+
},
|
|
338
|
+
});
|
|
339
|
+
// When the process exits, notify the watcher (handles early crashes)
|
|
340
|
+
processPromise
|
|
341
|
+
.then((result) => watcher.OnProcessExit(result.ExitCode))
|
|
342
|
+
.catch(() => watcher.OnProcessExit(1));
|
|
343
|
+
// Wait for readiness via stdout
|
|
344
|
+
const readinessResult = await watcher.Promise;
|
|
345
|
+
clearTimeout(readinessTimer);
|
|
346
|
+
if (readinessResult.Ready) {
|
|
347
|
+
// Confirm with a single HTTP health check
|
|
348
|
+
const httpOk = await this.singleHealthCheck(url);
|
|
349
|
+
if (httpOk) {
|
|
350
|
+
emitter.Emit('log', {
|
|
351
|
+
Type: 'log',
|
|
352
|
+
Level: 'info',
|
|
353
|
+
Message: `${label} is ready at ${url} (stdout + HTTP confirmed).`,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
emitter.Emit('log', {
|
|
358
|
+
Type: 'log',
|
|
359
|
+
Level: 'info',
|
|
360
|
+
Message: `${label} stdout indicates ready but HTTP not responding. Treating as ready.`,
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
// Suppress unhandled rejection from the background process
|
|
364
|
+
processPromise.catch(() => { });
|
|
365
|
+
return { Running: true, Output: watcher.GetCapturedOutput() };
|
|
366
|
+
}
|
|
367
|
+
// Not ready — wait for the process to finish before returning
|
|
368
|
+
processPromise.catch(() => { });
|
|
369
|
+
return {
|
|
370
|
+
Running: false,
|
|
371
|
+
Output: watcher.GetCapturedOutput(),
|
|
372
|
+
Reason: readinessResult.Reason,
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
// ---------------------------------------------------------------------------
|
|
376
|
+
// HTTP health check (single attempt, not polling)
|
|
377
|
+
// ---------------------------------------------------------------------------
|
|
378
|
+
/**
|
|
379
|
+
* Single HTTP health check. Uses `127.0.0.1` instead of `localhost` to
|
|
380
|
+
* avoid IPv6 resolution issues on Windows.
|
|
381
|
+
*/
|
|
382
|
+
async singleHealthCheck(url) {
|
|
383
|
+
const healthUrl = url.replace('localhost', '127.0.0.1');
|
|
384
|
+
try {
|
|
385
|
+
const response = await fetch(healthUrl, {
|
|
386
|
+
signal: AbortSignal.timeout(5000),
|
|
387
|
+
});
|
|
388
|
+
return response.ok || response.status < 500;
|
|
389
|
+
}
|
|
390
|
+
catch {
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
// ---------------------------------------------------------------------------
|
|
395
|
+
// Error reporting
|
|
396
|
+
// ---------------------------------------------------------------------------
|
|
397
|
+
reportServiceFailure(label, result, emitter) {
|
|
398
|
+
const tailLines = result.Output.slice(-MAX_DIAGNOSTIC_LINES);
|
|
399
|
+
const outputSnippet = tailLines.length > 0
|
|
400
|
+
? `\nLast ${tailLines.length} lines of output:\n${tailLines.map((l) => ` ${l.trim()}`).join('\n')}`
|
|
401
|
+
: '\n(No output captured)';
|
|
402
|
+
emitter.Emit('warn', {
|
|
403
|
+
Type: 'warn',
|
|
404
|
+
Phase: 'smoke_test',
|
|
405
|
+
Message: `${label} failed to start.${result.Reason ? ` Reason: ${result.Reason}` : ''}${outputSnippet}`,
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
// ---------------------------------------------------------------------------
|
|
409
|
+
// Cleanup
|
|
410
|
+
// ---------------------------------------------------------------------------
|
|
411
|
+
/**
|
|
412
|
+
* Kill any processes still listening on the smoke test ports.
|
|
413
|
+
* Without this, turbo/node processes survive the parent shell being killed
|
|
414
|
+
* and block future starts with EADDRINUSE.
|
|
415
|
+
*/
|
|
416
|
+
cleanupServices(apiPort, explorerPort, emitter) {
|
|
417
|
+
emitter.Emit('step:progress', {
|
|
418
|
+
Type: 'step:progress',
|
|
419
|
+
Phase: 'smoke_test',
|
|
420
|
+
Message: 'Cleaning up smoke test processes...',
|
|
421
|
+
});
|
|
422
|
+
this.processRunner.killByPort(apiPort);
|
|
423
|
+
this.processRunner.killByPort(explorerPort);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
//# sourceMappingURL=SmokeTestPhase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmokeTestPhase.js","sourceRoot":"","sources":["../../src/phases/SmokeTestPhase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,cAAc,EAAE,MAAM,6BA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C5B,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,YAAY;YACnB,OAAO,EAAE,qCAAqC;SAC/C,CAAC,CAAC;QAEH,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/installer",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
"version": "5.5.0",
|
|
4
|
+
"description": "Headless, event-driven installer engine for MemberJunction",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"/dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc && tsc-alias -f",
|
|
13
|
+
"test": "vitest run",
|
|
14
|
+
"test:watch": "vitest"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"adm-zip": "^0.5.16"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/adm-zip": "^0.5.7",
|
|
21
|
+
"typescript": "^5.9.3",
|
|
22
|
+
"tsc-alias": "^1.8.15"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/MemberJunction/MJ"
|
|
27
|
+
},
|
|
28
|
+
"license": "ISC"
|
|
10
29
|
}
|
package/README.md
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# @memberjunction/installer
|
|
2
|
-
|
|
3
|
-
## ⚠️ IMPORTANT NOTICE ⚠️
|
|
4
|
-
|
|
5
|
-
**This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
|
|
6
|
-
|
|
7
|
-
This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
|
|
8
|
-
|
|
9
|
-
## Purpose
|
|
10
|
-
|
|
11
|
-
This package exists to:
|
|
12
|
-
1. Configure OIDC trusted publishing for the package name `@memberjunction/installer`
|
|
13
|
-
2. Enable secure, token-less publishing from CI/CD workflows
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
15
|
-
|
|
16
|
-
## What is OIDC Trusted Publishing?
|
|
17
|
-
|
|
18
|
-
OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
|
|
19
|
-
|
|
20
|
-
## Setup Instructions
|
|
21
|
-
|
|
22
|
-
To properly configure OIDC trusted publishing for this package:
|
|
23
|
-
|
|
24
|
-
1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
|
|
25
|
-
2. Configure the trusted publisher (e.g., GitHub Actions)
|
|
26
|
-
3. Specify the repository and workflow that should be allowed to publish
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
28
|
-
|
|
29
|
-
## DO NOT USE THIS PACKAGE
|
|
30
|
-
|
|
31
|
-
This package is a placeholder for OIDC configuration only. It:
|
|
32
|
-
- Contains no executable code
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
36
|
-
|
|
37
|
-
## More Information
|
|
38
|
-
|
|
39
|
-
For more details about npm's trusted publishing feature, see:
|
|
40
|
-
- [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
|
|
41
|
-
- [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
**Maintained for OIDC setup purposes only**
|