@bagelink/workspace 1.7.4 → 1.8.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/README.md +89 -1
- package/bin/bgl.ts +34 -4
- package/dist/bin/bgl.cjs +30 -5
- package/dist/bin/bgl.mjs +30 -5
- package/dist/index.cjs +13 -10
- package/dist/index.d.cts +14 -1
- package/dist/index.d.mts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.mjs +2 -2
- package/dist/shared/workspace.Bwsdwbt-.cjs +575 -0
- package/dist/shared/workspace.Dq-27S1f.mjs +560 -0
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/workspace.ts +432 -0
- package/dist/shared/workspace.R3ocIOTb.mjs +0 -234
- package/dist/shared/workspace.hk0HFYa9.cjs +0 -246
package/README.md
CHANGED
|
@@ -161,7 +161,9 @@ export default defineWorkspace({
|
|
|
161
161
|
|
|
162
162
|
## CLI
|
|
163
163
|
|
|
164
|
-
###
|
|
164
|
+
### Single Project Setup
|
|
165
|
+
|
|
166
|
+
#### `npx bgl init`
|
|
165
167
|
|
|
166
168
|
Interactively generate project configuration files:
|
|
167
169
|
- `bgl.config.ts` - Workspace configuration
|
|
@@ -180,6 +182,92 @@ npx bgl init
|
|
|
180
182
|
- Generates netlify.toml with production proxy configuration
|
|
181
183
|
- Safe: prompts before each step
|
|
182
184
|
|
|
185
|
+
### Workspace (Multi-Project) Setup
|
|
186
|
+
|
|
187
|
+
#### `npx bgl init --workspace`
|
|
188
|
+
|
|
189
|
+
Create a workspace with flat structure for multiple projects:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
npx bgl init --workspace
|
|
193
|
+
|
|
194
|
+
? Workspace name: › my-workspace
|
|
195
|
+
? Bagel project ID: › my-project
|
|
196
|
+
? Create first project? › Yes
|
|
197
|
+
? First project name: › web
|
|
198
|
+
|
|
199
|
+
✅ Workspace created successfully!
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Creates structure:**
|
|
203
|
+
```
|
|
204
|
+
my-workspace/
|
|
205
|
+
├── package.json # Workspace root
|
|
206
|
+
├── bgl.config.ts # Shared config
|
|
207
|
+
├── tsconfig.json
|
|
208
|
+
├── shared/ # Shared code
|
|
209
|
+
│ ├── package.json
|
|
210
|
+
│ ├── utils/
|
|
211
|
+
│ └── types/
|
|
212
|
+
└── web/ # First project
|
|
213
|
+
├── bgl.config.ts
|
|
214
|
+
├── package.json
|
|
215
|
+
├── vite.config.ts
|
|
216
|
+
└── src/
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
#### `bgl add <project-name>`
|
|
220
|
+
|
|
221
|
+
Add a new project to workspace:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
bgl add admin
|
|
225
|
+
bgl add customer
|
|
226
|
+
bgl add mobile
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Each project:
|
|
230
|
+
- Gets its own directory at root level
|
|
231
|
+
- Inherits shared config from workspace root
|
|
232
|
+
- Can import from `shared/utils`, `shared/types`, etc.
|
|
233
|
+
- Auto-configures with Vite proxy
|
|
234
|
+
|
|
235
|
+
#### `bgl list`
|
|
236
|
+
|
|
237
|
+
List all projects in workspace:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
bgl list
|
|
241
|
+
|
|
242
|
+
Projects:
|
|
243
|
+
- web
|
|
244
|
+
- admin
|
|
245
|
+
- customer
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Running Workspace Projects
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
# Run all projects concurrently
|
|
252
|
+
bun run dev
|
|
253
|
+
|
|
254
|
+
# Run specific project
|
|
255
|
+
bun run dev:admin
|
|
256
|
+
bun run dev:customer
|
|
257
|
+
|
|
258
|
+
# Build specific project
|
|
259
|
+
bun run build:admin
|
|
260
|
+
|
|
261
|
+
# Build all projects
|
|
262
|
+
bun run build
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
**Vite automatically assigns ports:**
|
|
266
|
+
- First project: `http://localhost:5173`
|
|
267
|
+
- Second project: `http://localhost:5174`
|
|
268
|
+
- Third project: `http://localhost:5175`
|
|
269
|
+
- etc.
|
|
270
|
+
|
|
183
271
|
### `npx bgl --help`
|
|
184
272
|
|
|
185
273
|
Show CLI help.
|
package/bin/bgl.ts
CHANGED
|
@@ -1,22 +1,52 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import process from 'node:process'
|
|
3
3
|
import { generateWorkspaceConfig } from '../src/init.js'
|
|
4
|
+
import { addProject, initWorkspace, listProjects } from '../src/workspace.js'
|
|
4
5
|
|
|
5
|
-
const [,, command] = process.argv
|
|
6
|
+
const [,, command, ...args] = process.argv
|
|
6
7
|
|
|
7
8
|
async function main() {
|
|
8
9
|
if (command === 'init') {
|
|
9
|
-
|
|
10
|
+
const isWorkspace = args.includes('--workspace') || args.includes('-w')
|
|
11
|
+
if (isWorkspace) {
|
|
12
|
+
await initWorkspace()
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
await generateWorkspaceConfig()
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else if (command === 'add') {
|
|
19
|
+
const projectName = args[0]
|
|
20
|
+
if (!projectName) {
|
|
21
|
+
console.error('Error: Project name is required')
|
|
22
|
+
console.log('Usage: bgl add <project-name>')
|
|
23
|
+
process.exit(1)
|
|
24
|
+
}
|
|
25
|
+
await addProject(projectName)
|
|
26
|
+
}
|
|
27
|
+
else if (command === 'list') {
|
|
28
|
+
const projects = listProjects()
|
|
29
|
+
if (projects.length === 0) {
|
|
30
|
+
console.log('No projects found')
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
console.log('\nProjects:')
|
|
34
|
+
projects.forEach(p => console.log(` - ${p}`))
|
|
35
|
+
console.log('')
|
|
36
|
+
}
|
|
10
37
|
}
|
|
11
38
|
else {
|
|
12
39
|
console.log(`
|
|
13
40
|
Bagel Workspace CLI
|
|
14
41
|
|
|
15
42
|
Usage:
|
|
16
|
-
bgl init
|
|
43
|
+
bgl init Generate bgl.config.ts for single project
|
|
44
|
+
bgl init --workspace Create a new workspace with multiple projects
|
|
45
|
+
bgl add <name> Add a new project to workspace
|
|
46
|
+
bgl list List all projects in workspace
|
|
17
47
|
|
|
18
48
|
Options:
|
|
19
|
-
--help, -h
|
|
49
|
+
--help, -h Show this help message
|
|
20
50
|
`)
|
|
21
51
|
process.exit(command === '--help' || command === '-h' ? 0 : 1)
|
|
22
52
|
}
|
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
|
|
5
|
+
const workspace = require('../shared/workspace.Bwsdwbt-.cjs');
|
|
6
6
|
require('node:fs');
|
|
7
7
|
require('node:path');
|
|
8
8
|
require('prompts');
|
|
@@ -11,19 +11,44 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
11
|
|
|
12
12
|
const process__default = /*#__PURE__*/_interopDefaultCompat(process);
|
|
13
13
|
|
|
14
|
-
const [, , command] = process__default.argv;
|
|
14
|
+
const [, , command, ...args] = process__default.argv;
|
|
15
15
|
async function main() {
|
|
16
16
|
if (command === "init") {
|
|
17
|
-
|
|
17
|
+
const isWorkspace = args.includes("--workspace") || args.includes("-w");
|
|
18
|
+
if (isWorkspace) {
|
|
19
|
+
await workspace.initWorkspace();
|
|
20
|
+
} else {
|
|
21
|
+
await workspace.generateWorkspaceConfig();
|
|
22
|
+
}
|
|
23
|
+
} else if (command === "add") {
|
|
24
|
+
const projectName = args[0];
|
|
25
|
+
if (!projectName) {
|
|
26
|
+
console.error("Error: Project name is required");
|
|
27
|
+
console.log("Usage: bgl add <project-name>");
|
|
28
|
+
process__default.exit(1);
|
|
29
|
+
}
|
|
30
|
+
await workspace.addProject(projectName);
|
|
31
|
+
} else if (command === "list") {
|
|
32
|
+
const projects = workspace.listProjects();
|
|
33
|
+
if (projects.length === 0) {
|
|
34
|
+
console.log("No projects found");
|
|
35
|
+
} else {
|
|
36
|
+
console.log("\nProjects:");
|
|
37
|
+
projects.forEach((p) => console.log(` - ${p}`));
|
|
38
|
+
console.log("");
|
|
39
|
+
}
|
|
18
40
|
} else {
|
|
19
41
|
console.log(`
|
|
20
42
|
Bagel Workspace CLI
|
|
21
43
|
|
|
22
44
|
Usage:
|
|
23
|
-
bgl init
|
|
45
|
+
bgl init Generate bgl.config.ts for single project
|
|
46
|
+
bgl init --workspace Create a new workspace with multiple projects
|
|
47
|
+
bgl add <name> Add a new project to workspace
|
|
48
|
+
bgl list List all projects in workspace
|
|
24
49
|
|
|
25
50
|
Options:
|
|
26
|
-
--help, -h
|
|
51
|
+
--help, -h Show this help message
|
|
27
52
|
`);
|
|
28
53
|
process__default.exit(command === "--help" || command === "-h" ? 0 : 1);
|
|
29
54
|
}
|
package/dist/bin/bgl.mjs
CHANGED
|
@@ -1,23 +1,48 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import process from 'node:process';
|
|
3
|
-
import { g as generateWorkspaceConfig } from '../shared/workspace.
|
|
3
|
+
import { i as initWorkspace, g as generateWorkspaceConfig, d as addProject, l as listProjects } from '../shared/workspace.Dq-27S1f.mjs';
|
|
4
4
|
import 'node:fs';
|
|
5
5
|
import 'node:path';
|
|
6
6
|
import 'prompts';
|
|
7
7
|
|
|
8
|
-
const [, , command] = process.argv;
|
|
8
|
+
const [, , command, ...args] = process.argv;
|
|
9
9
|
async function main() {
|
|
10
10
|
if (command === "init") {
|
|
11
|
-
|
|
11
|
+
const isWorkspace = args.includes("--workspace") || args.includes("-w");
|
|
12
|
+
if (isWorkspace) {
|
|
13
|
+
await initWorkspace();
|
|
14
|
+
} else {
|
|
15
|
+
await generateWorkspaceConfig();
|
|
16
|
+
}
|
|
17
|
+
} else if (command === "add") {
|
|
18
|
+
const projectName = args[0];
|
|
19
|
+
if (!projectName) {
|
|
20
|
+
console.error("Error: Project name is required");
|
|
21
|
+
console.log("Usage: bgl add <project-name>");
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
await addProject(projectName);
|
|
25
|
+
} else if (command === "list") {
|
|
26
|
+
const projects = listProjects();
|
|
27
|
+
if (projects.length === 0) {
|
|
28
|
+
console.log("No projects found");
|
|
29
|
+
} else {
|
|
30
|
+
console.log("\nProjects:");
|
|
31
|
+
projects.forEach((p) => console.log(` - ${p}`));
|
|
32
|
+
console.log("");
|
|
33
|
+
}
|
|
12
34
|
} else {
|
|
13
35
|
console.log(`
|
|
14
36
|
Bagel Workspace CLI
|
|
15
37
|
|
|
16
38
|
Usage:
|
|
17
|
-
bgl init
|
|
39
|
+
bgl init Generate bgl.config.ts for single project
|
|
40
|
+
bgl init --workspace Create a new workspace with multiple projects
|
|
41
|
+
bgl add <name> Add a new project to workspace
|
|
42
|
+
bgl list List all projects in workspace
|
|
18
43
|
|
|
19
44
|
Options:
|
|
20
|
-
--help, -h
|
|
45
|
+
--help, -h Show this help message
|
|
21
46
|
`);
|
|
22
47
|
process.exit(command === "--help" || command === "-h" ? 0 : 1);
|
|
23
48
|
}
|
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
|
|
6
|
+
const workspace = require('./shared/workspace.Bwsdwbt-.cjs');
|
|
7
7
|
require('prompts');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
@@ -32,7 +32,7 @@ async function resolveConfig(mode = "development", options = {}) {
|
|
|
32
32
|
currentDir = parentDir;
|
|
33
33
|
}
|
|
34
34
|
if (options.interactive !== false) {
|
|
35
|
-
await
|
|
35
|
+
await workspace.generateWorkspaceConfig(root, configFile);
|
|
36
36
|
const newConfig = await loadConfig(localConfigPath, mode);
|
|
37
37
|
if (newConfig) {
|
|
38
38
|
return newConfig;
|
|
@@ -131,13 +131,13 @@ function createWorkspace(options = {}) {
|
|
|
131
131
|
* Generate Netlify configuration file
|
|
132
132
|
*/
|
|
133
133
|
generateNetlify(config, outPath = "./netlify.toml", additionalConfig) {
|
|
134
|
-
|
|
134
|
+
workspace.writeNetlifyConfig(config, outPath, additionalConfig);
|
|
135
135
|
},
|
|
136
136
|
/**
|
|
137
137
|
* Set build environment variables
|
|
138
138
|
*/
|
|
139
139
|
setBuildEnv(config) {
|
|
140
|
-
|
|
140
|
+
workspace.setBuildEnvVars(config);
|
|
141
141
|
},
|
|
142
142
|
/**
|
|
143
143
|
* Clear cached configuration
|
|
@@ -148,12 +148,15 @@ function createWorkspace(options = {}) {
|
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
exports.
|
|
152
|
-
exports.
|
|
153
|
-
exports.
|
|
154
|
-
exports.
|
|
155
|
-
exports.
|
|
156
|
-
exports.
|
|
151
|
+
exports.addProject = workspace.addProject;
|
|
152
|
+
exports.generateNetlifyConfig = workspace.generateNetlifyConfig;
|
|
153
|
+
exports.generateNetlifyRedirect = workspace.generateNetlifyRedirect;
|
|
154
|
+
exports.generateWorkspaceConfig = workspace.generateWorkspaceConfig;
|
|
155
|
+
exports.generateWorkspaceConfigSync = workspace.generateWorkspaceConfigSync;
|
|
156
|
+
exports.initWorkspace = workspace.initWorkspace;
|
|
157
|
+
exports.listProjects = workspace.listProjects;
|
|
158
|
+
exports.setBuildEnvVars = workspace.setBuildEnvVars;
|
|
159
|
+
exports.writeNetlifyConfig = workspace.writeNetlifyConfig;
|
|
157
160
|
exports.createCustomProxy = createCustomProxy;
|
|
158
161
|
exports.createViteProxy = createViteProxy;
|
|
159
162
|
exports.createWorkspace = createWorkspace;
|
package/dist/index.d.cts
CHANGED
|
@@ -91,6 +91,19 @@ declare function createCustomProxy(paths: string[], target: string, options?: {
|
|
|
91
91
|
secure?: boolean;
|
|
92
92
|
}): ProxyConfig;
|
|
93
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Initialize a new workspace with flat structure
|
|
96
|
+
*/
|
|
97
|
+
declare function initWorkspace(root?: string): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Add a new project to the workspace
|
|
100
|
+
*/
|
|
101
|
+
declare function addProject(name: string, root?: string): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* List all projects in workspace
|
|
104
|
+
*/
|
|
105
|
+
declare function listProjects(root?: string): string[];
|
|
106
|
+
|
|
94
107
|
/**
|
|
95
108
|
* Define workspace configuration
|
|
96
109
|
* Simple helper to get config from a config map
|
|
@@ -123,5 +136,5 @@ declare function createWorkspace(options?: WorkspaceOptions): {
|
|
|
123
136
|
clearCache(): void;
|
|
124
137
|
};
|
|
125
138
|
|
|
126
|
-
export { createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateWorkspaceConfig, generateWorkspaceConfigSync, mergeConfigs, resolveConfig, setBuildEnvVars, writeNetlifyConfig };
|
|
139
|
+
export { addProject, createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateWorkspaceConfig, generateWorkspaceConfigSync, initWorkspace, listProjects, mergeConfigs, resolveConfig, setBuildEnvVars, writeNetlifyConfig };
|
|
127
140
|
export type { ProxyConfig, WorkspaceConfig, WorkspaceEnvironment, WorkspaceOptions };
|
package/dist/index.d.mts
CHANGED
|
@@ -91,6 +91,19 @@ declare function createCustomProxy(paths: string[], target: string, options?: {
|
|
|
91
91
|
secure?: boolean;
|
|
92
92
|
}): ProxyConfig;
|
|
93
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Initialize a new workspace with flat structure
|
|
96
|
+
*/
|
|
97
|
+
declare function initWorkspace(root?: string): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Add a new project to the workspace
|
|
100
|
+
*/
|
|
101
|
+
declare function addProject(name: string, root?: string): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* List all projects in workspace
|
|
104
|
+
*/
|
|
105
|
+
declare function listProjects(root?: string): string[];
|
|
106
|
+
|
|
94
107
|
/**
|
|
95
108
|
* Define workspace configuration
|
|
96
109
|
* Simple helper to get config from a config map
|
|
@@ -123,5 +136,5 @@ declare function createWorkspace(options?: WorkspaceOptions): {
|
|
|
123
136
|
clearCache(): void;
|
|
124
137
|
};
|
|
125
138
|
|
|
126
|
-
export { createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateWorkspaceConfig, generateWorkspaceConfigSync, mergeConfigs, resolveConfig, setBuildEnvVars, writeNetlifyConfig };
|
|
139
|
+
export { addProject, createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateWorkspaceConfig, generateWorkspaceConfigSync, initWorkspace, listProjects, mergeConfigs, resolveConfig, setBuildEnvVars, writeNetlifyConfig };
|
|
127
140
|
export type { ProxyConfig, WorkspaceConfig, WorkspaceEnvironment, WorkspaceOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -91,6 +91,19 @@ declare function createCustomProxy(paths: string[], target: string, options?: {
|
|
|
91
91
|
secure?: boolean;
|
|
92
92
|
}): ProxyConfig;
|
|
93
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Initialize a new workspace with flat structure
|
|
96
|
+
*/
|
|
97
|
+
declare function initWorkspace(root?: string): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Add a new project to the workspace
|
|
100
|
+
*/
|
|
101
|
+
declare function addProject(name: string, root?: string): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* List all projects in workspace
|
|
104
|
+
*/
|
|
105
|
+
declare function listProjects(root?: string): string[];
|
|
106
|
+
|
|
94
107
|
/**
|
|
95
108
|
* Define workspace configuration
|
|
96
109
|
* Simple helper to get config from a config map
|
|
@@ -123,5 +136,5 @@ declare function createWorkspace(options?: WorkspaceOptions): {
|
|
|
123
136
|
clearCache(): void;
|
|
124
137
|
};
|
|
125
138
|
|
|
126
|
-
export { createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateWorkspaceConfig, generateWorkspaceConfigSync, mergeConfigs, resolveConfig, setBuildEnvVars, writeNetlifyConfig };
|
|
139
|
+
export { addProject, createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateWorkspaceConfig, generateWorkspaceConfigSync, initWorkspace, listProjects, mergeConfigs, resolveConfig, setBuildEnvVars, writeNetlifyConfig };
|
|
127
140
|
export type { ProxyConfig, WorkspaceConfig, WorkspaceEnvironment, WorkspaceOptions };
|
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 { a as generateNetlifyConfig, b as generateNetlifyRedirect, c as generateWorkspaceConfigSync } from './shared/workspace.
|
|
4
|
+
import { g as generateWorkspaceConfig, s as setBuildEnvVars, w as writeNetlifyConfig } from './shared/workspace.Dq-27S1f.mjs';
|
|
5
|
+
export { d as addProject, a as generateNetlifyConfig, b as generateNetlifyRedirect, c as generateWorkspaceConfigSync, i as initWorkspace, l as listProjects } from './shared/workspace.Dq-27S1f.mjs';
|
|
6
6
|
import 'prompts';
|
|
7
7
|
|
|
8
8
|
async function resolveConfig(mode = "development", options = {}) {
|