@bagelink/workspace 1.10.7 → 1.11.0
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 +1 -1
- package/dist/bin/bgl.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +2 -2
- package/dist/shared/{workspace.BPEOymAx.cjs → workspace.BMTTo3s8.cjs} +68 -1
- package/dist/shared/{workspace.DfYoqH33.mjs → workspace.COhZ__uF.mjs} +68 -1
- package/package.json +1 -1
- package/src/workspace.ts +73 -1
- package/templates/dev-runner.ts +61 -0
package/dist/bin/bgl.cjs
CHANGED
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 { i as initWorkspace, g as generateWorkspaceConfig, h as addProject, l as listProjects, k as isWorkspace, d as setupLint, f as generateSDKForWorkspace, e as generateSDK } from '../shared/workspace.
|
|
3
|
+
import { i as initWorkspace, g as generateWorkspaceConfig, h as addProject, l as listProjects, k as isWorkspace, d as setupLint, f as generateSDKForWorkspace, e as generateSDK } from '../shared/workspace.COhZ__uF.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 detect = require('./shared/workspace.
|
|
6
|
+
const detect = require('./shared/workspace.BMTTo3s8.cjs');
|
|
7
7
|
require('prompts');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
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.
|
|
5
|
-
export { h as addProject, a as generateNetlifyConfig, b as generateNetlifyRedirect, e as generateSDK, f as generateSDKForWorkspace, c as generateWorkspaceConfigSync, j as getWorkspaceInfo, i as initWorkspace, k as isWorkspace, l as listProjects, d as setupLint } from './shared/workspace.
|
|
4
|
+
import { g as generateWorkspaceConfig, s as setBuildEnvVars, w as writeNetlifyConfig } from './shared/workspace.COhZ__uF.mjs';
|
|
5
|
+
export { h as addProject, a as generateNetlifyConfig, b as generateNetlifyRedirect, e as generateSDK, f as generateSDKForWorkspace, c as generateWorkspaceConfigSync, j as getWorkspaceInfo, i as initWorkspace, k as isWorkspace, l as listProjects, d as setupLint } from './shared/workspace.COhZ__uF.mjs';
|
|
6
6
|
import 'prompts';
|
|
7
7
|
|
|
8
8
|
async function resolveConfig(mode = "development", options = {}) {
|
|
@@ -595,7 +595,8 @@ function createWorkspaceRoot(root, name, projectId) {
|
|
|
595
595
|
private: true,
|
|
596
596
|
workspaces: ["*", "!node_modules"],
|
|
597
597
|
scripts: {
|
|
598
|
-
dev: "bun
|
|
598
|
+
dev: "bun scripts/dev.ts",
|
|
599
|
+
"dev:verbose": "bun run --filter './[!shared]*' dev",
|
|
599
600
|
build: "bun run --filter './[!shared]*' build",
|
|
600
601
|
typecheck: "tsc --noEmit"
|
|
601
602
|
},
|
|
@@ -667,6 +668,72 @@ dist
|
|
|
667
668
|
.vite
|
|
668
669
|
`;
|
|
669
670
|
node_fs.writeFileSync(node_path.resolve(workspaceDir, ".gitignore"), gitignore);
|
|
671
|
+
const scriptsDir = node_path.resolve(workspaceDir, "scripts");
|
|
672
|
+
node_fs.mkdirSync(scriptsDir, { recursive: true });
|
|
673
|
+
const devRunnerContent = `#!/usr/bin/env bun
|
|
674
|
+
import { spawn } from 'bun'
|
|
675
|
+
import { readdir } from 'fs/promises'
|
|
676
|
+
import { resolve } from 'path'
|
|
677
|
+
|
|
678
|
+
const projectsRoot = process.cwd()
|
|
679
|
+
const projects = (await readdir(projectsRoot, { withFileTypes: true }))
|
|
680
|
+
.filter(
|
|
681
|
+
item =>
|
|
682
|
+
item.isDirectory()
|
|
683
|
+
&& item.name !== 'node_modules'
|
|
684
|
+
&& item.name !== 'shared'
|
|
685
|
+
&& item.name !== 'scripts'
|
|
686
|
+
&& item.name !== '.git'
|
|
687
|
+
&& !item.name.startsWith('.'),
|
|
688
|
+
)
|
|
689
|
+
.map(item => item.name)
|
|
690
|
+
|
|
691
|
+
console.log(\`\\n\u{1F680} Starting \${projects.length} project\${projects.length > 1 ? 's' : ''}...\\n\`)
|
|
692
|
+
|
|
693
|
+
const urlPattern = /Local:\\s+(http:\\/\\/localhost:\\d+)/
|
|
694
|
+
|
|
695
|
+
projects.forEach((project) => {
|
|
696
|
+
const proc = spawn({
|
|
697
|
+
cmd: ['bun', 'run', 'dev'],
|
|
698
|
+
cwd: resolve(projectsRoot, project),
|
|
699
|
+
stdout: 'pipe',
|
|
700
|
+
stderr: 'pipe',
|
|
701
|
+
})
|
|
702
|
+
|
|
703
|
+
const decoder = new TextDecoder()
|
|
704
|
+
|
|
705
|
+
proc.stdout.pipeTo(
|
|
706
|
+
new WritableStream({
|
|
707
|
+
write(chunk) {
|
|
708
|
+
const text = decoder.decode(chunk)
|
|
709
|
+
const match = text.match(urlPattern)
|
|
710
|
+
if (match) {
|
|
711
|
+
console.log(\` \u2713 \${project.padEnd(15)} \u2192 \${match[1]}\`)
|
|
712
|
+
}
|
|
713
|
+
},
|
|
714
|
+
}),
|
|
715
|
+
)
|
|
716
|
+
|
|
717
|
+
proc.stderr.pipeTo(
|
|
718
|
+
new WritableStream({
|
|
719
|
+
write(chunk) {
|
|
720
|
+
const text = decoder.decode(chunk)
|
|
721
|
+
if (text.includes('error') || text.includes('Error')) {
|
|
722
|
+
console.error(\` \u2717 \${project}: \${text.trim()}\`)
|
|
723
|
+
}
|
|
724
|
+
},
|
|
725
|
+
}),
|
|
726
|
+
)
|
|
727
|
+
})
|
|
728
|
+
|
|
729
|
+
console.log('\\n\u{1F4A1} Press Ctrl+C to stop all servers\\n')
|
|
730
|
+
|
|
731
|
+
process.on('SIGINT', () => {
|
|
732
|
+
console.log('\\n\\n\u{1F44B} Stopping all servers...\\n')
|
|
733
|
+
process.exit()
|
|
734
|
+
})
|
|
735
|
+
`;
|
|
736
|
+
node_fs.writeFileSync(node_path.resolve(scriptsDir, "dev.ts"), devRunnerContent);
|
|
670
737
|
console.log(`\u2705 Created workspace: ${name}`);
|
|
671
738
|
}
|
|
672
739
|
function createSharedPackage(root) {
|
|
@@ -588,7 +588,8 @@ function createWorkspaceRoot(root, name, projectId) {
|
|
|
588
588
|
private: true,
|
|
589
589
|
workspaces: ["*", "!node_modules"],
|
|
590
590
|
scripts: {
|
|
591
|
-
dev: "bun
|
|
591
|
+
dev: "bun scripts/dev.ts",
|
|
592
|
+
"dev:verbose": "bun run --filter './[!shared]*' dev",
|
|
592
593
|
build: "bun run --filter './[!shared]*' build",
|
|
593
594
|
typecheck: "tsc --noEmit"
|
|
594
595
|
},
|
|
@@ -660,6 +661,72 @@ dist
|
|
|
660
661
|
.vite
|
|
661
662
|
`;
|
|
662
663
|
writeFileSync(resolve(workspaceDir, ".gitignore"), gitignore);
|
|
664
|
+
const scriptsDir = resolve(workspaceDir, "scripts");
|
|
665
|
+
mkdirSync(scriptsDir, { recursive: true });
|
|
666
|
+
const devRunnerContent = `#!/usr/bin/env bun
|
|
667
|
+
import { spawn } from 'bun'
|
|
668
|
+
import { readdir } from 'fs/promises'
|
|
669
|
+
import { resolve } from 'path'
|
|
670
|
+
|
|
671
|
+
const projectsRoot = process.cwd()
|
|
672
|
+
const projects = (await readdir(projectsRoot, { withFileTypes: true }))
|
|
673
|
+
.filter(
|
|
674
|
+
item =>
|
|
675
|
+
item.isDirectory()
|
|
676
|
+
&& item.name !== 'node_modules'
|
|
677
|
+
&& item.name !== 'shared'
|
|
678
|
+
&& item.name !== 'scripts'
|
|
679
|
+
&& item.name !== '.git'
|
|
680
|
+
&& !item.name.startsWith('.'),
|
|
681
|
+
)
|
|
682
|
+
.map(item => item.name)
|
|
683
|
+
|
|
684
|
+
console.log(\`\\n\u{1F680} Starting \${projects.length} project\${projects.length > 1 ? 's' : ''}...\\n\`)
|
|
685
|
+
|
|
686
|
+
const urlPattern = /Local:\\s+(http:\\/\\/localhost:\\d+)/
|
|
687
|
+
|
|
688
|
+
projects.forEach((project) => {
|
|
689
|
+
const proc = spawn({
|
|
690
|
+
cmd: ['bun', 'run', 'dev'],
|
|
691
|
+
cwd: resolve(projectsRoot, project),
|
|
692
|
+
stdout: 'pipe',
|
|
693
|
+
stderr: 'pipe',
|
|
694
|
+
})
|
|
695
|
+
|
|
696
|
+
const decoder = new TextDecoder()
|
|
697
|
+
|
|
698
|
+
proc.stdout.pipeTo(
|
|
699
|
+
new WritableStream({
|
|
700
|
+
write(chunk) {
|
|
701
|
+
const text = decoder.decode(chunk)
|
|
702
|
+
const match = text.match(urlPattern)
|
|
703
|
+
if (match) {
|
|
704
|
+
console.log(\` \u2713 \${project.padEnd(15)} \u2192 \${match[1]}\`)
|
|
705
|
+
}
|
|
706
|
+
},
|
|
707
|
+
}),
|
|
708
|
+
)
|
|
709
|
+
|
|
710
|
+
proc.stderr.pipeTo(
|
|
711
|
+
new WritableStream({
|
|
712
|
+
write(chunk) {
|
|
713
|
+
const text = decoder.decode(chunk)
|
|
714
|
+
if (text.includes('error') || text.includes('Error')) {
|
|
715
|
+
console.error(\` \u2717 \${project}: \${text.trim()}\`)
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
}),
|
|
719
|
+
)
|
|
720
|
+
})
|
|
721
|
+
|
|
722
|
+
console.log('\\n\u{1F4A1} Press Ctrl+C to stop all servers\\n')
|
|
723
|
+
|
|
724
|
+
process.on('SIGINT', () => {
|
|
725
|
+
console.log('\\n\\n\u{1F44B} Stopping all servers...\\n')
|
|
726
|
+
process.exit()
|
|
727
|
+
})
|
|
728
|
+
`;
|
|
729
|
+
writeFileSync(resolve(scriptsDir, "dev.ts"), devRunnerContent);
|
|
663
730
|
console.log(`\u2705 Created workspace: ${name}`);
|
|
664
731
|
}
|
|
665
732
|
function createSharedPackage(root) {
|
package/package.json
CHANGED
package/src/workspace.ts
CHANGED
|
@@ -87,7 +87,8 @@ function createWorkspaceRoot(root: string, name: string, projectId: string): voi
|
|
|
87
87
|
private: true,
|
|
88
88
|
workspaces: ['*', '!node_modules'],
|
|
89
89
|
scripts: {
|
|
90
|
-
dev: 'bun
|
|
90
|
+
dev: 'bun scripts/dev.ts',
|
|
91
|
+
'dev:verbose': 'bun run --filter \'./[!shared]*\' dev',
|
|
91
92
|
build: 'bun run --filter \'./[!shared]*\' build',
|
|
92
93
|
typecheck: 'tsc --noEmit',
|
|
93
94
|
},
|
|
@@ -168,6 +169,77 @@ dist
|
|
|
168
169
|
|
|
169
170
|
writeFileSync(resolve(workspaceDir, '.gitignore'), gitignore)
|
|
170
171
|
|
|
172
|
+
// Create scripts directory
|
|
173
|
+
const scriptsDir = resolve(workspaceDir, 'scripts')
|
|
174
|
+
mkdirSync(scriptsDir, { recursive: true })
|
|
175
|
+
|
|
176
|
+
// Copy dev runner script
|
|
177
|
+
const devRunnerContent = `#!/usr/bin/env bun
|
|
178
|
+
import { spawn } from 'bun'
|
|
179
|
+
import { readdir } from 'fs/promises'
|
|
180
|
+
import { resolve } from 'path'
|
|
181
|
+
|
|
182
|
+
const projectsRoot = process.cwd()
|
|
183
|
+
const projects = (await readdir(projectsRoot, { withFileTypes: true }))
|
|
184
|
+
.filter(
|
|
185
|
+
item =>
|
|
186
|
+
item.isDirectory()
|
|
187
|
+
&& item.name !== 'node_modules'
|
|
188
|
+
&& item.name !== 'shared'
|
|
189
|
+
&& item.name !== 'scripts'
|
|
190
|
+
&& item.name !== '.git'
|
|
191
|
+
&& !item.name.startsWith('.'),
|
|
192
|
+
)
|
|
193
|
+
.map(item => item.name)
|
|
194
|
+
|
|
195
|
+
console.log(\`\\n🚀 Starting \${projects.length} project\${projects.length > 1 ? 's' : ''}...\\n\`)
|
|
196
|
+
|
|
197
|
+
const urlPattern = /Local:\\s+(http:\\/\\/localhost:\\d+)/
|
|
198
|
+
|
|
199
|
+
projects.forEach((project) => {
|
|
200
|
+
const proc = spawn({
|
|
201
|
+
cmd: ['bun', 'run', 'dev'],
|
|
202
|
+
cwd: resolve(projectsRoot, project),
|
|
203
|
+
stdout: 'pipe',
|
|
204
|
+
stderr: 'pipe',
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
const decoder = new TextDecoder()
|
|
208
|
+
|
|
209
|
+
proc.stdout.pipeTo(
|
|
210
|
+
new WritableStream({
|
|
211
|
+
write(chunk) {
|
|
212
|
+
const text = decoder.decode(chunk)
|
|
213
|
+
const match = text.match(urlPattern)
|
|
214
|
+
if (match) {
|
|
215
|
+
console.log(\` ✓ \${project.padEnd(15)} → \${match[1]}\`)
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
}),
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
proc.stderr.pipeTo(
|
|
222
|
+
new WritableStream({
|
|
223
|
+
write(chunk) {
|
|
224
|
+
const text = decoder.decode(chunk)
|
|
225
|
+
if (text.includes('error') || text.includes('Error')) {
|
|
226
|
+
console.error(\` ✗ \${project}: \${text.trim()}\`)
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
}),
|
|
230
|
+
)
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
console.log('\\n💡 Press Ctrl+C to stop all servers\\n')
|
|
234
|
+
|
|
235
|
+
process.on('SIGINT', () => {
|
|
236
|
+
console.log('\\n\\n👋 Stopping all servers...\\n')
|
|
237
|
+
process.exit()
|
|
238
|
+
})
|
|
239
|
+
`
|
|
240
|
+
|
|
241
|
+
writeFileSync(resolve(scriptsDir, 'dev.ts'), devRunnerContent)
|
|
242
|
+
|
|
171
243
|
console.log(`✅ Created workspace: ${name}`)
|
|
172
244
|
}
|
|
173
245
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { spawn } from 'bun'
|
|
3
|
+
import { readdir } from 'fs/promises'
|
|
4
|
+
import { resolve } from 'path'
|
|
5
|
+
|
|
6
|
+
const projectsRoot = process.cwd()
|
|
7
|
+
const projects = (await readdir(projectsRoot, { withFileTypes: true }))
|
|
8
|
+
.filter(
|
|
9
|
+
item =>
|
|
10
|
+
item.isDirectory()
|
|
11
|
+
&& item.name !== 'node_modules'
|
|
12
|
+
&& item.name !== 'shared'
|
|
13
|
+
&& item.name !== '.git'
|
|
14
|
+
&& !item.name.startsWith('.'),
|
|
15
|
+
)
|
|
16
|
+
.map(item => item.name)
|
|
17
|
+
|
|
18
|
+
console.log(`\n🚀 Starting ${projects.length} project${projects.length > 1 ? 's' : ''}...\n`)
|
|
19
|
+
|
|
20
|
+
const urlPattern = /Local:\s+(http:\/\/localhost:\d+)/
|
|
21
|
+
|
|
22
|
+
projects.forEach((project) => {
|
|
23
|
+
const proc = spawn({
|
|
24
|
+
cmd: ['bun', 'run', 'dev'],
|
|
25
|
+
cwd: resolve(projectsRoot, project),
|
|
26
|
+
stdout: 'pipe',
|
|
27
|
+
stderr: 'pipe',
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const decoder = new TextDecoder()
|
|
31
|
+
|
|
32
|
+
proc.stdout.pipeTo(
|
|
33
|
+
new WritableStream({
|
|
34
|
+
write(chunk) {
|
|
35
|
+
const text = decoder.decode(chunk)
|
|
36
|
+
const match = text.match(urlPattern)
|
|
37
|
+
if (match) {
|
|
38
|
+
console.log(` ✓ ${project.padEnd(15)} → ${match[1]}`)
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
proc.stderr.pipeTo(
|
|
45
|
+
new WritableStream({
|
|
46
|
+
write(chunk) {
|
|
47
|
+
const text = decoder.decode(chunk)
|
|
48
|
+
if (text.includes('error') || text.includes('Error')) {
|
|
49
|
+
console.error(` ✗ ${project}: ${text.trim()}`)
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
}),
|
|
53
|
+
)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
console.log('\n💡 Press Ctrl+C to stop all servers\n')
|
|
57
|
+
|
|
58
|
+
process.on('SIGINT', () => {
|
|
59
|
+
console.log('\n\n👋 Stopping all servers...\n')
|
|
60
|
+
process.exit()
|
|
61
|
+
})
|