@bagelink/workspace 1.7.57 → 1.7.61

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/workspace",
3
3
  "type": "module",
4
- "version": "1.7.57",
4
+ "version": "1.7.61",
5
5
  "description": "Monorepo workspace tooling for Bagel projects with proxy and config management",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
package/src/build.ts ADDED
@@ -0,0 +1,44 @@
1
+ import { spawn } from 'node:child_process'
2
+ import process from 'node:process'
3
+ import { listProjects } from './workspace.js'
4
+
5
+ export async function runBuild(
6
+ filter?: string,
7
+ additionalArgs: string[] = [],
8
+ ) {
9
+ const argsStr = additionalArgs.length > 0 ? ` -- ${additionalArgs.join(' ')}` : ''
10
+ const resolvedFilter = resolveFilter(filter)
11
+ if (!resolvedFilter) return 1
12
+
13
+ const command = `bun run --filter '${resolvedFilter}' build${argsStr}`
14
+
15
+ const proc = spawn(command, {
16
+ cwd: process.cwd(),
17
+ stdio: 'inherit',
18
+ shell: true,
19
+ })
20
+
21
+ proc.on('error', (error) => {
22
+ console.error('Failed to start build:', error.message)
23
+ })
24
+
25
+ return new Promise<number>((resolve, reject) => {
26
+ proc.on('exit', (code) => {
27
+ resolve(code || 0)
28
+ })
29
+ proc.on('error', reject)
30
+ })
31
+ }
32
+
33
+ function resolveFilter(filter?: string): string | null {
34
+ if (filter) return filter
35
+
36
+ const projects = listProjects()
37
+ if (projects.length === 0) {
38
+ console.error('No projects found')
39
+ return null
40
+ }
41
+
42
+ // Default: all projects except shared
43
+ return './[!shared]*'
44
+ }
package/src/dev.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { spawn } from 'node:child_process'
2
2
  import process from 'node:process'
3
+ import { listProjects } from './workspace.js'
3
4
 
4
5
  interface ServerInfo {
5
6
  name: string
@@ -41,11 +42,17 @@ function clearAndPrintServers() {
41
42
  console.log('')
42
43
  }
43
44
 
44
- export async function runDev(filter = './!shared*', additionalArgs: string[] = []) {
45
+ export async function runDev(
46
+ filter?: string,
47
+ additionalArgs: string[] = [],
48
+ ) {
45
49
  const argsStr = additionalArgs.length > 0 ? ` -- ${additionalArgs.join(' ')}` : ''
46
- console.log(`${colors.dim}Starting dev servers with filter: ${filter}${argsStr}${colors.reset}\n`)
50
+ const resolvedFilter = resolveFilter(filter)
51
+ if (!resolvedFilter) return 1
47
52
 
48
- const command = `bun run --filter '${filter}' dev${argsStr}`
53
+ console.log(`${colors.dim}Starting dev servers with filter: ${resolvedFilter}${argsStr}${colors.reset}\n`)
54
+
55
+ const command = `bun run --filter '${resolvedFilter}' dev${argsStr}`
49
56
  const proc = spawn(command, {
50
57
  cwd: process.cwd(),
51
58
  stdio: ['inherit', 'pipe', 'pipe'],
@@ -138,3 +145,16 @@ export async function runDev(filter = './!shared*', additionalArgs: string[] = [
138
145
  proc.on('error', reject)
139
146
  })
140
147
  }
148
+
149
+ function resolveFilter(filter?: string): string | null {
150
+ if (filter) return filter
151
+
152
+ const projects = listProjects()
153
+ if (projects.length === 0) {
154
+ console.error('No projects found')
155
+ return null
156
+ }
157
+
158
+ // Default: all projects except shared
159
+ return './[!shared]*'
160
+ }
package/src/workspace.ts CHANGED
@@ -90,7 +90,7 @@ function createWorkspaceRoot(root: string, name: string, projectId: string): voi
90
90
  'dev': 'bgl dev',
91
91
  'dev:local': 'bgl dev --mode localhost',
92
92
  'dev:verbose': 'bun run --filter \'./!shared*\' dev',
93
- 'build': 'bun run --filter \'./!shared*\' build',
93
+ 'build': 'bgl build',
94
94
  'typecheck': 'tsc --noEmit',
95
95
  'lint': 'eslint . --cache',
96
96
  'lint:fix': 'eslint . --cache --fix',