@fgv/ts-res-browser-cli 5.0.0-2 → 5.0.0-20
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 +35 -11
- package/lib/cli.d.ts +0 -4
- package/lib/cli.js +8 -17
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/options.d.ts +5 -0
- package/lib/simpleBrowserLauncher.d.ts +32 -0
- package/lib/{browserLauncher.js → simpleBrowserLauncher.js} +53 -125
- package/lib/zipArchiver.d.ts +2 -14
- package/lib/zipArchiver.js +11 -72
- package/package.json +11 -12
- package/src/cli.ts +17 -20
- package/src/index.ts +1 -1
- package/src/options.ts +6 -0
- package/src/{browserLauncher.ts → simpleBrowserLauncher.ts} +56 -144
- package/src/zipArchiver.ts +12 -97
- package/.rush/temp/45629f175c0b2c015132e9451c317583db1c0e2d.tar.log +0 -32
- package/.rush/temp/chunked-rush-logs/ts-res-browser-cli.build.chunks.jsonl +0 -5
- package/.rush/temp/operation/build/all.log +0 -5
- package/.rush/temp/operation/build/log-chunks.jsonl +0 -5
- package/.rush/temp/operation/build/state.json +0 -3
- package/.rush/temp/shrinkwrap-deps.json +0 -651
- package/lib/browserLauncher.d.ts +0 -53
- package/lib/browserLauncher.d.ts.map +0 -1
- package/lib/browserLauncher.js.map +0 -1
- package/lib/cli.d.ts.map +0 -1
- package/lib/cli.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/options.d.ts.map +0 -1
- package/lib/options.js.map +0 -1
- package/lib/zipArchiver.d.ts.map +0 -1
- package/lib/zipArchiver.js.map +0 -1
- package/rush-logs/ts-res-browser-cli.build.cache.log +0 -3
- package/rush-logs/ts-res-browser-cli.build.log +0 -5
- package/tsconfig.json +0 -7
package/src/cli.ts
CHANGED
|
@@ -27,20 +27,19 @@ import { promises as fs } from 'fs';
|
|
|
27
27
|
import * as path from 'path';
|
|
28
28
|
|
|
29
29
|
import { IBrowseOptions, IBrowseCommandOptions } from './options';
|
|
30
|
-
import {
|
|
30
|
+
import { SimpleBrowserLauncher } from './simpleBrowserLauncher';
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Main CLI class for ts-res-browser-cli
|
|
34
34
|
*/
|
|
35
35
|
export class TsResBrowserCliApp {
|
|
36
36
|
private readonly _program: Command;
|
|
37
|
-
private readonly _launcher:
|
|
37
|
+
private readonly _launcher: SimpleBrowserLauncher;
|
|
38
38
|
|
|
39
39
|
public constructor() {
|
|
40
40
|
this._program = new Command();
|
|
41
|
-
this._launcher = new
|
|
41
|
+
this._launcher = new SimpleBrowserLauncher();
|
|
42
42
|
this._setupCommands();
|
|
43
|
-
this._setupGracefulShutdown();
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
/**
|
|
@@ -89,6 +88,11 @@ export class TsResBrowserCliApp {
|
|
|
89
88
|
.option('--no-open', 'Do not open browser automatically')
|
|
90
89
|
.option('--interactive', 'Launch in interactive mode with sample data', false)
|
|
91
90
|
.option('--dev', 'Automatically start development server locally', false)
|
|
91
|
+
.option(
|
|
92
|
+
'--serve',
|
|
93
|
+
'Start server (dev in monorepo, serve in published packages) and connect automatically',
|
|
94
|
+
false
|
|
95
|
+
)
|
|
92
96
|
.action(async (options) => {
|
|
93
97
|
// If no options provided, show help
|
|
94
98
|
if (!this._hasOptions(options)) {
|
|
@@ -130,6 +134,11 @@ export class TsResBrowserCliApp {
|
|
|
130
134
|
.option('--no-open', 'Do not open browser automatically')
|
|
131
135
|
.option('--interactive', 'Launch in interactive mode with sample data', false)
|
|
132
136
|
.option('--dev', 'Automatically start development server locally', false)
|
|
137
|
+
.option(
|
|
138
|
+
'--serve',
|
|
139
|
+
'Start server (dev in monorepo, serve in published packages) and connect automatically',
|
|
140
|
+
false
|
|
141
|
+
)
|
|
133
142
|
.action(async (options) => {
|
|
134
143
|
await this._handleBrowseCommand(options);
|
|
135
144
|
});
|
|
@@ -167,7 +176,8 @@ export class TsResBrowserCliApp {
|
|
|
167
176
|
options.reduceQualifiers ||
|
|
168
177
|
options.interactive ||
|
|
169
178
|
options.url ||
|
|
170
|
-
options.dev
|
|
179
|
+
options.dev ||
|
|
180
|
+
options.serve
|
|
171
181
|
);
|
|
172
182
|
}
|
|
173
183
|
|
|
@@ -398,7 +408,8 @@ export class TsResBrowserCliApp {
|
|
|
398
408
|
url: options.url,
|
|
399
409
|
open: options.open,
|
|
400
410
|
interactive: options.interactive || false,
|
|
401
|
-
dev: options.dev || false
|
|
411
|
+
dev: options.dev || false,
|
|
412
|
+
serve: options.serve || false
|
|
402
413
|
};
|
|
403
414
|
|
|
404
415
|
return succeed(browseOptions);
|
|
@@ -406,18 +417,4 @@ export class TsResBrowserCliApp {
|
|
|
406
417
|
return fail(`Failed to parse options: ${error}`);
|
|
407
418
|
}
|
|
408
419
|
}
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Sets up graceful shutdown handling
|
|
412
|
-
*/
|
|
413
|
-
private _setupGracefulShutdown(): void {
|
|
414
|
-
const shutdown = (signal: string) => {
|
|
415
|
-
console.log(`\nReceived ${signal}, shutting down gracefully...`);
|
|
416
|
-
this._launcher.shutdown();
|
|
417
|
-
process.exit(0);
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
process.on('SIGINT', () => shutdown('SIGINT'));
|
|
421
|
-
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
|
422
|
-
}
|
|
423
420
|
}
|
package/src/index.ts
CHANGED
package/src/options.ts
CHANGED
|
@@ -95,6 +95,11 @@ export interface IBrowseOptions {
|
|
|
95
95
|
*/
|
|
96
96
|
dev?: boolean;
|
|
97
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Whether to start server (dev in monorepo, serve in published packages) and connect automatically
|
|
100
|
+
*/
|
|
101
|
+
serve?: boolean;
|
|
102
|
+
|
|
98
103
|
/**
|
|
99
104
|
* Whether to use ZIP loading mode (internal flag)
|
|
100
105
|
*/
|
|
@@ -130,4 +135,5 @@ export interface IBrowseCommandOptions {
|
|
|
130
135
|
interactive?: boolean;
|
|
131
136
|
url?: string;
|
|
132
137
|
dev?: boolean;
|
|
138
|
+
serve?: boolean;
|
|
133
139
|
}
|
|
@@ -20,24 +20,33 @@
|
|
|
20
20
|
* SOFTWARE.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
import { exec
|
|
23
|
+
import { exec } from 'child_process';
|
|
24
24
|
import * as path from 'path';
|
|
25
25
|
import * as http from 'http';
|
|
26
26
|
import { Result, succeed, fail } from '@fgv/ts-utils';
|
|
27
27
|
import { IBrowseOptions } from './options';
|
|
28
28
|
import { zipArchiver } from './zipArchiver';
|
|
29
|
-
import * as fs from 'fs';
|
|
30
29
|
|
|
31
30
|
/**
|
|
32
|
-
*
|
|
31
|
+
* Simplified browser launcher using direct dependency on ts-res-browser
|
|
33
32
|
*/
|
|
34
|
-
export class
|
|
35
|
-
private _devServer?: ChildProcess;
|
|
33
|
+
export class SimpleBrowserLauncher {
|
|
36
34
|
/**
|
|
37
35
|
* Launches the browser with the specified options
|
|
38
36
|
*/
|
|
39
37
|
public async launch(options: IBrowseOptions): Promise<Result<void>> {
|
|
40
38
|
try {
|
|
39
|
+
// Validate options before proceeding
|
|
40
|
+
if (options.interactive && !options.dev && !options.serve && !options.url) {
|
|
41
|
+
return fail(
|
|
42
|
+
'Interactive mode requires either --dev/--serve to start a local server or --url to specify a remote server.\n\n' +
|
|
43
|
+
'Examples:\n' +
|
|
44
|
+
' ts-res-browser-cli --interactive --dev\n' +
|
|
45
|
+
' ts-res-browser-cli --interactive --serve\n' +
|
|
46
|
+
' ts-res-browser-cli --interactive --url https://example.com/ts-res-browser'
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
41
50
|
// Check if we need to create a ZIP archive for file-based inputs
|
|
42
51
|
let zipCreated = false;
|
|
43
52
|
let finalOptions = { ...options };
|
|
@@ -70,28 +79,16 @@ export class BrowserLauncher {
|
|
|
70
79
|
zipCreated = true;
|
|
71
80
|
}
|
|
72
81
|
|
|
73
|
-
// Start
|
|
74
|
-
if (finalOptions.dev && !finalOptions.url) {
|
|
82
|
+
// Start server if requested
|
|
83
|
+
if ((finalOptions.dev || finalOptions.serve) && !finalOptions.url) {
|
|
75
84
|
if (!finalOptions.quiet) {
|
|
76
|
-
console.log('Starting TS-RES Browser
|
|
85
|
+
console.log('Starting TS-RES Browser server...');
|
|
77
86
|
}
|
|
78
87
|
|
|
79
|
-
const serverResult = await this.
|
|
88
|
+
const serverResult = await this._startServer(finalOptions);
|
|
80
89
|
if (serverResult.isFailure()) {
|
|
81
90
|
return serverResult;
|
|
82
91
|
}
|
|
83
|
-
|
|
84
|
-
// Wait for server to be ready
|
|
85
|
-
const port = options.port || 3000;
|
|
86
|
-
const readyResult = await this._waitForServerReady(port, options.verbose || false);
|
|
87
|
-
if (readyResult.isFailure()) {
|
|
88
|
-
this._stopDevServer();
|
|
89
|
-
return readyResult;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (!options.quiet) {
|
|
93
|
-
console.log(`Development server started on port ${port}`);
|
|
94
|
-
}
|
|
95
92
|
}
|
|
96
93
|
|
|
97
94
|
// Build URL with parameters
|
|
@@ -136,6 +133,41 @@ export class BrowserLauncher {
|
|
|
136
133
|
}
|
|
137
134
|
}
|
|
138
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Starts the server using ts-res-browser CLI directly
|
|
138
|
+
*/
|
|
139
|
+
private async _startServer(options: IBrowseOptions): Promise<Result<void>> {
|
|
140
|
+
try {
|
|
141
|
+
// Use ts-res-browser directly from node_modules
|
|
142
|
+
const browserPath = require.resolve('@fgv/ts-res-browser/cli.js');
|
|
143
|
+
const command = `node "${browserPath}" ${options.dev ? 'dev' : 'serve'}`;
|
|
144
|
+
|
|
145
|
+
if (options.verbose) {
|
|
146
|
+
console.log(`Running: ${command}`);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return new Promise((resolve) => {
|
|
150
|
+
const child = exec(command, (error) => {
|
|
151
|
+
if (error) {
|
|
152
|
+
resolve(fail(`Failed to start server: ${error.message}`));
|
|
153
|
+
} else {
|
|
154
|
+
resolve(succeed(undefined));
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// Give server time to start, then assume success
|
|
159
|
+
setTimeout(() => {
|
|
160
|
+
if (options.verbose) {
|
|
161
|
+
console.log('Server startup initiated');
|
|
162
|
+
}
|
|
163
|
+
resolve(succeed(undefined));
|
|
164
|
+
}, 2000);
|
|
165
|
+
});
|
|
166
|
+
} catch (error) {
|
|
167
|
+
return fail(`Failed to start server: ${error}`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
139
171
|
/**
|
|
140
172
|
* Opens the browser to the specified URL
|
|
141
173
|
*/
|
|
@@ -161,8 +193,9 @@ export class BrowserLauncher {
|
|
|
161
193
|
* Builds the URL with query parameters based on options
|
|
162
194
|
*/
|
|
163
195
|
private _buildUrl(options: IBrowseOptions): string {
|
|
164
|
-
// Use provided URL or default
|
|
165
|
-
const
|
|
196
|
+
// Use provided URL or default based on server type
|
|
197
|
+
const defaultPort = options.dev ? 3000 : 8080;
|
|
198
|
+
const baseUrl = options.url || `http://localhost:${options.port || defaultPort}`;
|
|
166
199
|
const params = new URLSearchParams();
|
|
167
200
|
|
|
168
201
|
if (options.input) {
|
|
@@ -213,120 +246,6 @@ export class BrowserLauncher {
|
|
|
213
246
|
return queryString ? `${baseUrl}?${queryString}` : baseUrl;
|
|
214
247
|
}
|
|
215
248
|
|
|
216
|
-
/**
|
|
217
|
-
* Starts the development server for ts-res-browser
|
|
218
|
-
*/
|
|
219
|
-
private async _startDevServer(options: IBrowseOptions): Promise<Result<void>> {
|
|
220
|
-
try {
|
|
221
|
-
// Find the ts-res-browser project directory
|
|
222
|
-
// Assume we're running from tools/ts-res-browser-cli, so go up and over to tools/ts-res-browser
|
|
223
|
-
const browserProjectPath = path.resolve(__dirname, '../../ts-res-browser');
|
|
224
|
-
|
|
225
|
-
if (options.verbose) {
|
|
226
|
-
console.log(`Looking for ts-res-browser at: ${browserProjectPath}`);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
const port = options.port || 3000;
|
|
230
|
-
const env = { ...process.env, PORT: port.toString() };
|
|
231
|
-
|
|
232
|
-
this._devServer = spawn('rushx', ['dev'], {
|
|
233
|
-
cwd: browserProjectPath,
|
|
234
|
-
env,
|
|
235
|
-
stdio: options.verbose ? 'inherit' : ['ignore', 'pipe', 'pipe']
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
this._devServer.on('error', (error) => {
|
|
239
|
-
return fail(`Failed to start development server: ${error}`);
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
// Give the server a moment to start
|
|
243
|
-
await this._sleep(3000);
|
|
244
|
-
|
|
245
|
-
if (this._devServer && !this._devServer.killed) {
|
|
246
|
-
if (options.verbose) {
|
|
247
|
-
console.log('Development server process started successfully');
|
|
248
|
-
}
|
|
249
|
-
return succeed(undefined);
|
|
250
|
-
} else {
|
|
251
|
-
return fail('Development server process failed to start');
|
|
252
|
-
}
|
|
253
|
-
} catch (error) {
|
|
254
|
-
return fail(`Failed to start development server: ${error}`);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Waits for the development server to be ready by checking HTTP availability
|
|
260
|
-
*/
|
|
261
|
-
private async _waitForServerReady(
|
|
262
|
-
port: number,
|
|
263
|
-
verbose: boolean,
|
|
264
|
-
maxAttempts: number = 60
|
|
265
|
-
): Promise<Result<void>> {
|
|
266
|
-
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
267
|
-
try {
|
|
268
|
-
const isReady = await this._checkServerHealth(port);
|
|
269
|
-
if (isReady) {
|
|
270
|
-
if (verbose) {
|
|
271
|
-
console.log(`Server is ready at http://localhost:${port}`);
|
|
272
|
-
}
|
|
273
|
-
return succeed(undefined);
|
|
274
|
-
}
|
|
275
|
-
} catch (error) {
|
|
276
|
-
// Server not ready yet, continue waiting
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
if (verbose && attempt % 10 === 0) {
|
|
280
|
-
console.log(`Waiting for server to be ready... (attempt ${attempt}/${maxAttempts})`);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
await this._sleep(1000);
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
return fail(`Server did not become ready after ${maxAttempts} attempts`);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Checks if the server is responding
|
|
291
|
-
*/
|
|
292
|
-
private async _checkServerHealth(port: number): Promise<boolean> {
|
|
293
|
-
return new Promise((resolve) => {
|
|
294
|
-
const request = http.get(`http://localhost:${port}`, (res) => {
|
|
295
|
-
resolve(res.statusCode !== undefined && res.statusCode >= 200 && res.statusCode < 400);
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
request.on('error', () => {
|
|
299
|
-
resolve(false);
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
request.setTimeout(3000, () => {
|
|
303
|
-
request.destroy();
|
|
304
|
-
resolve(false);
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Stops the development server
|
|
311
|
-
*/
|
|
312
|
-
private _stopDevServer(): void {
|
|
313
|
-
if (this._devServer && !this._devServer.killed) {
|
|
314
|
-
this._devServer.kill('SIGTERM');
|
|
315
|
-
setTimeout(() => {
|
|
316
|
-
if (this._devServer && !this._devServer.killed) {
|
|
317
|
-
this._devServer.kill('SIGKILL');
|
|
318
|
-
}
|
|
319
|
-
}, 5000);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Sleep for the specified number of milliseconds
|
|
325
|
-
*/
|
|
326
|
-
private _sleep(ms: number): Promise<void> {
|
|
327
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
328
|
-
}
|
|
329
|
-
|
|
330
249
|
/**
|
|
331
250
|
* Determines if a ZIP archive should be created based on the options
|
|
332
251
|
*/
|
|
@@ -356,11 +275,4 @@ export class BrowserLauncher {
|
|
|
356
275
|
return fail(`Failed to create ZIP archive: ${error instanceof Error ? error.message : String(error)}`);
|
|
357
276
|
}
|
|
358
277
|
}
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* Graceful shutdown - stops development server if running
|
|
362
|
-
*/
|
|
363
|
-
public shutdown(): void {
|
|
364
|
-
this._stopDevServer();
|
|
365
|
-
}
|
|
366
278
|
}
|
package/src/zipArchiver.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as archiver from 'archiver';
|
|
2
1
|
import * as fs from 'fs';
|
|
3
2
|
import * as path from 'path';
|
|
4
3
|
import * as os from 'os';
|
|
5
4
|
import { Result, succeed, fail } from '@fgv/ts-utils';
|
|
5
|
+
import { ZipArchive } from '@fgv/ts-res';
|
|
6
6
|
|
|
7
7
|
export interface ZipArchiveOptions {
|
|
8
8
|
input?: string;
|
|
@@ -12,21 +12,7 @@ export interface ZipArchiveOptions {
|
|
|
12
12
|
|
|
13
13
|
export interface ZipArchiveResult {
|
|
14
14
|
zipPath: string;
|
|
15
|
-
manifest:
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface ZipManifest {
|
|
19
|
-
timestamp: string;
|
|
20
|
-
input?: {
|
|
21
|
-
type: 'file' | 'directory';
|
|
22
|
-
originalPath: string;
|
|
23
|
-
archivePath: string;
|
|
24
|
-
};
|
|
25
|
-
config?: {
|
|
26
|
-
type: 'file';
|
|
27
|
-
originalPath: string;
|
|
28
|
-
archivePath: string;
|
|
29
|
-
};
|
|
15
|
+
manifest: ZipArchive.IZipArchiveManifest;
|
|
30
16
|
}
|
|
31
17
|
|
|
32
18
|
export class ZipArchiver {
|
|
@@ -45,92 +31,21 @@ export class ZipArchiver {
|
|
|
45
31
|
fs.mkdirSync(outputDir, { recursive: true });
|
|
46
32
|
}
|
|
47
33
|
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// Create manifest
|
|
54
|
-
const manifest: ZipManifest = {
|
|
55
|
-
timestamp: new Date().toISOString()
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
// Promise to handle async archiving
|
|
59
|
-
const archivePromise = new Promise<void>((resolve, reject) => {
|
|
60
|
-
output.on('close', () => {
|
|
61
|
-
resolve();
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
output.on('error', (err: Error) => {
|
|
65
|
-
reject(err);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
archive.on('error', (err: Error) => {
|
|
69
|
-
reject(err);
|
|
70
|
-
});
|
|
34
|
+
// Create ZIP archive using the new zip-archive packlet
|
|
35
|
+
const creator = new ZipArchive.ZipArchiveCreator();
|
|
36
|
+
const createResult = await creator.createFromBuffer({
|
|
37
|
+
inputPath: options.input,
|
|
38
|
+
configPath: options.config
|
|
71
39
|
});
|
|
72
40
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
// Add input files/directory
|
|
77
|
-
if (options.input) {
|
|
78
|
-
const inputPath = path.resolve(options.input);
|
|
79
|
-
|
|
80
|
-
if (!fs.existsSync(inputPath)) {
|
|
81
|
-
return fail(`Input path does not exist: ${inputPath}`);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const stats = fs.statSync(inputPath);
|
|
85
|
-
if (stats.isDirectory()) {
|
|
86
|
-
// Add entire directory recursively, preserving structure
|
|
87
|
-
const dirName = path.basename(inputPath);
|
|
88
|
-
archive.directory(inputPath, `input/${dirName}`);
|
|
89
|
-
manifest.input = {
|
|
90
|
-
type: 'directory',
|
|
91
|
-
originalPath: inputPath,
|
|
92
|
-
archivePath: `input/${dirName}`
|
|
93
|
-
};
|
|
94
|
-
} else if (stats.isFile()) {
|
|
95
|
-
// Add single file
|
|
96
|
-
const fileName = path.basename(inputPath);
|
|
97
|
-
archive.file(inputPath, { name: `input/${fileName}` });
|
|
98
|
-
manifest.input = {
|
|
99
|
-
type: 'file',
|
|
100
|
-
originalPath: inputPath,
|
|
101
|
-
archivePath: `input/${fileName}`
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Add config file
|
|
107
|
-
if (options.config) {
|
|
108
|
-
const configPath = path.resolve(options.config);
|
|
109
|
-
|
|
110
|
-
if (!fs.existsSync(configPath)) {
|
|
111
|
-
return fail(`Config file does not exist: ${configPath}`);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const stats = fs.statSync(configPath);
|
|
115
|
-
if (!stats.isFile()) {
|
|
116
|
-
return fail(`Config path must be a file: ${configPath}`);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const fileName = path.basename(configPath);
|
|
120
|
-
archive.file(configPath, { name: `config/${fileName}` });
|
|
121
|
-
manifest.config = {
|
|
122
|
-
type: 'file',
|
|
123
|
-
originalPath: configPath,
|
|
124
|
-
archivePath: `config/${fileName}`
|
|
125
|
-
};
|
|
41
|
+
if (createResult.isFailure()) {
|
|
42
|
+
return fail(createResult.message);
|
|
126
43
|
}
|
|
127
44
|
|
|
128
|
-
|
|
129
|
-
archive.append(JSON.stringify(manifest, null, 2), { name: 'manifest.json' });
|
|
45
|
+
const { zipBuffer, manifest } = createResult.value;
|
|
130
46
|
|
|
131
|
-
//
|
|
132
|
-
|
|
133
|
-
await archivePromise;
|
|
47
|
+
// Write the ZIP buffer to disk
|
|
48
|
+
fs.writeFileSync(zipPath, zipBuffer);
|
|
134
49
|
|
|
135
50
|
return succeed({
|
|
136
51
|
zipPath,
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
Start time: Tue Jul 22 2025 06:50:10 GMT+0000 (Coordinated Universal Time)
|
|
2
|
-
Invoking "/usr/bin/tar -c -f /home/runner/work/fgv/fgv/common/temp/build-cache/45629f175c0b2c015132e9451c317583db1c0e2d-2e166ad7fa3e8197.temp -z --files-from=-"
|
|
3
|
-
|
|
4
|
-
======= BEGIN PROCESS INPUT ======
|
|
5
|
-
.rush/temp/operation/build/all.log
|
|
6
|
-
.rush/temp/operation/build/log-chunks.jsonl
|
|
7
|
-
.rush/temp/operation/build/state.json
|
|
8
|
-
lib/browserLauncher.d.ts
|
|
9
|
-
lib/browserLauncher.d.ts.map
|
|
10
|
-
lib/browserLauncher.js
|
|
11
|
-
lib/browserLauncher.js.map
|
|
12
|
-
lib/cli.d.ts
|
|
13
|
-
lib/cli.d.ts.map
|
|
14
|
-
lib/cli.js
|
|
15
|
-
lib/cli.js.map
|
|
16
|
-
lib/index.d.ts
|
|
17
|
-
lib/index.d.ts.map
|
|
18
|
-
lib/index.js
|
|
19
|
-
lib/index.js.map
|
|
20
|
-
lib/options.d.ts
|
|
21
|
-
lib/options.d.ts.map
|
|
22
|
-
lib/options.js
|
|
23
|
-
lib/options.js.map
|
|
24
|
-
lib/zipArchiver.d.ts
|
|
25
|
-
lib/zipArchiver.d.ts.map
|
|
26
|
-
lib/zipArchiver.js
|
|
27
|
-
lib/zipArchiver.js.map
|
|
28
|
-
======== END PROCESS INPUT =======
|
|
29
|
-
======= BEGIN PROCESS OUTPUT =======
|
|
30
|
-
======== END PROCESS OUTPUT ========
|
|
31
|
-
|
|
32
|
-
Exited with code "0"
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
{"kind":"O","text":"Invoking: heft build --clean \n"}
|
|
2
|
-
{"kind":"O","text":" ---- build started ---- \n"}
|
|
3
|
-
{"kind":"O","text":"[build:typescript] Using TypeScript version 5.8.3\n"}
|
|
4
|
-
{"kind":"O","text":" ---- build finished (4.946s) ---- \n"}
|
|
5
|
-
{"kind":"O","text":"-------------------- Finished (4.952s) --------------------\n"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
{"kind":"O","text":"Invoking: heft build --clean \n"}
|
|
2
|
-
{"kind":"O","text":" ---- build started ---- \n"}
|
|
3
|
-
{"kind":"O","text":"[build:typescript] Using TypeScript version 5.8.3\n"}
|
|
4
|
-
{"kind":"O","text":" ---- build finished (4.946s) ---- \n"}
|
|
5
|
-
{"kind":"O","text":"-------------------- Finished (4.952s) --------------------\n"}
|