@fgv/ts-res-browser-cli 5.0.0-5 → 5.0.0-7
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/.rush/temp/{fc74ac6ba66e84321a437fc3494453b741d38afe.tar.log → 7c88cbdeb72af5203580a2129e58017054b28dac.tar.log} +6 -6
- package/.rush/temp/chunked-rush-logs/ts-res-browser-cli.build.chunks.jsonl +2 -2
- package/.rush/temp/operation/build/all.log +2 -2
- package/.rush/temp/operation/build/log-chunks.jsonl +2 -2
- package/.rush/temp/operation/build/state.json +1 -1
- package/.rush/temp/shrinkwrap-deps.json +1 -1
- package/README.md +35 -11
- package/lib/cli.d.ts +0 -4
- package/lib/cli.d.ts.map +1 -1
- package/lib/cli.js +8 -17
- package/lib/cli.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/options.d.ts +5 -0
- package/lib/options.d.ts.map +1 -1
- package/lib/options.js.map +1 -1
- package/lib/simpleBrowserLauncher.d.ts +32 -0
- package/lib/simpleBrowserLauncher.d.ts.map +1 -0
- package/lib/{browserLauncher.js → simpleBrowserLauncher.js} +53 -163
- package/lib/simpleBrowserLauncher.js.map +1 -0
- package/package.json +7 -6
- package/rush-logs/ts-res-browser-cli.build.cache.log +1 -1
- package/rush-logs/ts-res-browser-cli.build.log +2 -2
- 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 -186
- package/lib/browserLauncher.d.ts +0 -57
- package/lib/browserLauncher.d.ts.map +0 -1
- package/lib/browserLauncher.js.map +0 -1
|
@@ -54,22 +54,28 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
54
54
|
};
|
|
55
55
|
})();
|
|
56
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
-
exports.
|
|
57
|
+
exports.SimpleBrowserLauncher = void 0;
|
|
58
58
|
const child_process_1 = require("child_process");
|
|
59
59
|
const path = __importStar(require("path"));
|
|
60
|
-
const http = __importStar(require("http"));
|
|
61
60
|
const ts_utils_1 = require("@fgv/ts-utils");
|
|
62
61
|
const zipArchiver_1 = require("./zipArchiver");
|
|
63
|
-
const fs = __importStar(require("fs"));
|
|
64
62
|
/**
|
|
65
|
-
*
|
|
63
|
+
* Simplified browser launcher using direct dependency on ts-res-browser
|
|
66
64
|
*/
|
|
67
|
-
class
|
|
65
|
+
class SimpleBrowserLauncher {
|
|
68
66
|
/**
|
|
69
67
|
* Launches the browser with the specified options
|
|
70
68
|
*/
|
|
71
69
|
async launch(options) {
|
|
72
70
|
try {
|
|
71
|
+
// Validate options before proceeding
|
|
72
|
+
if (options.interactive && !options.dev && !options.serve && !options.url) {
|
|
73
|
+
return (0, ts_utils_1.fail)('Interactive mode requires either --dev/--serve to start a local server or --url to specify a remote server.\n\n' +
|
|
74
|
+
'Examples:\n' +
|
|
75
|
+
' ts-res-browser-cli --interactive --dev\n' +
|
|
76
|
+
' ts-res-browser-cli --interactive --serve\n' +
|
|
77
|
+
' ts-res-browser-cli --interactive --url https://example.com/ts-res-browser');
|
|
78
|
+
}
|
|
73
79
|
// Check if we need to create a ZIP archive for file-based inputs
|
|
74
80
|
let zipCreated = false;
|
|
75
81
|
let finalOptions = Object.assign({}, options);
|
|
@@ -91,25 +97,15 @@ class BrowserLauncher {
|
|
|
91
97
|
loadZip: true, zipFile: zipFileName, zipPath: zipResult.value.zipPath });
|
|
92
98
|
zipCreated = true;
|
|
93
99
|
}
|
|
94
|
-
// Start
|
|
95
|
-
if (finalOptions.dev && !finalOptions.url) {
|
|
100
|
+
// Start server if requested
|
|
101
|
+
if ((finalOptions.dev || finalOptions.serve) && !finalOptions.url) {
|
|
96
102
|
if (!finalOptions.quiet) {
|
|
97
|
-
console.log('Starting TS-RES Browser
|
|
103
|
+
console.log('Starting TS-RES Browser server...');
|
|
98
104
|
}
|
|
99
|
-
const serverResult = await this.
|
|
105
|
+
const serverResult = await this._startServer(finalOptions);
|
|
100
106
|
if (serverResult.isFailure()) {
|
|
101
107
|
return serverResult;
|
|
102
108
|
}
|
|
103
|
-
// Wait for server to be ready
|
|
104
|
-
const port = options.port || 3000;
|
|
105
|
-
const readyResult = await this._waitForServerReady(port, options.verbose || false);
|
|
106
|
-
if (readyResult.isFailure()) {
|
|
107
|
-
this._stopDevServer();
|
|
108
|
-
return readyResult;
|
|
109
|
-
}
|
|
110
|
-
if (!options.quiet) {
|
|
111
|
-
console.log(`Development server started on port ${port}`);
|
|
112
|
-
}
|
|
113
109
|
}
|
|
114
110
|
// Build URL with parameters
|
|
115
111
|
const url = this._buildUrl(finalOptions);
|
|
@@ -151,6 +147,39 @@ class BrowserLauncher {
|
|
|
151
147
|
return (0, ts_utils_1.fail)(`Failed to launch browser: ${error}`);
|
|
152
148
|
}
|
|
153
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Starts the server using ts-res-browser CLI directly
|
|
152
|
+
*/
|
|
153
|
+
async _startServer(options) {
|
|
154
|
+
try {
|
|
155
|
+
// Use ts-res-browser directly from node_modules
|
|
156
|
+
const browserPath = require.resolve('@fgv/ts-res-browser/cli.js');
|
|
157
|
+
const command = `node "${browserPath}" ${options.dev ? 'dev' : 'serve'}`;
|
|
158
|
+
if (options.verbose) {
|
|
159
|
+
console.log(`Running: ${command}`);
|
|
160
|
+
}
|
|
161
|
+
return new Promise((resolve) => {
|
|
162
|
+
const child = (0, child_process_1.exec)(command, (error) => {
|
|
163
|
+
if (error) {
|
|
164
|
+
resolve((0, ts_utils_1.fail)(`Failed to start server: ${error.message}`));
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
resolve((0, ts_utils_1.succeed)(undefined));
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
// Give server time to start, then assume success
|
|
171
|
+
setTimeout(() => {
|
|
172
|
+
if (options.verbose) {
|
|
173
|
+
console.log('Server startup initiated');
|
|
174
|
+
}
|
|
175
|
+
resolve((0, ts_utils_1.succeed)(undefined));
|
|
176
|
+
}, 2000);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
return (0, ts_utils_1.fail)(`Failed to start server: ${error}`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
154
183
|
/**
|
|
155
184
|
* Opens the browser to the specified URL
|
|
156
185
|
*/
|
|
@@ -174,8 +203,9 @@ class BrowserLauncher {
|
|
|
174
203
|
* Builds the URL with query parameters based on options
|
|
175
204
|
*/
|
|
176
205
|
_buildUrl(options) {
|
|
177
|
-
// Use provided URL or default
|
|
178
|
-
const
|
|
206
|
+
// Use provided URL or default based on server type
|
|
207
|
+
const defaultPort = options.dev ? 3000 : 8080;
|
|
208
|
+
const baseUrl = options.url || `http://localhost:${options.port || defaultPort}`;
|
|
179
209
|
const params = new URLSearchParams();
|
|
180
210
|
if (options.input) {
|
|
181
211
|
params.set('input', options.input);
|
|
@@ -213,140 +243,6 @@ class BrowserLauncher {
|
|
|
213
243
|
const queryString = params.toString();
|
|
214
244
|
return queryString ? `${baseUrl}?${queryString}` : baseUrl;
|
|
215
245
|
}
|
|
216
|
-
/**
|
|
217
|
-
* Starts the development server for ts-res-browser
|
|
218
|
-
*/
|
|
219
|
-
async _startDevServer(options) {
|
|
220
|
-
try {
|
|
221
|
-
const port = options.port || 3000;
|
|
222
|
-
const env = Object.assign(Object.assign({}, process.env), { PORT: port.toString() });
|
|
223
|
-
// Detect if we're in a monorepo or using published packages
|
|
224
|
-
const isMonorepo = this._isMonorepoEnvironment();
|
|
225
|
-
if (isMonorepo) {
|
|
226
|
-
// Monorepo development: use rushx from sibling project
|
|
227
|
-
const browserProjectPath = path.resolve(__dirname, '../../ts-res-browser');
|
|
228
|
-
if (options.verbose) {
|
|
229
|
-
console.log(`Looking for ts-res-browser at: ${browserProjectPath}`);
|
|
230
|
-
}
|
|
231
|
-
this._devServer = (0, child_process_1.spawn)('rushx', ['dev'], {
|
|
232
|
-
cwd: browserProjectPath,
|
|
233
|
-
env,
|
|
234
|
-
stdio: options.verbose ? 'inherit' : ['ignore', 'pipe', 'pipe']
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
// Published packages: dev server not available
|
|
239
|
-
return (0, ts_utils_1.fail)('Development server is not available in published packages.\n\n' +
|
|
240
|
-
'The dev server requires webpack-cli and webpack-dev-server which are\n' +
|
|
241
|
-
'not included in published packages to keep them lightweight.\n\n' +
|
|
242
|
-
'To use the development server:\n' +
|
|
243
|
-
'1. Clone the repository\n' +
|
|
244
|
-
'2. Install dependencies: rush install\n' +
|
|
245
|
-
'3. Run: rushx dev from tools/ts-res-browser\n\n' +
|
|
246
|
-
'For published packages, omit the --dev flag to use static serving.');
|
|
247
|
-
}
|
|
248
|
-
this._devServer.on('error', (error) => {
|
|
249
|
-
return (0, ts_utils_1.fail)(`Failed to start development server: ${error}`);
|
|
250
|
-
});
|
|
251
|
-
// Give the server a moment to start
|
|
252
|
-
await this._sleep(3000);
|
|
253
|
-
if (this._devServer && !this._devServer.killed) {
|
|
254
|
-
if (options.verbose) {
|
|
255
|
-
console.log('Development server process started successfully');
|
|
256
|
-
}
|
|
257
|
-
return (0, ts_utils_1.succeed)(undefined);
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
return (0, ts_utils_1.fail)('Development server process failed to start');
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
catch (error) {
|
|
264
|
-
return (0, ts_utils_1.fail)(`Failed to start development server: ${error}`);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Waits for the development server to be ready by checking HTTP availability
|
|
269
|
-
*/
|
|
270
|
-
async _waitForServerReady(port, verbose, maxAttempts = 60) {
|
|
271
|
-
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
272
|
-
try {
|
|
273
|
-
const isReady = await this._checkServerHealth(port);
|
|
274
|
-
if (isReady) {
|
|
275
|
-
if (verbose) {
|
|
276
|
-
console.log(`Server is ready at http://localhost:${port}`);
|
|
277
|
-
}
|
|
278
|
-
return (0, ts_utils_1.succeed)(undefined);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
catch (error) {
|
|
282
|
-
// Server not ready yet, continue waiting
|
|
283
|
-
}
|
|
284
|
-
if (verbose && attempt % 10 === 0) {
|
|
285
|
-
console.log(`Waiting for server to be ready... (attempt ${attempt}/${maxAttempts})`);
|
|
286
|
-
}
|
|
287
|
-
await this._sleep(1000);
|
|
288
|
-
}
|
|
289
|
-
return (0, ts_utils_1.fail)(`Server did not become ready after ${maxAttempts} attempts`);
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Checks if the server is responding
|
|
293
|
-
*/
|
|
294
|
-
async _checkServerHealth(port) {
|
|
295
|
-
return new Promise((resolve) => {
|
|
296
|
-
const request = http.get(`http://localhost:${port}`, (res) => {
|
|
297
|
-
resolve(res.statusCode !== undefined && res.statusCode >= 200 && res.statusCode < 400);
|
|
298
|
-
});
|
|
299
|
-
request.on('error', () => {
|
|
300
|
-
resolve(false);
|
|
301
|
-
});
|
|
302
|
-
request.setTimeout(3000, () => {
|
|
303
|
-
request.destroy();
|
|
304
|
-
resolve(false);
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* Stops the development server
|
|
310
|
-
*/
|
|
311
|
-
_stopDevServer() {
|
|
312
|
-
if (this._devServer && !this._devServer.killed) {
|
|
313
|
-
this._devServer.kill('SIGTERM');
|
|
314
|
-
setTimeout(() => {
|
|
315
|
-
if (this._devServer && !this._devServer.killed) {
|
|
316
|
-
this._devServer.kill('SIGKILL');
|
|
317
|
-
}
|
|
318
|
-
}, 5000);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Sleep for the specified number of milliseconds
|
|
323
|
-
*/
|
|
324
|
-
_sleep(ms) {
|
|
325
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Detects if we're running in a monorepo environment
|
|
329
|
-
*/
|
|
330
|
-
_isMonorepoEnvironment() {
|
|
331
|
-
try {
|
|
332
|
-
// Check if we have a rush.json file in parent directories (indicating monorepo)
|
|
333
|
-
let currentDir = __dirname;
|
|
334
|
-
for (let i = 0; i < 5; i++) {
|
|
335
|
-
// Look up to 5 levels up
|
|
336
|
-
const rushJsonPath = path.join(currentDir, 'rush.json');
|
|
337
|
-
if (fs.existsSync(rushJsonPath)) {
|
|
338
|
-
return true;
|
|
339
|
-
}
|
|
340
|
-
currentDir = path.dirname(currentDir);
|
|
341
|
-
}
|
|
342
|
-
// Also check if ts-res-browser sibling directory exists
|
|
343
|
-
const browserProjectPath = path.resolve(__dirname, '../../ts-res-browser');
|
|
344
|
-
return (fs.existsSync(browserProjectPath) && fs.existsSync(path.join(browserProjectPath, 'package.json')));
|
|
345
|
-
}
|
|
346
|
-
catch (_a) {
|
|
347
|
-
return false;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
246
|
/**
|
|
351
247
|
* Determines if a ZIP archive should be created based on the options
|
|
352
248
|
*/
|
|
@@ -374,12 +270,6 @@ class BrowserLauncher {
|
|
|
374
270
|
return (0, ts_utils_1.fail)(`Failed to create ZIP archive: ${error instanceof Error ? error.message : String(error)}`);
|
|
375
271
|
}
|
|
376
272
|
}
|
|
377
|
-
/**
|
|
378
|
-
* Graceful shutdown - stops development server if running
|
|
379
|
-
*/
|
|
380
|
-
shutdown() {
|
|
381
|
-
this._stopDevServer();
|
|
382
|
-
}
|
|
383
273
|
}
|
|
384
|
-
exports.
|
|
385
|
-
//# sourceMappingURL=
|
|
274
|
+
exports.SimpleBrowserLauncher = SimpleBrowserLauncher;
|
|
275
|
+
//# sourceMappingURL=simpleBrowserLauncher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simpleBrowserLauncher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AI;gBAAE,OAAO,KAAK,CAAC;YACxB,+EAA+E;YAC/E,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;QACpG,CAAC,CAAC;QAEF,OAAO,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,iBAAiB,CAC7B,OAAuB;QAEvB,IAAI,CAAC;YACH,OAAO,MAAM,yBAAW,CAAC,aAAa,CAAC;gBACrC,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAA,eAAI,EAAC,iCAAiC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzG,CAAC;IACH,CAAC;CACF;AArPD,sDAqPC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { exec } from 'child_process';\nimport * as path from 'path';\nimport * as http from 'http';\nimport { Result, succeed, fail } from '@fgv/ts-utils';\nimport { IBrowseOptions } from './options';\nimport { zipArchiver } from './zipArchiver';\n\n/**\n * Simplified browser launcher using direct dependency on ts-res-browser\n */\nexport class SimpleBrowserLauncher {\n /**\n * Launches the browser with the specified options\n */\n public async launch(options: IBrowseOptions): Promise<Result<void>> {\n try {\n // Validate options before proceeding\n if (options.interactive && !options.dev && !options.serve && !options.url) {\n return fail(\n 'Interactive mode requires either --dev/--serve to start a local server or --url to specify a remote server.\\n\\n' +\n 'Examples:\\n' +\n ' ts-res-browser-cli --interactive --dev\\n' +\n ' ts-res-browser-cli --interactive --serve\\n' +\n ' ts-res-browser-cli --interactive --url https://example.com/ts-res-browser'\n );\n }\n\n // Check if we need to create a ZIP archive for file-based inputs\n let zipCreated = false;\n let finalOptions = { ...options };\n\n if (this._shouldCreateZip(options)) {\n if (!options.quiet) {\n console.log('Creating ZIP archive for file-based resources...');\n }\n\n const zipResult = await this._createZipArchive(options);\n if (zipResult.isFailure()) {\n return fail(`Failed to create ZIP archive: ${zipResult.message}`);\n }\n\n if (!options.quiet) {\n console.log(`ZIP archive created: ${zipResult.value.zipPath}`);\n }\n\n // Modify options to use ZIP loading instead of file paths\n const zipFileName = path.basename(zipResult.value.zipPath);\n finalOptions = {\n ...options,\n input: undefined,\n config: undefined,\n // Add ZIP loading parameters\n loadZip: true,\n zipFile: zipFileName,\n zipPath: zipResult.value.zipPath\n };\n zipCreated = true;\n }\n\n // Start server if requested\n if ((finalOptions.dev || finalOptions.serve) && !finalOptions.url) {\n if (!finalOptions.quiet) {\n console.log('Starting TS-RES Browser server...');\n }\n\n const serverResult = await this._startServer(finalOptions);\n if (serverResult.isFailure()) {\n return serverResult;\n }\n }\n\n // Build URL with parameters\n const url = this._buildUrl(finalOptions);\n\n if (!finalOptions.quiet) {\n console.log('Opening TS-RES Browser...');\n if (zipCreated) {\n console.log('ZIP archive created - browser will load from Downloads folder');\n } else {\n if (finalOptions.input) {\n console.log(`Resource file: ${finalOptions.input}`);\n }\n if (finalOptions.config) {\n console.log(`Configuration: ${finalOptions.config}`);\n }\n }\n if (finalOptions.contextFilter) {\n console.log(`Context filter: ${finalOptions.contextFilter}`);\n }\n console.log(`URL: ${url}`);\n }\n\n // Open browser if requested (default to true)\n const shouldOpen = finalOptions.open !== false;\n if (shouldOpen) {\n const openResult = await this._openBrowser(url, finalOptions.verbose || false);\n if (openResult.isFailure()) {\n return fail(`Could not open browser: ${openResult.message}`);\n }\n\n if (!finalOptions.quiet) {\n console.log('Browser opened successfully');\n }\n } else {\n console.log(`Browser URL: ${url}`);\n }\n\n return succeed(undefined);\n } catch (error) {\n return fail(`Failed to launch browser: ${error}`);\n }\n }\n\n /**\n * Starts the server using ts-res-browser CLI directly\n */\n private async _startServer(options: IBrowseOptions): Promise<Result<void>> {\n try {\n // Use ts-res-browser directly from node_modules\n const browserPath = require.resolve('@fgv/ts-res-browser/cli.js');\n const command = `node \"${browserPath}\" ${options.dev ? 'dev' : 'serve'}`;\n\n if (options.verbose) {\n console.log(`Running: ${command}`);\n }\n\n return new Promise((resolve) => {\n const child = exec(command, (error) => {\n if (error) {\n resolve(fail(`Failed to start server: ${error.message}`));\n } else {\n resolve(succeed(undefined));\n }\n });\n\n // Give server time to start, then assume success\n setTimeout(() => {\n if (options.verbose) {\n console.log('Server startup initiated');\n }\n resolve(succeed(undefined));\n }, 2000);\n });\n } catch (error) {\n return fail(`Failed to start server: ${error}`);\n }\n }\n\n /**\n * Opens the browser to the specified URL\n */\n private async _openBrowser(url: string, verbose: boolean): Promise<Result<void>> {\n return new Promise((resolve) => {\n const command =\n process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start \"\"' : 'xdg-open';\n\n exec(`${command} \"${url}\"`, (error) => {\n if (error) {\n resolve(fail(`Failed to open browser: ${error.message}`));\n } else {\n if (verbose) {\n console.log(`Opened browser to: ${url}`);\n }\n resolve(succeed(undefined));\n }\n });\n });\n }\n\n /**\n * Builds the URL with query parameters based on options\n */\n private _buildUrl(options: IBrowseOptions): string {\n // Use provided URL or default based on server type\n const defaultPort = options.dev ? 3000 : 8080;\n const baseUrl = options.url || `http://localhost:${options.port || defaultPort}`;\n const params = new URLSearchParams();\n\n if (options.input) {\n params.set('input', options.input);\n }\n\n if (options.config) {\n params.set('config', options.config);\n }\n\n if (options.contextFilter) {\n params.set('contextFilter', options.contextFilter);\n }\n\n if (options.qualifierDefaults) {\n params.set('qualifierDefaults', options.qualifierDefaults);\n }\n\n if (options.resourceTypes) {\n params.set('resourceTypes', options.resourceTypes);\n }\n\n if (options.maxDistance !== undefined) {\n params.set('maxDistance', options.maxDistance.toString());\n }\n\n if (options.reduceQualifiers) {\n params.set('reduceQualifiers', 'true');\n }\n\n if (options.interactive) {\n params.set('interactive', 'true');\n }\n\n if (options.loadZip) {\n params.set('loadZip', 'true');\n }\n\n if (options.zipFile) {\n params.set('zipFile', options.zipFile);\n }\n\n if (options.zipPath) {\n params.set('zipPath', options.zipPath);\n }\n\n const queryString = params.toString();\n return queryString ? `${baseUrl}?${queryString}` : baseUrl;\n }\n\n /**\n * Determines if a ZIP archive should be created based on the options\n */\n private _shouldCreateZip(options: IBrowseOptions): boolean {\n // Create ZIP if input or config are file paths (not predefined names)\n const hasFilePath = (path: string | undefined): boolean => {\n if (!path) return false;\n // Check if it's a file path (contains directory separators or file extensions)\n return path.includes('/') || path.includes('\\\\') || (path.includes('.') && !path.startsWith('.'));\n };\n\n return hasFilePath(options.input) || hasFilePath(options.config);\n }\n\n /**\n * Creates a ZIP archive containing the input and config files\n */\n private async _createZipArchive(\n options: IBrowseOptions\n ): Promise<Result<{ zipPath: string; manifest: any }>> {\n try {\n return await zipArchiver.createArchive({\n input: options.input,\n config: options.config\n });\n } catch (error) {\n return fail(`Failed to create ZIP archive: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fgv/ts-res-browser-cli",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-7",
|
|
4
4
|
"description": "Command-line interface to launch ts-res-browser with specified options",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -24,10 +24,11 @@
|
|
|
24
24
|
"commander": "^11.0.0",
|
|
25
25
|
"archiver": "~7.0.1",
|
|
26
26
|
"@types/archiver": "~6.0.3",
|
|
27
|
-
"@fgv/ts-
|
|
28
|
-
"@fgv/ts-
|
|
29
|
-
"@fgv/ts-json-base": "5.0.0-
|
|
30
|
-
"@fgv/ts-
|
|
27
|
+
"@fgv/ts-res": "5.0.0-7",
|
|
28
|
+
"@fgv/ts-utils": "5.0.0-7",
|
|
29
|
+
"@fgv/ts-json-base": "5.0.0-7",
|
|
30
|
+
"@fgv/ts-json": "5.0.0-7",
|
|
31
|
+
"@fgv/ts-res-browser": "5.0.0-7"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@rushstack/heft": "~0.74.0",
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
"eslint": "^8.57.0",
|
|
38
39
|
"jest": "^29.7.0",
|
|
39
40
|
"typescript": "^5.7.3",
|
|
40
|
-
"@fgv/ts-utils-jest": "5.0.0-
|
|
41
|
+
"@fgv/ts-utils-jest": "5.0.0-7"
|
|
41
42
|
},
|
|
42
43
|
"scripts": {
|
|
43
44
|
"build": "heft build --clean",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Invoking: heft build --clean
|
|
2
2
|
---- build started ----
|
|
3
3
|
[build:typescript] Using TypeScript version 5.8.3
|
|
4
|
-
---- build finished (
|
|
5
|
-
-------------------- Finished (
|
|
4
|
+
---- build finished (2.328s) ----
|
|
5
|
+
-------------------- Finished (2.332s) --------------------
|
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
|
}
|