everything-dev 1.20.0 → 1.21.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.
Files changed (61) hide show
  1. package/dist/cli/init.cjs +138 -74
  2. package/dist/cli/init.cjs.map +1 -1
  3. package/dist/cli/init.d.cts +9 -5
  4. package/dist/cli/init.d.cts.map +1 -1
  5. package/dist/cli/init.d.mts +9 -5
  6. package/dist/cli/init.d.mts.map +1 -1
  7. package/dist/cli/init.mjs +138 -75
  8. package/dist/cli/init.mjs.map +1 -1
  9. package/dist/cli/parse.cjs +9 -0
  10. package/dist/cli/parse.cjs.map +1 -1
  11. package/dist/cli/parse.mjs +9 -0
  12. package/dist/cli/parse.mjs.map +1 -1
  13. package/dist/cli/prompts.cjs +44 -13
  14. package/dist/cli/prompts.cjs.map +1 -1
  15. package/dist/cli/prompts.mjs +44 -13
  16. package/dist/cli/prompts.mjs.map +1 -1
  17. package/dist/cli/sync.cjs +6 -0
  18. package/dist/cli/sync.cjs.map +1 -1
  19. package/dist/cli/sync.mjs +6 -0
  20. package/dist/cli/sync.mjs.map +1 -1
  21. package/dist/cli.cjs +3 -1
  22. package/dist/cli.cjs.map +1 -1
  23. package/dist/cli.mjs +3 -1
  24. package/dist/cli.mjs.map +1 -1
  25. package/dist/contract.cjs +9 -1
  26. package/dist/contract.cjs.map +1 -1
  27. package/dist/contract.d.cts +37 -8
  28. package/dist/contract.d.cts.map +1 -1
  29. package/dist/contract.d.mts +37 -8
  30. package/dist/contract.d.mts.map +1 -1
  31. package/dist/contract.meta.cjs +2 -2
  32. package/dist/contract.meta.cjs.map +1 -1
  33. package/dist/contract.meta.d.cts +3 -3
  34. package/dist/contract.meta.d.mts +3 -3
  35. package/dist/contract.meta.mjs +2 -2
  36. package/dist/contract.meta.mjs.map +1 -1
  37. package/dist/contract.mjs +9 -2
  38. package/dist/contract.mjs.map +1 -1
  39. package/dist/index.cjs +1 -0
  40. package/dist/index.d.cts +2 -2
  41. package/dist/index.d.mts +2 -2
  42. package/dist/index.mjs +2 -2
  43. package/dist/plugin.cjs +24 -12
  44. package/dist/plugin.cjs.map +1 -1
  45. package/dist/plugin.d.cts +16 -5
  46. package/dist/plugin.d.cts.map +1 -1
  47. package/dist/plugin.d.mts +16 -5
  48. package/dist/plugin.d.mts.map +1 -1
  49. package/dist/plugin.mjs +25 -13
  50. package/dist/plugin.mjs.map +1 -1
  51. package/dist/types.d.cts +2 -2
  52. package/dist/types.d.mts +2 -2
  53. package/package.json +1 -1
  54. package/src/cli/init.ts +215 -89
  55. package/src/cli/parse.ts +17 -0
  56. package/src/cli/prompts.ts +45 -28
  57. package/src/cli/sync.ts +1 -0
  58. package/src/cli.ts +8 -1
  59. package/src/contract.meta.ts +6 -2
  60. package/src/contract.ts +5 -1
  61. package/src/plugin.ts +41 -18
@@ -1,3 +1,4 @@
1
+ import { OverrideSection } from "../contract.cjs";
1
2
  import { BosConfig, BosConfigInput } from "../types.cjs";
2
3
 
3
4
  //#region src/cli/init.d.ts
@@ -17,12 +18,13 @@ declare function resolveRepositoryViaExtendsChain(extendsAccount: string, extend
17
18
  repository: string;
18
19
  config: BosConfig;
19
20
  } | null>;
21
+ declare function detectGitRemoteUrl(directory: string): Promise<string | undefined>;
20
22
  declare function downloadTarball(repoUrl: string): Promise<{
21
23
  dir: string;
22
24
  cleanup: () => Promise<void>;
23
25
  }>;
