@bagelink/workspace 1.7.55 → 1.7.59
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/bin/bgl.ts +43 -4
- package/dist/bin/bgl.cjs +1024 -956
- package/dist/bin/bgl.mjs +1024 -956
- package/package.json +1 -1
- package/src/build.ts +44 -0
- package/src/dev.ts +24 -3
- package/src/workspace.ts +2 -2
package/bin/bgl.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { resolve } from 'node:path'
|
|
3
3
|
import process from 'node:process'
|
|
4
|
+
import { runBuild } from '../src/build.js'
|
|
4
5
|
import { isWorkspace } from '../src/detect.js'
|
|
5
6
|
import { runDev } from '../src/dev.js'
|
|
6
7
|
import { generateWorkspaceConfig } from '../src/init.js'
|
|
@@ -108,12 +109,23 @@ SDK Commands:
|
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
else if (command === 'dev') {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
const { filter, additionalArgs } = parseFilterArgs(
|
|
113
|
+
undefined,
|
|
114
|
+
subcommand,
|
|
115
|
+
args,
|
|
116
|
+
)
|
|
114
117
|
const exitCode = await runDev(filter, additionalArgs)
|
|
115
118
|
process.exit(exitCode)
|
|
116
119
|
}
|
|
120
|
+
else if (command === 'build') {
|
|
121
|
+
const { filter, additionalArgs } = parseFilterArgs(
|
|
122
|
+
undefined,
|
|
123
|
+
subcommand,
|
|
124
|
+
args,
|
|
125
|
+
)
|
|
126
|
+
const exitCode = await runBuild(filter, additionalArgs)
|
|
127
|
+
process.exit(exitCode)
|
|
128
|
+
}
|
|
117
129
|
else {
|
|
118
130
|
console.log(`
|
|
119
131
|
Bagel Workspace CLI
|
|
@@ -124,8 +136,9 @@ Usage:
|
|
|
124
136
|
bgl init --workspace Create a new workspace with multiple projects
|
|
125
137
|
bgl add <name> Add a new project to workspace
|
|
126
138
|
bgl list List all projects in workspace
|
|
127
|
-
bgl dev [filter] [...args] Run dev servers with clean output (default: '
|
|
139
|
+
bgl dev [filter] [...args] Run dev servers with clean output (default: './!shared*')
|
|
128
140
|
Additional args are passed to vite (e.g., --mode localhost)
|
|
141
|
+
bgl build [project] [...args] Build project by directory (default: all projects)
|
|
129
142
|
bgl lint init Set up linting (auto-detects workspace)
|
|
130
143
|
bgl sdk generate Generate SDK (auto-detects workspace)
|
|
131
144
|
|
|
@@ -140,6 +153,32 @@ Note: Commands auto-detect workspace mode based on directory structure
|
|
|
140
153
|
}
|
|
141
154
|
}
|
|
142
155
|
|
|
156
|
+
function normalizeFilter(input: string): string {
|
|
157
|
+
if (input.startsWith('.')) return input
|
|
158
|
+
return `./${input}`
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function parseFilterArgs(
|
|
162
|
+
defaultFilter: string | undefined,
|
|
163
|
+
subcommandArg?: string,
|
|
164
|
+
argsList: string[] = [],
|
|
165
|
+
): { filter?: string, additionalArgs: string[] } {
|
|
166
|
+
const tokens = [subcommandArg, ...argsList].filter(Boolean) as string[]
|
|
167
|
+
const nonFlagIndexes = tokens
|
|
168
|
+
.map((token, index) => (token.startsWith('-') ? -1 : index))
|
|
169
|
+
.filter(index => index >= 0)
|
|
170
|
+
const filterIndex = nonFlagIndexes.length > 0
|
|
171
|
+
? nonFlagIndexes[nonFlagIndexes.length - 1]
|
|
172
|
+
: -1
|
|
173
|
+
const filter = filterIndex >= 0
|
|
174
|
+
? normalizeFilter(tokens[filterIndex])
|
|
175
|
+
: defaultFilter
|
|
176
|
+
const additionalArgs = filterIndex >= 0
|
|
177
|
+
? tokens.filter((_, index) => index !== filterIndex)
|
|
178
|
+
: tokens
|
|
179
|
+
return { filter, additionalArgs }
|
|
180
|
+
}
|
|
181
|
+
|
|
143
182
|
main().catch((error: unknown) => {
|
|
144
183
|
console.error('Error:', error)
|
|
145
184
|
process.exit(1)
|