@bagelink/workspace 1.7.18 → 1.7.24

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/bin/bgl.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  const process = require('node:process');
5
- const workspace = require('../shared/workspace.BHE_cGVH.cjs');
5
+ const workspace = require('../shared/workspace.DL_Ay2mI.cjs');
6
6
  require('node:fs');
7
7
  require('node:path');
8
8
  require('prompts');
package/dist/bin/bgl.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import process from 'node:process';
3
- import { k as initWorkspace, g as generateWorkspaceConfig, j as addProject, l as listProjects, i as isWorkspace, e as setupLint, h as generateSDKForWorkspace, f as generateSDK, r as runDev } from '../shared/workspace.Ce21E5iO.mjs';
3
+ import { k as initWorkspace, g as generateWorkspaceConfig, j as addProject, l as listProjects, i as isWorkspace, e as setupLint, h as generateSDKForWorkspace, f as generateSDK, r as runDev } from '../shared/workspace.CJj5dITU.mjs';
4
4
  import 'node:fs';
5
5
  import 'node:path';
6
6
  import 'prompts';
package/dist/index.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  const node_fs = require('node:fs');
4
4
  const node_path = require('node:path');
5
5
  const process = require('node:process');
6
- const workspace = require('./shared/workspace.BHE_cGVH.cjs');
6
+ const workspace = require('./shared/workspace.DL_Ay2mI.cjs');
7
7
  require('prompts');
8
8
  require('node:child_process');
9
9
 
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { resolve, join } from 'node:path';
3
3
  import process from 'node:process';
4
- import { g as generateWorkspaceConfig, s as setBuildEnvVars, w as writeNetlifyConfig } from './shared/workspace.Ce21E5iO.mjs';
5
- export { j as addProject, a as generateNetlifyConfig, b as generateNetlifyRedirect, f as generateSDK, h as generateSDKForWorkspace, c as generateWorkspaceConfigSync, d as getWorkspaceInfo, k as initWorkspace, i as isWorkspace, l as listProjects, r as runDev, e as setupLint } from './shared/workspace.Ce21E5iO.mjs';
4
+ import { g as generateWorkspaceConfig, s as setBuildEnvVars, w as writeNetlifyConfig } from './shared/workspace.CJj5dITU.mjs';
5
+ export { j as addProject, a as generateNetlifyConfig, b as generateNetlifyRedirect, f as generateSDK, h as generateSDKForWorkspace, c as generateWorkspaceConfigSync, d as getWorkspaceInfo, k as initWorkspace, i as isWorkspace, l as listProjects, r as runDev, e as setupLint } from './shared/workspace.CJj5dITU.mjs';
6
6
  import 'prompts';
7
7
  import 'node:child_process';
8
8
 
@@ -289,7 +289,8 @@ const colors = {
289
289
  cyan: "\x1B[36m",
290
290
  green: "\x1B[32m",
291
291
  yellow: "\x1B[33m",
292
- dim: "\x1B[2m"
292
+ dim: "\x1B[2m",
293
+ red: "\x1B[31m"
293
294
  };
