@bagelink/workspace 1.7.16 → 1.7.22

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.QrDkf3TO.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.DyRK_sN4.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.QrDkf3TO.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.DyRK_sN4.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.DyRK_sN4.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,15 @@ function clearAndPrintServers() {
308
309
  console.log("");
309
310
  }
310
311
  async function runDev(filter = "./[!shared]*") {
312
+ console.log(`${colors.dim}Starting dev servers with filter: ${filter}${colors.reset}
313
+ `);
311
314
  const proc = spawn("bun", ["run", "--filter", filter, "dev"], {
312
315
  cwd: process.cwd(),
313
- stdio: ["inherit", "pipe", "pipe"]
316
+ stdio: ["inherit", "pipe", "pipe"],
317
+ shell: true
314
318
  });
315
- let buffer = "";
319
+ let stdoutBuffer = "";
320
+ let stderrBuffer = "";
316
321
  function processLine(line) {
317
322
  if (!line.trim()) return;
318
323
  if (seenLines.has(line)) return;
@@ -338,22 +343,31 @@ async function runDev(filter = "./[!shared]*") {
338
343
  }
339
344
  }
340
345
  }
346
+ proc.stdout?.setEncoding("utf8");
347
+ proc.stderr?.setEncoding("utf8");
341
348
  proc.stdout?.on("data", (data) => {
342
- buffer += data.toString();
343
- const lines = buffer.split("\n");
344
- buffer = lines.pop() || "";
349
+ stdoutBuffer += data;
350
+ const lines = stdoutBuffer.split("\n");
351
+ stdoutBuffer = lines.pop() || "";
345
352
  for (const line of lines) {
346
353
  processLine(line);
347
354
  }
348
355
  });
349
356
  proc.stderr?.on("data", (data) => {
350
- buffer += data.toString();
351
- const lines = buffer.split("\n");
352
- buffer = lines.pop() || "";
357
+ stderrBuffer += data;
358
+ const lines = stderrBuffer.split("\n");
359
+ stderrBuffer = lines.pop() || "";
353
360
  for (const line of lines) {
354
361
  processLine(line);
355
362
  }
356
363
  });
364
+ proc.on("error", (error) => {
365
+ console.error(`${colors.red}Failed to start dev servers:${colors.reset}`, error.message);
366
+ });
367
+ process.on("SIGINT", () => {
368
+ proc.kill("SIGINT");
369
+ process.exit(0);
370
+ });
357
371
  return new Promise((resolve, reject) => {
358
372
  proc.on("exit", (code) => {
359
373
  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,15 @@ function clearAndPrintServers() {
315
316
  console.log("");
316
317
  }
317
318
  async function runDev(filter = "./[!shared]*") {
319
+ console.log(`${colors.dim}Starting dev servers with filter: ${filter}${colors.reset}
320
+ `);
318
321
  const proc = node_child_process.spawn("bun", ["run", "--filter", filter, "dev"], {
319
322
  cwd: process__default.cwd(),
320
- stdio: ["inherit", "pipe", "pipe"]
323
+ stdio: ["inherit", "pipe", "pipe"],
324
+ shell: true
321
325
  });
322
- let buffer = "";
326
+ let stdoutBuffer = "";
327
+ let stderrBuffer = "";
323
328
  function processLine(line) {
324
329
  if (!line.trim()) return;
325
330
  if (seenLines.has(line)) return;
@@ -345,22 +350,31 @@ async function runDev(filter = "./[!shared]*") {
345
350
  }
346
351
  }
347
352
  }
353
+ proc.stdout?.setEncoding("utf8");
354
+ proc.stderr?.setEncoding("utf8");
348
355
  proc.stdout?.on("data", (data) => {
349
- buffer += data.toString();
350
- const lines = buffer.split("\n");
351
- buffer = lines.pop() || "";
356
+ stdoutBuffer += data;
357
+ const lines = stdoutBuffer.split("\n");
358
+ stdoutBuffer = lines.pop() || "";
352
359
  for (const line of lines) {
353
360
  processLine(line);
354
361
  }
355
362
  });
356
363
  proc.stderr?.on("data", (data) => {
357
- buffer += data.toString();
358
- const lines = buffer.split("\n");
359
- buffer = lines.pop() || "";
364
+ stderrBuffer += data;
365
+ const lines = stderrBuffer.split("\n");
366
+ stderrBuffer = lines.pop() || "";
360
367
  for (const line of lines) {
361
368
  processLine(line);
362
369
  }
363
370
  });
371
+ proc.on("error", (error) => {
372
+ console.error(`${colors.red}Failed to start dev servers:${colors.reset}`, error.message);
373
+ });
374
+ process__default.on("SIGINT", () => {
375
+ proc.kill("SIGINT");
376
+ process__default.exit(0);
377
+ });
364
378
  return new Promise((resolve, reject) => {
365
379
  proc.on("exit", (code) => {
366
380
  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.16",
4
+ "version": "1.7.22",
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,16 @@ function clearAndPrintServers() {
42
42
  }
43
43
 
44
44
  export async function runDev(filter = './[!shared]*') {
45
+ console.log(`${colors.dim}Starting dev servers with filter: ${filter}${colors.reset}\n`)
46
+
45
47
  const proc = spawn('bun', ['run', '--filter', filter, 'dev'], {
46
48
  cwd: process.cwd(),
47
49
  stdio: ['inherit', 'pipe', 'pipe'],
50
+ shell: true,
48
51
  })
49
52
 
50
- let buffer = ''
53
+ let stdoutBuffer = ''
54
+ let stderrBuffer = ''
51
55
 
52
56
  function processLine(line: string) {
53
57
  if (!line.trim()) return
@@ -83,26 +87,39 @@ export async function runDev(filter = './[!shared]*') {
83
87
  }
84
88
  }
85
89
 
86
- proc.stdout?.on('data', (data: Buffer) => {
87
- buffer += data.toString()
88
- const lines = buffer.split('\n')
89
- buffer = lines.pop() || ''
90
+ proc.stdout?.setEncoding('utf8')
91
+ proc.stderr?.setEncoding('utf8')
92
+
93
+ proc.stdout?.on('data', (data: string) => {
94
+ stdoutBuffer += data
95
+ const lines = stdoutBuffer.split('\n')
96
+ stdoutBuffer = lines.pop() || ''
90
97
 
91
98
  for (const line of lines) {
92
99
  processLine(line)
93
100
  }
94
101
  })
95
102
 
96
- proc.stderr?.on('data', (data: Buffer) => {
97
- buffer += data.toString()
98
- const lines = buffer.split('\n')
99
- buffer = lines.pop() || ''
103
+ proc.stderr?.on('data', (data: string) => {
104
+ stderrBuffer += data
105
+ const lines = stderrBuffer.split('\n')
106
+ stderrBuffer = lines.pop() || ''
100
107
 
101
108
  for (const line of lines) {
102
109
  processLine(line)
103
110
  }
104
111
  })
105
112
 
113
+ proc.on('error', (error) => {
114
+ console.error(`${colors.red}Failed to start dev servers:${colors.reset}`, error.message)
115
+ })
116
+
117
+ // Handle Ctrl+C gracefully
118
+ process.on('SIGINT', () => {
119
+ proc.kill('SIGINT')
120
+ process.exit(0)
121
+ })
122
+
106
123
  return new Promise<number>((resolve, reject) => {
107
124
  proc.on('exit', (code) => {
108
125
  resolve(code || 0)