24
26
  declare function copyFilteredFiles(sourceDir: string, destination: string, patterns: string[], options: {
25
- withHost: boolean;
27
+ overrides: OverrideSection[];
26
28
  plugins?: string[];
27
29
  pluginRoutes?: Record<string, string[]>;
28
30
  }): Promise<number>;
@@ -32,13 +34,14 @@ declare function personalizeConfig(destination: string, opts: {
32
34
  account?: string;
33
35
  domain?: string;
34
36
  plugins?: string[];
37
+ overrides: OverrideSection[];
35
38
  pluginRoutes?: Record<string, string[]>;
36
39
  workspaceOpts?: {
37
40
  localOverrides?: boolean;
38
41
  sourceDir?: string;
39
42
  };
40
43
  mode?: "init" | "sync";
41
- withHost?: boolean;
44
+ repository?: string;
42
45
  }): Promise<void>;
43
46
  declare function runBunInstall(destination: string): Promise<void>;
44
47
  declare function runTypesGen(destination: string): Promise<void>;
@@ -49,15 +52,16 @@ declare function scaffoldMinimalProject(destination: string, parentConfig: BosCo
49
52
  account?: string;
50
53
  domain?: string;
51
54
  plugins?: string[];
52
- withHost?: boolean;
55
+ overrides: OverrideSection[];
56
+ repository?: string;
53
57
  }): Promise<number>;
54
58
  declare function writeInitSnapshot(destination: string, extendsAccount: string, extendsGateway: string, sourceDir: string, patterns: string[], options: {
55
- withHost: boolean;
59
+ overrides: OverrideSection[];
56
60
  plugins?: string[];
57
61
  pluginRoutes?: Record<string, string[]>;
58
62
  }): Promise<void>;
59
63
  declare function generateDatabaseMigrations(destination: string): Promise<void>;
60
64
  declare function execCommand(command: string, args: string[], cwd?: string): Promise<void>;
61
65
  //#endregion
62
- export { copyFilteredFiles, downloadTarball, execCommand, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, readTemplatekeep, resolveRepositoryViaExtendsChain, resolveSourceDir, runBunInstall, runDockerComposeUp, runTypesGen, scaffoldMinimalProject, writeInitSnapshot };
66
+ export { copyFilteredFiles, detectGitRemoteUrl, downloadTarball, execCommand, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, readTemplatekeep, resolveRepositoryViaExtendsChain, resolveSourceDir, runBunInstall, runDockerComposeUp, runTypesGen, scaffoldMinimalProject, writeInitSnapshot };
63
67
  //# sourceMappingURL=init.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.cts","names":[],"sources":["../../src/cli/init.ts"],"mappings":";;;UA6BU,YAAA;EACR,SAAA;EACA,YAAA,EAAc,SAAA;EACd,OAAA,QAAe,OAAA;AAAA;AAAA,iBAGK,gBAAA,CAAiB,IAAA;EACrC,cAAA;EACA,cAAA;EACA,MAAA;AAAA,IACE,OAAA,CAAQ,YAAA;AAAA,iBAmCU,gBAAA,CAAiB,SAAA,WAAoB,OAAA;A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AAAA,IAED,OAAA;AAAA,iBAuJmB,iBAAA,CACpB,WAAA,UACA,cAAA,UACA,cAAA,UACA,SAAA,UACA,QAAA,YACA,OAAA;EACE,SAAA,EAAW,eAAA;EACX,OAAA;EACA,YAAA,GAAe,MAAA;AAAA,IAEhB,OAAA;AAAA,iBA8EmB,0BAAA,CAA2B,WAAA,WAAsB,OAAA;AAAA,iBAuBjD,WAAA,CAAY,OAAA,UAAiB,IAAA,YAAgB,GAAA,YAAe,OAAA"}
@@ -1,3 +1,4 @@
1
+ import { OverrideSection } from "../contract.mjs";
1
2
  import { BosConfig, BosConfigInput } from "../types.mjs";
2
3
 
3
4
  //#region src/cli/init.d.ts
@@ -17,12 +18,13 @@ declare function resolveRepositoryViaExtendsChain(extendsAccount: string, extend
17
18
  repository: string;
18
19
  config: BosConfig;
19
20
  } | null>;
