@supasayan/ytm 1.0.6 → 1.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.
Files changed (2) hide show
  1. package/bin/cli.js +23 -15
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -47,22 +47,30 @@ async function run() {
47
47
  const url = `http://127.0.0.1:${port}`;
48
48
  console.log(`Opening browser to ${url}`);
49
49
 
50
- // Use macOS 'open' utility to launch default browser
51
- const opener = spawn('open', [url]);
52
- opener.on('error', (err) => {
53
- console.error('Failed to open browser:', err);
54
- });
55
- }, 1500);
50
+ // Launch default browser based on the operating system
51
+ let opener;
52
+ if (process.platform === 'darwin') {
53
+ opener = spawn('open', [url]);
54
+ } else if (process.platform === 'win32') {
55
+ opener = spawn('cmd', ['/c', 'start', '""', url], { shell: true });
56
+ } else {
57
+ opener = spawn('xdg-open', [url]);
58
+ }
59
+
60
+ opener.on('error', (err) => {
61
+ console.error('Failed to open browser:', err);
62
+ });
63
+ }, 1500);
56
64
 
57
- // Ensure the backend process is killed when the CLI process exits
58
- process.on('SIGINT', () => {
59
- server.kill('SIGINT');
60
- process.exit(0);
61
- });
62
- process.on('SIGTERM', () => {
63
- server.kill('SIGTERM');
64
- process.exit(0);
65
- });
65
+ // Ensure the backend process is killed when the CLI process exits
66
+ process.on('SIGINT', () => {
67
+ server.kill('SIGINT');
68
+ process.exit(0);
69
+ });
70
+ process.on('SIGTERM', () => {
71
+ server.kill('SIGTERM');
72
+ process.exit(0);
73
+ });
66
74
  }
67
75
 
68
76
  run();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supasayan/ytm",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Root package to run both client and server",
5
5
  "main": "main.js",
6
6
  "productName": "YTM",