294
295
  function clearAndPrintServers() {
295
296
  if (servers.size > 0) {
@@ -308,11 +309,16 @@ function clearAndPrintServers() {
308
309
  console.log("");
309
310
  }
310
311
  async function runDev(filter = "./[!shared]*") {
311
- const proc = spawn("bun", ["run", "--filter", filter, "dev"], {
312
+ console.log(`${colors.dim}Starting dev servers with filter: ${filter}${colors.reset}
313
+ `);
314
+ const command = `bun run --filter '${filter}' dev`;
315
+ const proc = spawn(command, {
312
316
  cwd: process.cwd(),
313
- stdio: ["inherit", "pipe", "pipe"]
317
+ stdio: ["inherit", "pipe", "pipe"],
318
+ shell: true
314
319
  });
315
- let buffer = "";
320
+ let stdoutBuffer = "";
321
+ let stderrBuffer = "";
316
322
  function processLine(line) {
317
323
  if (!line.trim()) return;
318
324
  if (seenLines.has(line)) return;
@@ -338,22 +344,34 @@ async function runDev(filter = "./[!shared]*") {
338
344
  }
339
345
  }
340
346
  }
347
+ proc.stdout?.setEncoding("utf8");
348
+ proc.stderr?.setEncoding("utf8");
341
349
  proc.stdout?.on("data", (data) => {
342
- buffer += data.toString();
343
- const lines = buffer.split("\n");
344
- buffer = lines.pop() || "";
350
+ if (servers.size === 0) {
351
+ console.log(`${colors.dim}Receiving output...${colors.reset}`);
352
+ }
353
+ stdoutBuffer += data;
354
+ const lines = stdoutBuffer.split("\n");
355
+ stdoutBuffer = lines.pop() || "";
345
356
  for (const line of lines) {
346
357
  processLine(line);
347
358
  }
348
359
  });
349
360
  proc.stderr?.on("data", (data) => {
350
- buffer += data.toString();
351
- const lines = buffer.split("\n");
352
- buffer = lines.pop() || "";
361
+ stderrBuffer += data;
362
+ const lines = stderrBuffer.split("\n");
363
+ stderrBuffer = lines.pop() || "";
353
364
  for (const line of lines) {
354
365
  processLine(line);
355
366
  }
356
367
  });
368
+ proc.on("error", (error) => {
369
+ console.error(`${colors.red}Failed to start dev servers:${colors.reset}`, error.message);
370
+ });
371
+ process.on("SIGINT", () => {
372
+ proc.kill("SIGINT");
373
+ process.exit(0);
374
+ });
357
375
  return new Promise((resolve, reject) => {
358
376
  proc.on("exit", (code) => {
359
377
  resolve(code || 0);
@@ -296,7 +296,8 @@ const colors = {
296
296
  cyan: "\x1B[36m",
297
297
  green: "\x1B[32m",
298
298
  yellow: "\x1B[33m",
299
- dim: "\x1B[2m"
299
+ dim: "\x1B[2m",
300
+ red: "\x1B[31m"
300
301
  };
301
302
  function clearAndPrintServers() {
302
303
  if (servers.size > 0) {
@@ -315,11 +316,16 @@ function clearAndPrintServers() {
315
316
  console.log("");
316
317
  }
317
318
  async function runDev(filter = "./[!shared]*") {
318
- const proc = node_child_process.spawn("bun", ["run", "--filter", filter, "dev"], {
319
+ console.log(`${colors.dim}Starting dev servers with filter: ${filter}${colors.reset}
320
+ `);
321
+ const command = `bun run --filter '${filter}' dev`;
322
+ const proc = node_child_process.spawn(command, {
319
323
  cwd: process__default.cwd(),
320
- stdio: ["inherit", "pipe", "pipe"]
324
+ stdio: ["inherit", "pipe", "pipe"],
325
+ shell: true
321
326
  });
322
- let buffer = "";
327
+ let stdoutBuffer = "";
328
+ let stderrBuffer = "";
323
329
  function processLine(line) {
324
330
  if (!line.trim()) return;
325
331
  if (seenLines.has(line)) return;
@@ -345,22 +351,34 @@ async function runDev(filter = "./[!shared]*") {
345
351
  }
346
352
  }
347
353
  }
354
+ proc.stdout?.setEncoding("utf8");
355
+ proc.stderr?.setEncoding("utf8");
348
356
  proc.stdout?.on("data", (data) => {
349
- buffer += data.toString();
350
- const lines = buffer.split("\n");
351
- buffer = lines.pop() || "";
357
+ if (servers.size === 0) {
358
+ console.log(`${colors.dim}Receiving output...${colors.reset}`);
359
+ }
360
+ stdoutBuffer += data;
361
+ const lines = stdoutBuffer.split("\n");
362
+ stdoutBuffer = lines.pop() || "";
352
363
  for (const line of lines) {
353
364
  processLine(line);
354
365
  }
355
366
  });
356
367
  proc.stderr?.on("data", (data) => {
357
- buffer += data.toString();
358
- const lines = buffer.split("\n");
359
- buffer = lines.pop() || "";
368
+ stderrBuffer += data;
369
+ const lines = stderrBuffer.split("\n");
370
+ stderrBuffer = lines.pop() || "";
360
371
  for (const line of lines) {
361
372
  processLine(line);
362
373
  }
363
374
  });
375
+ proc.on("error", (error) => {
376
+ console.error(`${colors.red}Failed to start dev servers:${colors.reset}`, error.message);
377
+ });
378
+ process__default.on("SIGINT", () => {
379
+ proc.kill("SIGINT");
380
+ process__default.exit(0);
381
+ });
364
382
  return new Promise((resolve, reject) => {
365
383
  proc.on("exit", (code) => {
366
384
  resolve(code || 0);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/workspace",
3
3
  "type": "module",
4
- "version": "1.7.18",
4
+ "version": "1.7.24",
5
5
  "description": "Monorepo workspace tooling for Bagel projects with proxy and config management",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
package/src/dev.ts CHANGED
@@ -1,4 +1,3 @@
1
- import type { Buffer } from 'node:buffer'
2
1
  import { spawn } from 'node:child_process'
3
2
  import process from 'node:process'
4
3
 
@@ -18,6 +17,7 @@ const colors = {
18
17
  green: '\x1B[32m',
19
18
  yellow: '\x1B[33m',
20
19
  dim: '\x1B[2m',
20
+ red: '\x1B[31m',
21
21
  }
22
22
 
23
23
  function clearAndPrintServers() {
@@ -42,12 +42,17 @@ function clearAndPrintServers() {
42
42
  }
43
43
 
44
44
  export async function runDev(filter = './[!shared]*') {
45
- const proc = spawn('bun', ['run', '--filter', filter, 'dev'], {
45
+ console.log(`${colors.dim}Starting dev servers with filter: ${filter}${colors.reset}\n`)
46
+
47
+ const command = `bun run --filter '${filter}' dev`
48
+ const proc = spawn(command, {
46
49
  cwd: process.cwd(),
47
50
  stdio: ['inherit', 'pipe', 'pipe'],
51
+ shell: true,
48
52
  })
49
53
 
50
- let buffer = ''
54
+ let stdoutBuffer = ''
55
+ let stderrBuffer = ''
51
56
 
52
57
  function processLine(line: string) {
53
58
  if (!line.trim()) return
@@ -83,26 +88,44 @@ export async function runDev(filter = './[!shared]*') {
83
88
  }
84
89
  }
85
90
 
86
- proc.stdout?.on('data', (data: Buffer) => {
87
- buffer += data.toString()
88
- const lines = buffer.split('\n')
89
- buffer = lines.pop() || ''
91
+ proc.stdout?.setEncoding('utf8')
92
+ proc.stderr?.setEncoding('utf8')
93
+
94
+ proc.stdout?.on('data', (data: string) => {
95
+ // Debug: show we're receiving data
96
+ if (servers.size === 0) {
97
+ console.log(`${colors.dim}Receiving output...${colors.reset}`)
98
+ }
99
+
100
+ stdoutBuffer += data
101
+ const lines = stdoutBuffer.split('\n')
102
+ stdoutBuffer = lines.pop() || ''
90
103
 
91
104
  for (const line of lines) {
92
105
  processLine(line)
93
106
  }
94
107
  })
95
108
 
96
- proc.stderr?.on('data', (data: Buffer) => {
97
- buffer += data.toString()
98
- const lines = buffer.split('\n')
99
- buffer = lines.pop() || ''
109
+ proc.stderr?.on('data', (data: string) => {
110
+ stderrBuffer += data
111
+ const lines = stderrBuffer.split('\n')
112
+ stderrBuffer = lines.pop() || ''
100
113
 
101
114
  for (const line of lines) {
102
115
  processLine(line)
103
116
  }
104
117
  })
105
118
 
119
+ proc.on('error', (error) => {
120
+ console.error(`${colors.red}Failed to start dev servers:${colors.reset}`, error.message)
121
+ })
122
+
123
+ // Handle Ctrl+C gracefully
124
+ process.on('SIGINT', () => {
125
+ proc.kill('SIGINT')
126
+ process.exit(0)
127
+ })
128
+
106
129
  return new Promise<number>((resolve, reject) => {
107
130
  proc.on('exit', (code) => {
108
131
  resolve(code || 0)