21
+ declare function detectGitRemoteUrl(directory: string): Promise<string | undefined>;
20
22
  declare function downloadTarball(repoUrl: string): Promise<{
21
23
  dir: string;
22
24
  cleanup: () => Promise<void>;
23
25
  }>;
24
26
  declare function copyFilteredFiles(sourceDir: string, destination: string, patterns: string[], options: {
25
- withHost: boolean;
27
+ overrides: OverrideSection[];
26
28
  plugins?: string[];
27
29
  pluginRoutes?: Record<string, string[]>;
28
30
  }): Promise<number>;
@@ -32,13 +34,14 @@ declare function personalizeConfig(destination: string, opts: {
32
34
  account?: string;
33
35
  domain?: string;
34
36
  plugins?: string[];
37
+ overrides: OverrideSection[];
35
38
  pluginRoutes?: Record<string, string[]>;
36
39
  workspaceOpts?: {
37
40
  localOverrides?: boolean;
38
41
  sourceDir?: string;
39
42
  };
40
43
  mode?: "init" | "sync";
41
- withHost?: boolean;
44
+ repository?: string;
42
45
  }): Promise<void>;
43
46
  declare function runBunInstall(destination: string): Promise<void>;
44
47
  declare function runTypesGen(destination: string): Promise<void>;
@@ -49,15 +52,16 @@ declare function scaffoldMinimalProject(destination: string, parentConfig: BosCo
49
52
  account?: string;
50
53
  domain?: string;
51
54
  plugins?: string[];
52
- withHost?: boolean;
55
+ overrides: OverrideSection[];
56
+ repository?: string;
53
57
  }): Promise<number>;
54
58
  declare function writeInitSnapshot(destination: string, extendsAccount: string, extendsGateway: string, sourceDir: string, patterns: string[], options: {
55
- withHost: boolean;
59
+ overrides: OverrideSection[];
56
60
  plugins?: string[];
57
61
  pluginRoutes?: Record<string, string[]>;
58
62
  }): Promise<void>;
59
63
  declare function generateDatabaseMigrations(destination: string): Promise<void>;
60
64
  declare function execCommand(command: string, args: string[], cwd?: string): Promise<void>;
61
65
  //#endregion
62
- export { copyFilteredFiles, downloadTarball, execCommand, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, readTemplatekeep, resolveRepositoryViaExtendsChain, resolveSourceDir, runBunInstall, runDockerComposeUp, runTypesGen, scaffoldMinimalProject, writeInitSnapshot };
66
+ export { copyFilteredFiles, detectGitRemoteUrl, downloadTarball, execCommand, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, readTemplatekeep, resolveRepositoryViaExtendsChain, resolveSourceDir, runBunInstall, runDockerComposeUp, runTypesGen, scaffoldMinimalProject, writeInitSnapshot };
63
67
  //# sourceMappingURL=init.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.mts","names":[],"sources":["../../src/cli/init.ts"],"mappings":";;;UA6BU,YAAA;EACR,SAAA;EACA,YAAA,EAAc,SAAA;EACd,OAAA,QAAe,OAAA;AAAA;AAAA,iBAGK,gBAAA,CAAiB,IAAA;EACrC,cAAA;EACA,cAAA;EACA,MAAA;AAAA,IACE,OAAA,CAAQ,YAAA;AAAA,iBAmCU,gBAAA,CAAiB,SAAA,WAAoB,OAAA;AAAA,iBAarC,iBAAA,CACpB,cAAA,UACA,cAAA,WACC,OAAA,CAAQ,SAAA;AAAA,iBAKW,gCAAA,CACpB,cAAA,UACA,cAAA,UACA,OAAA,GAAO,GAAA,WACN,OAAA;EAAU,UAAA;EAAoB,MAAA,EAAQ,SAAA;AAAA;AAAA,iBA2BnB,eAAA,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B,WAAA,WAAsB,OAAA;AAAA,iBAuBjD,WAAA,CAAY,OAAA,UAAiB,IAAA,YAAgB,GAAA,YAAe,OAAA"}
package/dist/cli/init.mjs CHANGED
@@ -14,6 +14,12 @@ import { glob } from "glob";
14
14
 
15
15
  //#region src/cli/init.ts
16
16
  const require = createRequire(import.meta.url);
