@bagelink/workspace 1.7.4 → 1.9.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 CHANGED
@@ -161,7 +161,9 @@ export default defineWorkspace({
161
161
 
162
162
  ## CLI
163
163
 
164
- ### `npx bgl init`
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,135 @@ 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
+
271
+ ### Linting Setup
272
+
273
+ #### `bgl lint init`
274
+
275
+ Set up linting and formatting in your project:
276
+
277
+ ```bash
278
+ bgl lint init
279
+
280
+ ? Select configurations to set up:
281
+ ✔ ESLint
282
+ ✔ Prettier
283
+ ✔ EditorConfig
284
+ ○ Git Hooks
285
+ ? Install dependencies? › Yes
286
+
287
+ ✅ Created eslint.config.js
288
+ ✅ Created .prettierrc
289
+ ✅ Created .prettierignore
290
+ ✅ Created .editorconfig
291
+ ✅ Updated package.json with lint scripts
292
+ ```
293
+
294
+ **Creates:**
295
+ - `eslint.config.js` - ESLint configuration (Vue 3 + TypeScript)
296
+ - `.prettierrc` - Prettier configuration
297
+ - `.prettierignore` - Prettier ignore patterns
298
+ - `.editorconfig` - Editor configuration
299
+ - `.lintstagedrc` - Lint-staged configuration (if git hooks selected)
300
+
301
+ **Adds scripts:**
302
+ - `bun run lint` - Run linter
303
+ - `bun run lint:fix` - Fix linting issues
304
+ - `bun run format` - Format code
305
+ - `bun run format:check` - Check formatting
306
+
307
+ **For workspace:**
308
+ ```bash
309
+ bgl lint init --workspace
310
+ ```
311
+
312
+ Sets up linting at workspace root level for all projects.
313
+
183
314
  ### `npx bgl --help`
184
315
 
185
316
  Show CLI help.
package/bin/bgl.ts CHANGED
@@ -1,22 +1,69 @@
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'
5
+ import { setupLint } from '../src/lint.js'
4
6
 
5
- const [,, command] = process.argv
7
+ const [,, command, subcommand, ...args] = process.argv
6
8
 
7
9
  async function main() {
8
10
  if (command === 'init') {
9
- await generateWorkspaceConfig()
11
+ const isWorkspace = args.includes('--workspace') || args.includes('-w')
12
+ if (isWorkspace) {
13
+ await initWorkspace()
14
+ }
15
+ else {
16
+ await generateWorkspaceConfig()
17
+ }
18
+ }
19
+ else if (command === 'add') {
20
+ const projectName = args[0]
21
+ if (!projectName) {
22
+ console.error('Error: Project name is required')
23
+ console.log('Usage: bgl add <project-name>')
24
+ process.exit(1)
25
+ }
26
+ await addProject(projectName)
27
+ }
28
+ else if (command === 'list') {
29
+ const projects = listProjects()
30
+ if (projects.length === 0) {
31
+ console.log('No projects found')
32
+ }
33
+ else {
34
+ console.log('\nProjects:')
35
+ projects.forEach(p => console.log(` - ${p}`))
36
+ console.log('')
37
+ }
38
+ }
39
+ else if (command === 'lint') {
40
+ if (subcommand === 'init') {
41
+ const isWorkspace = args.includes('--workspace') || args.includes('-w')
42
+ await setupLint(process.cwd(), isWorkspace)
43
+ }
44
+ else {
45
+ console.log(`
46
+ Lint Commands:
47
+ bgl lint init Set up linting in current project
48
+ bgl lint init --workspace Set up linting for workspace root
49
+ `)
50
+ process.exit(1)
51
+ }
10
52
  }
11
53
  else {
12
54
  console.log(`
13
55
  Bagel Workspace CLI
14
56
 
15
57
  Usage:
16
- bgl init Generate bgl.config.ts interactively
58
+ bgl init Generate bgl.config.ts for single project
59
+ bgl init --workspace Create a new workspace with multiple projects
60
+ bgl add <name> Add a new project to workspace
61
+ bgl list List all projects in workspace
62
+ bgl lint init Set up linting in current project
63
+ bgl lint init --workspace Set up linting for workspace root
17
64
 
18
65
  Options:
19
- --help, -h Show this help message
66
+ --help, -h Show this help message
20
67
  `)
21
68
  process.exit(command === '--help' || command === '-h' ? 0 : 1)
22
69
  }
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 init = require('../shared/workspace.hk0HFYa9.cjs');
5
+ const lint = require('../shared/workspace.CCUm_5GG.cjs');
6
6
  require('node:fs');
7
7
  require('node:path');
8
8
  require('prompts');
@@ -11,19 +11,58 @@ 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, subcommand, ...args] = process__default.argv;
15
15
  async function main() {
16
16
  if (command === "init") {
17
- await init.generateWorkspaceConfig();
17
+ const isWorkspace = args.includes("--workspace") || args.includes("-w");
18
+ if (isWorkspace) {
19
+ await lint.initWorkspace();
20
+ } else {
21
+ await lint.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 lint.addProject(projectName);
31
+ } else if (command === "list") {
32
+ const projects = lint.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
+ }
40
+ } else if (command === "lint") {
41
+ if (subcommand === "init") {
42
+ const isWorkspace = args.includes("--workspace") || args.includes("-w");
43
+ await lint.setupLint(process__default.cwd(), isWorkspace);
44
+ } else {
45
+ console.log(`
46
+ Lint Commands:
47
+ bgl lint init Set up linting in current project
48
+ bgl lint init --workspace Set up linting for workspace root
49
+ `);
50
+ process__default.exit(1);
51
+ }
18
52
  } else {
19
53
  console.log(`
20
54
  Bagel Workspace CLI
21
55
 
22
56
  Usage:
23
- bgl init Generate bgl.config.ts interactively
57
+ bgl init Generate bgl.config.ts for single project
58
+ bgl init --workspace Create a new workspace with multiple projects
59
+ bgl add <name> Add a new project to workspace
60
+ bgl list List all projects in workspace
61
+ bgl lint init Set up linting in current project
62
+ bgl lint init --workspace Set up linting for workspace root
24
63
 
25
64
  Options:
26
- --help, -h Show this help message
65
+ --help, -h Show this help message
27
66
  `);
28
67
  process__default.exit(command === "--help" || command === "-h" ? 0 : 1);
29
68
  }
package/dist/bin/bgl.mjs CHANGED
@@ -1,23 +1,62 @@
1
1
  #!/usr/bin/env node
2
2
  import process from 'node:process';
3
- import { g as generateWorkspaceConfig } from '../shared/workspace.R3ocIOTb.mjs';
3
+ import { i as initWorkspace, g as generateWorkspaceConfig, d as addProject, l as listProjects, e as setupLint } from '../shared/workspace.cX7U2RUq.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, subcommand, ...args] = process.argv;
9
9
  async function main() {
10
10
  if (command === "init") {
11
- await generateWorkspaceConfig();
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
+ }
34
+ } else if (command === "lint") {
35
+ if (subcommand === "init") {
36
+ const isWorkspace = args.includes("--workspace") || args.includes("-w");
37
+ await setupLint(process.cwd(), isWorkspace);
38
+ } else {
39
+ console.log(`
40
+ Lint Commands:
41
+ bgl lint init Set up linting in current project
42
+ bgl lint init --workspace Set up linting for workspace root
43
+ `);
44
+ process.exit(1);
45
+ }
12
46
  } else {
13
47
  console.log(`
14
48
  Bagel Workspace CLI
15
49
 
16
50
  Usage:
17
- bgl init Generate bgl.config.ts interactively
51
+ bgl init Generate bgl.config.ts for single project
52
+ bgl init --workspace Create a new workspace with multiple projects
53
+ bgl add <name> Add a new project to workspace
54
+ bgl list List all projects in workspace
55
+ bgl lint init Set up linting in current project
56
+ bgl lint init --workspace Set up linting for workspace root
18
57
 
19
58
  Options:
20
- --help, -h Show this help message
59
+ --help, -h Show this help message
21
60
  `);
22
61
  process.exit(command === "--help" || command === "-h" ? 0 : 1);
23
62
  }
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 init = require('./shared/workspace.hk0HFYa9.cjs');
6
+ const lint = require('./shared/workspace.CCUm_5GG.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 init.generateWorkspaceConfig(root, configFile);
35
+ await lint.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
- init.writeNetlifyConfig(config, outPath, additionalConfig);
134
+ lint.writeNetlifyConfig(config, outPath, additionalConfig);
135
135
  },
136
136
  /**
137
137
  * Set build environment variables
138
138
  */
139
139
  setBuildEnv(config) {
140
- init.setBuildEnvVars(config);
140
+ lint.setBuildEnvVars(config);
141
141
  },
142
142
  /**
143
143
  * Clear cached configuration
@@ -148,12 +148,16 @@ function createWorkspace(options = {}) {
148
148
  };
149
149
  }
150
150
 
151
- exports.generateNetlifyConfig = init.generateNetlifyConfig;
152
- exports.generateNetlifyRedirect = init.generateNetlifyRedirect;
153
- exports.generateWorkspaceConfig = init.generateWorkspaceConfig;
154
- exports.generateWorkspaceConfigSync = init.generateWorkspaceConfigSync;
155
- exports.setBuildEnvVars = init.setBuildEnvVars;
156
- exports.writeNetlifyConfig = init.writeNetlifyConfig;
151
+ exports.addProject = lint.addProject;
152
+ exports.generateNetlifyConfig = lint.generateNetlifyConfig;
153
+ exports.generateNetlifyRedirect = lint.generateNetlifyRedirect;
154
+ exports.generateWorkspaceConfig = lint.generateWorkspaceConfig;
155
+ exports.generateWorkspaceConfigSync = lint.generateWorkspaceConfigSync;
156
+ exports.initWorkspace = lint.initWorkspace;
157
+ exports.listProjects = lint.listProjects;
158
+ exports.setBuildEnvVars = lint.setBuildEnvVars;
159
+ exports.setupLint = lint.setupLint;
160
+ exports.writeNetlifyConfig = lint.writeNetlifyConfig;
157
161
  exports.createCustomProxy = createCustomProxy;
158
162
  exports.createViteProxy = createViteProxy;
159
163
  exports.createWorkspace = createWorkspace;
package/dist/index.d.cts CHANGED
@@ -91,6 +91,24 @@ 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
+
107
+ /**
108
+ * Set up linting in a project
109
+ */
110
+ declare function setupLint(root?: string, isWorkspace?: boolean): Promise<void>;
111
+
94
112
  /**
95
113
  * Define workspace configuration
96
114
  * Simple helper to get config from a config map
@@ -123,5 +141,5 @@ declare function createWorkspace(options?: WorkspaceOptions): {
123
141
  clearCache(): void;
124
142
  };
125
143
 
126
- export { createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateWorkspaceConfig, generateWorkspaceConfigSync, mergeConfigs, resolveConfig, setBuildEnvVars, writeNetlifyConfig };
144
+ export { addProject, createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateWorkspaceConfig, generateWorkspaceConfigSync, initWorkspace, listProjects, mergeConfigs, resolveConfig, setBuildEnvVars, setupLint, writeNetlifyConfig };
127
145
  export type { ProxyConfig, WorkspaceConfig, WorkspaceEnvironment, WorkspaceOptions };
package/dist/index.d.mts CHANGED
@@ -91,6 +91,24 @@ 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
+
107
+ /**
108
+ * Set up linting in a project
109
+ */
110
+ declare function setupLint(root?: string, isWorkspace?: boolean): Promise<void>;
111
+
94
112
  /**
95
113
  * Define workspace configuration
96
114
  * Simple helper to get config from a config map
@@ -123,5 +141,5 @@ declare function createWorkspace(options?: WorkspaceOptions): {
123
141
  clearCache(): void;
124
142
  };
125
143
 
126
- export { createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateWorkspaceConfig, generateWorkspaceConfigSync, mergeConfigs, resolveConfig, setBuildEnvVars, writeNetlifyConfig };
144
+ export { addProject, createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateWorkspaceConfig, generateWorkspaceConfigSync, initWorkspace, listProjects, mergeConfigs, resolveConfig, setBuildEnvVars, setupLint, writeNetlifyConfig };
127
145
  export type { ProxyConfig, WorkspaceConfig, WorkspaceEnvironment, WorkspaceOptions };
package/dist/index.d.ts CHANGED
@@ -91,6 +91,24 @@ 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
+
107
+ /**
108
+ * Set up linting in a project
109
+ */
110
+ declare function setupLint(root?: string, isWorkspace?: boolean): Promise<void>;
111
+
94
112
  /**
95
113
  * Define workspace configuration
96
114
  * Simple helper to get config from a config map
@@ -123,5 +141,5 @@ declare function createWorkspace(options?: WorkspaceOptions): {
123
141
  clearCache(): void;
124
142
  };
125
143
 
126
- export { createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateWorkspaceConfig, generateWorkspaceConfigSync, mergeConfigs, resolveConfig, setBuildEnvVars, writeNetlifyConfig };
144
+ export { addProject, createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateWorkspaceConfig, generateWorkspaceConfigSync, initWorkspace, listProjects, mergeConfigs, resolveConfig, setBuildEnvVars, setupLint, writeNetlifyConfig };
127
145
  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.R3ocIOTb.mjs';
5
- export { a as generateNetlifyConfig, b as generateNetlifyRedirect, c as generateWorkspaceConfigSync } from './shared/workspace.R3ocIOTb.mjs';
4
+ import { g as generateWorkspaceConfig, s as setBuildEnvVars, w as writeNetlifyConfig } from './shared/workspace.cX7U2RUq.mjs';
5
+ export { d as addProject, a as generateNetlifyConfig, b as generateNetlifyRedirect, c as generateWorkspaceConfigSync, i as initWorkspace, l as listProjects, e as setupLint } from './shared/workspace.cX7U2RUq.mjs';
6
6
  import 'prompts';
7
7
 
8
8
  async function resolveConfig(mode = "development", options = {}) {