17
+ const OVERRIDE_WORKSPACE_MAP = {
18
+ ui: ["ui"],
19
+ api: ["api"],
20
+ host: ["host"],
21
+ plugins: []
22
+ };
17
23
  async function resolveSourceDir(opts) {
18
24
  if (opts.source) {
19
25
  const sourceDir = resolve(opts.source);
@@ -79,6 +85,30 @@ async function resolveRepositoryViaExtendsChain(extendsAccount, extendsGateway,
79
85
  return null;
80
86
  }
81
87
  }
88
+ async function detectGitRemoteUrl(directory) {
89
+ try {
90
+ const { stdout } = await execa("git", [
91
+ "remote",
92
+ "get-url",
93
+ "origin"
94
+ ], {
95
+ cwd: directory,
96
+ stdio: "pipe"
97
+ });
98
+ const url = stdout.trim();
99
+ if (!url) return void 0;
100
+ return normalizeGitUrl(url);
101
+ } catch {
102
+ return;
103
+ }
104
+ }
105
+ function normalizeGitUrl(url) {
106
+ const sshMatch = url.match(/^git@github\.com:([^/]+)\/([^/]+?)(?:\.git)?$/);
107
+ if (sshMatch) return `https://github.com/${sshMatch[1]}/${sshMatch[2]}`;
108
+ const httpsMatch = url.match(/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?(?:\/.*)?$/);
109
+ if (httpsMatch) return `https://github.com/${httpsMatch[1]}/${httpsMatch[2]}`;
110
+ return url.endsWith(".git") ? url.slice(0, -4) : url;
111
+ }
82
112
  async function downloadTarball(repoUrl) {
83
113
  const parsed = parseGitHubUrl(repoUrl);
84
114
  if (!parsed) throw new Error(`Cannot parse repository URL: ${repoUrl}`);
@@ -152,9 +182,20 @@ function parseGitHubUrl(url) {
152
182
  };
153
183
  return null;
154
184
  }
185
+ function filterPatternsByOverrides(patterns, overrides, _plugins) {
186
+ const has = (section) => overrides.includes(section);
187
+ let filtered = [...patterns];
188
+ if (!has("host")) filtered = filtered.filter((p) => !p.startsWith("host/") && p !== "host/**");
189
+ if (!has("ui")) filtered = filtered.filter((p) => !p.startsWith("ui/") && p !== "ui/**");
190
+ if (!has("api")) filtered = filtered.filter((p) => !p.startsWith("api/") && p !== "api/**");
191
+ if (!has("plugins")) filtered = filtered.filter((p) => !p.startsWith("plugins/") && p !== "plugins/**");
192
+ return filtered;
193
+ }
155
194
  async function copyFilteredFiles(sourceDir, destination, patterns, options) {
156
195
  if (patterns.length === 0) return 0;
157
- const effectivePatterns = options.withHost ? [...patterns, "host/**"] : patterns.filter((p) => !p.startsWith("host/") && p !== "host/**");
196
+ const has = (section) => options.overrides.includes(section);
197
+ const effectivePatterns = filterPatternsByOverrides(patterns, options.overrides, options.plugins);
198
+ if (has("host") && !effectivePatterns.some((p) => p.startsWith("host/") || p === "host/**")) effectivePatterns.push("host/**");
158
199
  const excludedRoutePatterns = [];
159
200
  if (options.pluginRoutes) {
160
201
  for (const [pluginKey, routePatterns] of Object.entries(options.pluginRoutes)) if (!(options.plugins?.includes(pluginKey) ?? true)) excludedRoutePatterns.push(...routePatterns);
@@ -203,45 +244,52 @@ async function copyFilteredFiles(sourceDir, destination, patterns, options) {
203
244
  }
204
245
  return count;
205
246
  }
247
+ function stripProductionFields(entry) {
248
+ delete entry.production;
249
+ delete entry.integrity;
250
+ delete entry.ssr;
251
+ delete entry.ssrIntegrity;
252
+ }
206
253
  async function personalizeConfig(destination, opts) {
207
254
  const isInit = opts.mode !== "sync";
255
+ const has = (section) => opts.overrides.includes(section);
208
256
  const configPath = join(destination, "bos.config.json");
209
257
  if (existsSync(configPath)) {
210
258
  const config = JSON.parse(readFileSync(configPath, "utf-8"));
211
259
  config.extends = `bos://${opts.extendsAccount}/${opts.extendsGateway}`;
212
260
  if (opts.account) config.account = opts.account;
213
261
  if (opts.domain) config.domain = opts.domain;
262
+ if (opts.repository) config.repository = opts.repository;
214
263
  if (isInit && config.app && typeof config.app === "object") {
215
264
  const app = config.app;
216
265
  for (const entryKey of Object.keys(app)) {
217
- const entry = app[entryKey];
218
- if (entry && typeof entry === "object") {
219
- const e = entry;
220
- delete e.production;
221
- delete e.integrity;
222
- delete e.ssr;
223
- delete e.ssrIntegrity;
266
+ if (!has(entryKey) && (entryKey === "host" || entryKey === "ui" || entryKey === "api" || entryKey === "auth")) {
267
+ delete app[entryKey];
268
+ continue;
224
269
  }
270
+ const entry = app[entryKey];
271
+ if (entry && typeof entry === "object") stripProductionFields(entry);
225
272
  }
226
273
  }
227
- if (config.plugins && typeof config.plugins === "object") {
228
- const plugins = config.plugins;
229
- if (opts.plugins !== void 0) {
230
- for (const pluginKey of Object.keys(plugins)) if (!opts.plugins.includes(pluginKey)) delete plugins[pluginKey];
231
- }
232
- for (const pluginKey of Object.keys(plugins)) {
233
- const plugin = plugins[pluginKey];
234
- let pluginObj;
235
- if (typeof plugin === "string") {
236
- pluginObj = { extends: plugin };
237
- plugins[pluginKey] = pluginObj;
238
- } else if (plugin && typeof plugin === "object") pluginObj = { ...plugin };
239
- else continue;
240
- delete pluginObj.production;
241
- delete pluginObj.integrity;
274
+ if (has("plugins")) {
275
+ if (config.plugins && typeof config.plugins === "object") {
276
+ const plugins = config.plugins;
277
+ if (opts.plugins !== void 0) {
278
+ for (const pluginKey of Object.keys(plugins)) if (!opts.plugins.includes(pluginKey)) delete plugins[pluginKey];
279
+ }
280
+ for (const pluginKey of Object.keys(plugins)) {
281
+ const plugin = plugins[pluginKey];
282
+ let pluginObj;
283
+ if (typeof plugin === "string") {
284
+ pluginObj = { extends: plugin };
285
+ plugins[pluginKey] = pluginObj;
286
+ } else if (plugin && typeof plugin === "object") pluginObj = { ...plugin };
287
+ else continue;
288
+ stripProductionFields(pluginObj);
289
+ }
290
+ if (Object.keys(plugins).length === 0) config.plugins = {};
242
291
  }
243
- if (Object.keys(plugins).length === 0) config.plugins = {};
244
- }
292
+ } else delete config.plugins;
245
293
  await saveBosConfig(destination, config);
246
294
  }
247
295
  const pkgPath = join(destination, "package.json");
@@ -251,10 +299,10 @@ async function personalizeConfig(destination, opts) {
251
299
  const ws = pkg.workspaces;
252
300
  if (Array.isArray(ws.packages)) ws.packages = ws.packages.filter((p) => {
253
301
  if (p.startsWith("packages/")) return false;
254
- if (p === "host") return opts.withHost ?? false;
255
- if (p === "plugins/*") return (opts.plugins?.length ?? 0) > 0;
302
+ if (p === "host") return has("host");
303
+ if (p === "plugins/*") return has("plugins") && (opts.plugins?.length ?? 0) > 0;
256
304
  const pluginMatch = p.match(/^plugins\/([^/]+)/);
257
- if (pluginMatch) return opts.plugins?.includes(pluginMatch[1]) ?? true;
305
+ if (pluginMatch) return has("plugins") && (opts.plugins?.includes(pluginMatch[1]) ?? true);
258
306
  return true;
259
307
  });
260
308
  }
@@ -275,7 +323,7 @@ async function personalizeConfig(destination, opts) {
275
323
  scripts["types:gen"] = "node_modules/.bin/bos types gen";
276
324
  if (scripts.typecheck) {
277
325
  scripts.typecheck = scripts.typecheck.replace("bun run types:gen && ", "").replace(/bun run --cwd packages\/everything-dev typecheck & ?/, "");
278
- if (!opts.withHost) scripts.typecheck = scripts.typecheck.replace(/bun run --cwd host tsc --noEmit & ?/, "");
326
+ if (!has("host")) scripts.typecheck = scripts.typecheck.replace(/bun run --cwd host tsc --noEmit & ?/, "");
279
327
  }
280
328
  }
281
329
  if (pkg.devDependencies && typeof pkg.devDependencies === "object") {
@@ -313,19 +361,25 @@ async function personalizeConfig(destination, opts) {
313
361
  }
314
362
  }
315
363
  await resolveWorkspaceRefs(destination, opts.workspaceOpts);
316
- const genContractPath = join(destination, "ui", "src", "lib", "api-types.gen.ts");
317
- if (!existsSync(genContractPath)) {
318
- mkdirSync(dirname(genContractPath), { recursive: true });
319
- writeFileSync(genContractPath, `export type ApiContract = Record<string, never>;\n`);
364
+ if (has("ui")) {
365
+ const genContractPath = join(destination, "ui", "src", "lib", "api-types.gen.ts");
366
+ if (!existsSync(genContractPath)) {
367
+ mkdirSync(dirname(genContractPath), { recursive: true });
368
+ writeFileSync(genContractPath, `export type ApiContract = Record<string, never>;\n`);
369
+ }
320
370
  }
321
- const pluginsClientGenPath = join(destination, "api", "src", "lib", "plugins-types.gen.ts");
322
- if (!existsSync(pluginsClientGenPath)) {
323
- mkdirSync(dirname(pluginsClientGenPath), { recursive: true });
324
- writeFileSync(pluginsClientGenPath, `import type { ContractRouterClient, AnyContractRouter } from "@orpc/contract";\ntype ClientFactory<C extends AnyContractRouter> = (context?: Record<string, unknown>) => ContractRouterClient<C>;\nexport type PluginsClient = Record<string, never>;\n`);
371
+ if (has("api")) {
372
+ const pluginsClientGenPath = join(destination, "api", "src", "lib", "plugins-types.gen.ts");
373
+ if (!existsSync(pluginsClientGenPath)) {
374
+ mkdirSync(dirname(pluginsClientGenPath), { recursive: true });
375
+ writeFileSync(pluginsClientGenPath, `import type { ContractRouterClient, AnyContractRouter } from "@orpc/contract";\ntype ClientFactory<C extends AnyContractRouter> = (context?: Record<string, unknown>) => ContractRouterClient<C>;\nexport type PluginsClient = Record<string, never>;\n`);
376
+ }
325
377
  }
326
378
  const authTypesContent = generateAuthTypesTemplate();
327
- const authTypesPaths = [join(destination, "ui", "src", "lib", "auth-types.gen.ts"), join(destination, "api", "src", "lib", "auth-types.gen.ts")];
328
- if (existsSync(join(destination, "host", "src"))) authTypesPaths.push(join(destination, "host", "src", "lib", "auth-types.gen.ts"));
379
+ const authTypesPaths = [];
380
+ if (has("ui")) authTypesPaths.push(join(destination, "ui", "src", "lib", "auth-types.gen.ts"));
381
+ if (has("api")) authTypesPaths.push(join(destination, "api", "src", "lib", "auth-types.gen.ts"));
382
+ if (has("host") && existsSync(join(destination, "host", "src"))) authTypesPaths.push(join(destination, "host", "src", "lib", "auth-types.gen.ts"));
329
383
  for (const authTypesGenPath of authTypesPaths) if (!existsSync(authTypesGenPath)) {
330
384
  mkdirSync(dirname(authTypesGenPath), { recursive: true });
331
385
  writeFileSync(authTypesGenPath, authTypesContent);
@@ -401,57 +455,51 @@ const WORKSPACE_LOCAL_PATHS = {
401
455
  };
402
456
  async function scaffoldMinimalProject(destination, parentConfig, opts) {
403
457
  mkdirSync(destination, { recursive: true });
458
+ const has = (section) => opts.overrides.includes(section);
404
459
  const config = {
405
460
  extends: `bos://${opts.extendsAccount}/${opts.extendsGateway}`,
406
461
  account: opts.account || opts.extendsAccount,
407
- ...opts.domain ? { domain: opts.domain } : {}
462
+ ...opts.domain ? { domain: opts.domain } : {},
463
+ ...opts.repository ? { repository: opts.repository } : {}
408
464
  };
409
465
  if (parentConfig.app && typeof parentConfig.app === "object") {
410
466
  const app = {};
411
467
  const parentApp = parentConfig.app;
412
- if (parentApp.host) {
468
+ if (has("host") && parentApp.host) {
413
469
  app.host = { ...parentApp.host };
414
- const host = app.host;
415
- delete host.production;
416
- delete host.integrity;
470
+ stripProductionFields(app.host);
417
471
  }
418
- if (parentApp.ui) {
472
+ if (has("ui") && parentApp.ui) {
419
473
  app.ui = { ...parentApp.ui };
420
- const ui = app.ui;
421
- delete ui.production;
422
- delete ui.integrity;
423
- delete ui.ssr;
424
- delete ui.ssrIntegrity;
474
+ stripProductionFields(app.ui);
425
475
  }
426
- if (parentApp.api) {
476
+ if (has("api") && parentApp.api) {
427
477
  app.api = { ...parentApp.api };
428
- const api = app.api;
429
- delete api.production;
430
- delete api.integrity;
478
+ stripProductionFields(app.api);
431
479
  }
432
- if (parentApp.auth) {
480
+ if (has("plugins") && parentApp.auth) {
433
481
  app.auth = { ...parentApp.auth };
434
- const auth = app.auth;
435
- delete auth.production;
436
- delete auth.integrity;
482
+ stripProductionFields(app.auth);
437
483
  }
438
- config.app = app;
484
+ if (Object.keys(app).length > 0) config.app = app;
439
485
  }
440
- if (opts.plugins && opts.plugins.length > 0 && parentConfig.plugins) {
486
+ if (has("plugins") && opts.plugins && opts.plugins.length > 0 && parentConfig.plugins) {
441
487
  const plugins = {};
442
488
  for (const key of opts.plugins) {
443
489
  const parentPlugin = parentConfig.plugins?.[key];
444
490
  if (parentPlugin) if (typeof parentPlugin === "string") plugins[key] = { extends: parentPlugin };
445
491
  else {
446
492
  const pluginCopy = { ...parentPlugin };
447
- delete pluginCopy.production;
448
- delete pluginCopy.integrity;
493
+ stripProductionFields(pluginCopy);
449
494
  plugins[key] = pluginCopy;
450
495
  }
451
496
  }
452
497
  config.plugins = plugins;
453
498
  }
454
499
  await saveBosConfig(destination, config);
500
+ const workspacePackages = [];
501
+ for (const section of opts.overrides) workspacePackages.push(...OVERRIDE_WORKSPACE_MAP[section]);
502
+ if (has("plugins") && opts.plugins) for (const plugin of opts.plugins) workspacePackages.push(`plugins/${plugin}`);
455
503
  const pkg = {
456
504
  name: opts.domain || opts.extendsGateway,
457
505
  private: true,
@@ -474,12 +522,12 @@ async function scaffoldMinimalProject(destination, parentConfig, opts) {
474
522
  },
475
523
  devDependencies: {},
476
524
  workspaces: {
477
- packages: [],
525
+ packages: workspacePackages,
478
526
  catalog: {}
479
527
  }
480
528
  };
481
529
  writeFileSync(join(destination, "package.json"), `${JSON.stringify(pkg, null, 2)}\n`);
482
- const envExample = generateEnvExample(parentConfig);
530
+ const envExample = generateEnvExample(parentConfig, opts.overrides);
483
531
  if (envExample) writeFileSync(join(destination, ".env.example"), envExample);
484
532
  writeFileSync(join(destination, ".gitignore"), generateGitignore());
485
533
  return 4;
@@ -514,7 +562,9 @@ async function resolveWorkspaceRefs(destination, options) {
514
562
  }
515
563
  }
516
564
  async function writeInitSnapshot(destination, extendsAccount, extendsGateway, sourceDir, patterns, options) {
517
- const effectivePatterns = options.withHost ? [...patterns, "host/**"] : patterns.filter((p) => !p.startsWith("host/") && p !== "host/**");
565
+ const effectivePatterns = filterPatternsByOverrides(patterns, options.overrides, options.plugins);
566
+ const has = (section) => options.overrides.includes(section);
567
+ if (has("host") && !effectivePatterns.some((p) => p.startsWith("host/") || p === "host/**")) effectivePatterns.push("host/**");
518
568
  const excludedRoutePatterns = [];
519
569
  if (options.pluginRoutes) {
520
570
  for (const [pluginKey, routePatterns] of Object.entries(options.pluginRoutes)) if (!(options.plugins?.includes(pluginKey) ?? true)) excludedRoutePatterns.push(...routePatterns);
@@ -587,17 +637,30 @@ async function execCommand(command, args, cwd) {
587
637
  stdio: "pipe"
588
638
  });
589
639
  }
590
- function generateEnvExample(config) {
640
+ function generateEnvExample(config, overrides) {
641
+ const has = (section) => overrides.includes(section);
591
642
  const lines = ["# Environment variables"];
592
- const collectSecrets = (obj, prefix = "") => {
593
- for (const [key, value] of Object.entries(obj)) if (key === "secrets" && Array.isArray(value)) {
594
- for (const secret of value) if (typeof secret === "string") lines.push(`${secret}=`);
595
- } else if (key === "variables" && isPlainObject(value)) {
596
- for (const [varKey, varVal] of Object.entries(value)) if (typeof varVal === "string") lines.push(`${varKey}=${varVal}`);
597
- } else if (isPlainObject(value) && key !== "extends") collectSecrets(value, `${prefix}${key}.`);
643
+ const collectSecrets = (obj, includeSection, prefix = "") => {
644
+ for (const [key, value] of Object.entries(obj)) {
645
+ if (!includeSection) continue;
646
+ if (key === "secrets" && Array.isArray(value)) {
647
+ for (const secret of value) if (typeof secret === "string") lines.push(`${secret}=`);
648
+ } else if (key === "variables" && isPlainObject(value)) {
649
+ for (const [varKey, varVal] of Object.entries(value)) if (typeof varVal === "string") lines.push(`${varKey}=${varVal}`);
650
+ } else if (isPlainObject(value) && key !== "extends") collectSecrets(value, includeSection, `${prefix}${key}.`);
651
+ }
598
652
  };
599
- if (config.app && typeof config.app === "object") collectSecrets(config.app);
600
- if (config.plugins && typeof config.plugins === "object") collectSecrets(config.plugins);
653
+ if (config.app && typeof config.app === "object") {
654
+ const app = config.app;
655
+ collectSecrets(app, has("host"), "host.");
656
+ collectSecrets(app, has("ui"), "ui.");
657
+ collectSecrets(app, has("api"), "api.");
658
+ collectSecrets(app, has("plugins"), "auth.");
659
+ }
660
+ if (has("plugins") && config.plugins && typeof config.plugins === "object") {
661
+ for (const [pluginKey, pluginVal] of Object.entries(config.plugins)) if (isPlainObject(pluginVal)) collectSecrets(pluginVal, true);
662
+ else if (typeof pluginVal === "string") lines.push(`# Plugin '${pluginKey}' extends ${pluginVal}`);
663
+ }
601
664
  lines.push("BETTER_AUTH_SECRET=generate-a-secret-here");
602
665
  return `${lines.join("\n")}\n`;
603
666
  }
@@ -615,5 +678,5 @@ dist/
615
678
  }
616
679
 
617
680
  //#endregion
618
- export { copyFilteredFiles, downloadTarball, execCommand, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, readTemplatekeep, resolveRepositoryViaExtendsChain, resolveSourceDir, runBunInstall, runDockerComposeUp, runTypesGen, scaffoldMinimalProject, writeInitSnapshot };
681
+ export { copyFilteredFiles, detectGitRemoteUrl, downloadTarball, execCommand, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, readTemplatekeep, resolveRepositoryViaExtendsChain, resolveSourceDir, runBunInstall, runDockerComposeUp, runTypesGen, scaffoldMinimalProject, writeInitSnapshot };
619
682
  //# sourceMappingURL=init.mjs.map