create-better-fullstack 2.1.0 → 2.1.2

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.
@@ -1,8 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { r as readBtsConfig } from "./bts-config-InNcw1aJ.mjs";
2
+ import { a as handleError, m as readBtsConfig } from "./errors-D9yiiGVq.mjs";
3
3
  import { t as renderTitle } from "./render-title-zvyKC1ej.mjs";
4
- import { a as handleError } from "./errors-ns_o2OKg.mjs";
5
- import { t as runGeneratedChecks } from "./generated-checks-CUhFFfVo.mjs";
4
+ import { t as runGeneratedChecks } from "./generated-checks-DUvVXWId.mjs";
6
5
  import { intro, log, spinner } from "@clack/prompts";
7
6
  import pc from "picocolors";
8
7
  import fs from "fs-extra";
@@ -1,10 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import { t as __reExport } from "./chunk-CCII7kTE.mjs";
3
+ import { cancel } from "@clack/prompts";
4
+ import pc from "picocolors";
3
5
  import fs from "fs-extra";
4
6
  import path from "node:path";
5
7
  import * as JSONC from "jsonc-parser";
6
8
  import { createCliDefaultProjectConfigBase } from "@better-fullstack/types";
7
9
  import { fileURLToPath } from "node:url";
10
+ import { AsyncLocalStorage } from "node:async_hooks";
11
+ import consola from "consola";
8
12
 
9
13
  //#region src/types.ts
10
14
  var types_exports = {};
@@ -231,13 +235,25 @@ const getLatestCLIVersion = () => {
231
235
  //#endregion
232
236
  //#region src/utils/bts-config.ts
233
237
  const BTS_CONFIG_FILE = "bts.jsonc";
238
+ const MOBILE_CONFIG_FIELDS = [
239
+ "mobileNavigation",
240
+ "mobileUI",
241
+ "mobileStorage",
242
+ "mobileTesting",
243
+ "mobilePush",
244
+ "mobileOTA",
245
+ "mobileDeepLinking"
246
+ ];
234
247
  function normalizeGraphConfigForPersistence(projectConfig, stackParts) {
235
248
  if (!stackParts) return projectConfig;
236
249
  const legacyConfig = (0, types_exports.stackPartsToLegacyProjectConfigPartial)(stackParts);
237
250
  const selectedEcosystems = new Set(stackParts.filter((part) => part.source !== "provided").map((part) => part.ecosystem));
251
+ selectedEcosystems.add(projectConfig.ecosystem);
252
+ const hasSelectedEcosystemStackParts = stackParts.some((part) => part.source !== "provided" && part.ecosystem !== "universal");
238
253
  const normalized = {
239
254
  ...projectConfig,
240
- ...legacyConfig
255
+ ...legacyConfig,
256
+ ecosystem: hasSelectedEcosystemStackParts ? legacyConfig.ecosystem ?? projectConfig.ecosystem : projectConfig.ecosystem
241
257
  };
242
258
  if (!selectedEcosystems.has("rust")) {
243
259
  normalized.rustWebFramework = "none";
@@ -285,6 +301,7 @@ function normalizeGraphConfigForPersistence(projectConfig, stackParts) {
285
301
  normalized.goConfig = "none";
286
302
  normalized.goObservability = "none";
287
303
  }
304
+ if (selectedEcosystems.has("go") && projectConfig.auth === "go-better-auth" && legacyConfig.auth === "none") normalized.auth = projectConfig.auth;
288
305
  if (!selectedEcosystems.has("java")) {
289
306
  normalized.javaWebFramework = "none";
290
307
  normalized.javaBuildTool = "none";
@@ -326,7 +343,15 @@ function normalizeGraphConfigForPersistence(projectConfig, stackParts) {
326
343
  normalized.elixirDeploy = "none";
327
344
  normalized.elixirLibraries = [];
328
345
  }
329
- if (!selectedEcosystems.has("react-native")) {
346
+ const projectHasNativeFrontend = projectConfig.frontend.some((frontend) => frontend.startsWith("native-"));
347
+ const normalizedHasNativeFrontend = normalized.frontend.some((frontend) => frontend.startsWith("native-"));
348
+ const hasNativeFrontend = projectHasNativeFrontend || normalizedHasNativeFrontend;
349
+ if (hasNativeFrontend) for (const field of MOBILE_CONFIG_FIELDS) {
350
+ const projectValue = projectConfig[field];
351
+ const legacyValue = legacyConfig[field];
352
+ if (projectValue !== void 0 && projectValue !== "none" && legacyValue === "none") normalized[field] = projectValue;
353
+ }
354
+ if (!selectedEcosystems.has("react-native") && !hasNativeFrontend) {
330
355
  normalized.mobileNavigation = "none";
331
356
  normalized.mobileUI = "none";
332
357
  normalized.mobileStorage = "none";
@@ -425,8 +450,16 @@ function buildBtsConfigForPersistence(projectConfig, metadata = {}) {
425
450
  api: persistedConfig.api,
426
451
  webDeploy: persistedConfig.webDeploy,
427
452
  serverDeploy: persistedConfig.serverDeploy,
453
+ astroIntegration: persistedConfig.astroIntegration,
428
454
  cssFramework: persistedConfig.cssFramework,
429
455
  uiLibrary: persistedConfig.uiLibrary,
456
+ shadcnBase: persistedConfig.shadcnBase,
457
+ shadcnStyle: persistedConfig.shadcnStyle,
458
+ shadcnIconLibrary: persistedConfig.shadcnIconLibrary,
459
+ shadcnColorTheme: persistedConfig.shadcnColorTheme,
460
+ shadcnBaseColor: persistedConfig.shadcnBaseColor,
461
+ shadcnFont: persistedConfig.shadcnFont,
462
+ shadcnRadius: persistedConfig.shadcnRadius,
430
463
  realtime: persistedConfig.realtime,
431
464
  jobQueue: persistedConfig.jobQueue,
432
465
  animation: persistedConfig.animation,
@@ -538,8 +571,8 @@ function previewBtsConfigUpdate(currentConfig, updates) {
538
571
  createdAt: currentConfig.createdAt
539
572
  });
540
573
  }
541
- async function writeBtsConfig(projectConfig) {
542
- const btsConfig = buildBtsConfigForPersistence(projectConfig);
574
+ async function writeBtsConfig(projectConfig, metadata = {}) {
575
+ const btsConfig = buildBtsConfigForPersistence(projectConfig, metadata);
543
576
  const baseContent = {
544
577
  $schema: "https://better-fullstack-web.vercel.app/schema.json",
545
578
  version: btsConfig.version,
@@ -572,8 +605,16 @@ async function writeBtsConfig(projectConfig) {
572
605
  api: btsConfig.api,
573
606
  webDeploy: btsConfig.webDeploy,
574
607
  serverDeploy: btsConfig.serverDeploy,
608
+ astroIntegration: btsConfig.astroIntegration,
575
609
  cssFramework: btsConfig.cssFramework,
576
610
  uiLibrary: btsConfig.uiLibrary,
611
+ shadcnBase: btsConfig.shadcnBase,
612
+ shadcnStyle: btsConfig.shadcnStyle,
613
+ shadcnIconLibrary: btsConfig.shadcnIconLibrary,
614
+ shadcnColorTheme: btsConfig.shadcnColorTheme,
615
+ shadcnBaseColor: btsConfig.shadcnBaseColor,
616
+ shadcnFont: btsConfig.shadcnFont,
617
+ shadcnRadius: btsConfig.shadcnRadius,
577
618
  realtime: btsConfig.realtime,
578
619
  jobQueue: btsConfig.jobQueue,
579
620
  animation: btsConfig.animation,
@@ -593,6 +634,7 @@ async function writeBtsConfig(projectConfig) {
593
634
  rateLimit: btsConfig.rateLimit,
594
635
  i18n: btsConfig.i18n,
595
636
  search: btsConfig.search,
637
+ vectorDb: btsConfig.vectorDb,
596
638
  fileStorage: btsConfig.fileStorage,
597
639
  rustWebFramework: btsConfig.rustWebFramework,
598
640
  rustFrontend: btsConfig.rustFrontend,
@@ -756,4 +798,83 @@ async function updateBtsConfig(projectDir, updates) {
756
798
  }
757
799
 
758
800
  //#endregion
759
- export { getPrimaryGraphPart as _, updateBtsConfig as a, DEFAULT_CONFIG as c, getUserPkgManager as d, getEffectiveStack as f, getGraphSummary as g, getGraphPart as h, readBtsConfigFromFile as i, DEFAULT_UI_LIBRARY_BY_FRONTEND as l, getGraphBackendUrl as m, previewBtsConfigUpdate as n, writeBtsConfig as o, getGraphBackendDeployInstructions as p, readBtsConfig as r, getLatestCLIVersion as s, buildBtsConfigForPersistence as t, getDefaultConfig as u, hasGraphPart as v, types_exports as y };
801
+ //#region src/utils/context.ts
802
+ const cliStorage = new AsyncLocalStorage();
803
+ function defaultContext() {
804
+ return {
805
+ navigation: {
806
+ isFirstPrompt: false,
807
+ lastPromptShownUI: false
808
+ },
809
+ silent: false
810
+ };
811
+ }
812
+ function getContext() {
813
+ const ctx = cliStorage.getStore();
814
+ if (!ctx) return defaultContext();
815
+ return ctx;
816
+ }
817
+ function tryGetContext() {
818
+ return cliStorage.getStore();
819
+ }
820
+ function isSilent() {
821
+ return getContext().silent;
822
+ }
823
+ function isFirstPrompt() {
824
+ return getContext().navigation.isFirstPrompt;
825
+ }
826
+ function didLastPromptShowUI() {
827
+ return getContext().navigation.lastPromptShownUI;
828
+ }
829
+ function setIsFirstPrompt(value) {
830
+ const ctx = tryGetContext();
831
+ if (ctx) ctx.navigation.isFirstPrompt = value;
832
+ }
833
+ function setLastPromptShownUI(value) {
834
+ const ctx = tryGetContext();
835
+ if (ctx) ctx.navigation.lastPromptShownUI = value;
836
+ }
837
+ async function runWithContextAsync(options, fn) {
838
+ const ctx = {
839
+ navigation: {
840
+ isFirstPrompt: false,
841
+ lastPromptShownUI: false
842
+ },
843
+ silent: options.silent ?? false
844
+ };
845
+ return cliStorage.run(ctx, fn);
846
+ }
847
+
848
+ //#endregion
849
+ //#region src/utils/errors.ts
850
+ var UserCancelledError = class extends Error {
851
+ constructor(message = "Operation cancelled") {
852
+ super(message);
853
+ this.name = "UserCancelledError";
854
+ }
855
+ };
856
+ var CLIError = class extends Error {
857
+ constructor(message) {
858
+ super(message);
859
+ this.name = "CLIError";
860
+ }
861
+ };
862
+ function exitWithError(message) {
863
+ if (isSilent()) throw new CLIError(message);
864
+ consola.error(pc.red(message));
865
+ process.exit(1);
866
+ }
867
+ function exitCancelled(message = "Operation cancelled") {
868
+ if (isSilent()) throw new UserCancelledError(message);
869
+ cancel(pc.red(message));
870
+ process.exit(1);
871
+ }
872
+ function handleError(error, fallbackMessage) {
873
+ const message = error instanceof Error ? error.message : fallbackMessage || String(error);
874
+ if (isSilent()) throw error instanceof Error ? error : new Error(message);
875
+ consola.error(pc.red(message));
876
+ process.exit(1);
877
+ }
878
+
879
+ //#endregion
880
+ export { types_exports as A, getEffectiveStack as C, getGraphSummary as D, getGraphPart as E, getPrimaryGraphPart as O, getUserPkgManager as S, getGraphBackendUrl as T, writeBtsConfig as _, handleError as a, DEFAULT_UI_LIBRARY_BY_FRONTEND as b, isSilent as c, setLastPromptShownUI as d, buildBtsConfigForPersistence as f, updateBtsConfig as g, readBtsConfigFromFile as h, exitWithError as i, hasGraphPart as k, runWithContextAsync as l, readBtsConfig as m, UserCancelledError as n, didLastPromptShowUI as o, previewBtsConfigUpdate as p, exitCancelled as r, isFirstPrompt as s, CLIError as t, setIsFirstPrompt as u, getLatestCLIVersion as v, getGraphBackendDeployInstructions as w, getDefaultConfig as x, DEFAULT_CONFIG as y };
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { _ as getPrimaryGraphPart } from "./bts-config-InNcw1aJ.mjs";
2
+ import { O as getPrimaryGraphPart } from "./errors-D9yiiGVq.mjs";
3
3
  import { log, spinner } from "@clack/prompts";
4
4
  import pc from "picocolors";
5
5
  import path from "node:path";
package/dist/index.d.mts CHANGED
@@ -37,10 +37,10 @@ declare const router: {
37
37
  create: _orpc_server0.Procedure<_orpc_server0.MergedInitialContext<Record<never, never>, Record<never, never>, Record<never, never>>, Record<never, never>, z.ZodTuple<[z.ZodOptional<z.ZodString>, z.ZodObject<{
38
38
  template: z.ZodOptional<z.ZodEnum<{
39
39
  none: "none";
40
+ uniwind: "uniwind";
40
41
  mern: "mern";
41
42
  pern: "pern";
42
43
  t3: "t3";
43
- uniwind: "uniwind";
44
44
  }>>;
45
45
  fromHistory: z.ZodOptional<z.ZodNumber>;
46
46
  config: z.ZodOptional<z.ZodString>;
@@ -118,8 +118,8 @@ declare const router: {
118
118
  uppy: "uppy";
119
119
  }>>;
120
120
  effect: z.ZodOptional<z.ZodEnum<{
121
- none: "none";
122
121
  effect: "effect";
122
+ none: "none";
123
123
  "effect-full": "effect-full";
124
124
  }>>;
125
125
  stateManagement: z.ZodOptional<z.ZodEnum<{
@@ -279,9 +279,9 @@ declare const router: {
279
279
  }>>;
280
280
  mobileUI: z.ZodOptional<z.ZodEnum<{
281
281
  none: "none";
282
- uniwind: "uniwind";
283
282
  tamagui: "tamagui";
284
283
  "gluestack-ui": "gluestack-ui";
284
+ uniwind: "uniwind";
285
285
  unistyles: "unistyles";
286
286
  }>>;
287
287
  mobileStorage: z.ZodOptional<z.ZodEnum<{
@@ -366,8 +366,8 @@ declare const router: {
366
366
  "github-actions": "github-actions";
367
367
  }>>>;
368
368
  examples: z.ZodOptional<z.ZodArray<z.ZodEnum<{
369
- none: "none";
370
369
  ai: "ai";
370
+ none: "none";
371
371
  "chat-sdk": "chat-sdk";
372
372
  "tanstack-showcase": "tanstack-showcase";
373
373
  }>>>;
@@ -516,8 +516,8 @@ declare const router: {
516
516
  "geist-mono": "geist-mono";
517
517
  }>>;
518
518
  shadcnRadius: z.ZodOptional<z.ZodEnum<{
519
- none: "none";
520
519
  default: "default";
520
+ none: "none";
521
521
  small: "small";
522
522
  medium: "medium";
523
523
  large: "large";
@@ -545,10 +545,10 @@ declare const router: {
545
545
  vercel: "vercel";
546
546
  }>>;
547
547
  directoryConflict: z.ZodOptional<z.ZodEnum<{
548
+ error: "error";
548
549
  merge: "merge";
549
550
  overwrite: "overwrite";
550
551
  increment: "increment";
551
- error: "error";
552
552
  }>>;
553
553
  renderTitle: z.ZodOptional<z.ZodBoolean>;
554
554
  disableAnalytics: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -581,12 +581,12 @@ declare const router: {
581
581
  ratatui: "ratatui";
582
582
  }>>;
583
583
  rustLibraries: z.ZodOptional<z.ZodArray<z.ZodEnum<{
584
+ config: "config";
584
585
  none: "none";
585
586
  serde: "serde";
586
587
  uuid: "uuid";
587
588
  chrono: "chrono";
588
589
  reqwest: "reqwest";
589
- config: "config";
590
590
  dashmap: "dashmap";
591
591
  "parking-lot": "parking-lot";
592
592
  secrecy: "secrecy";
package/dist/index.mjs CHANGED
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import "./bts-config-InNcw1aJ.mjs";
3
- import { a as docs, c as sponsors, i as createBtsCli, l as telemetry, n as builder, o as history, r as create, s as router, t as add } from "./run-Cqy-n1iT.mjs";
2
+ import "./errors-D9yiiGVq.mjs";
3
+ import { a as docs, c as sponsors, i as createBtsCli, l as telemetry, n as builder, o as history, r as create, s as router, t as add } from "./run-DRzP53v3.mjs";
4
4
  import "./render-title-zvyKC1ej.mjs";
5
- import "./errors-ns_o2OKg.mjs";
6
- import "./addons-setup-uSvqHagW.mjs";
7
- import "./install-dependencies-CDjTNvIV.mjs";
8
- import "./generated-checks-CUhFFfVo.mjs";
5
+ import "./addons-setup-C_xrNtkL.mjs";
6
+ import "./config-validation-C4glouQh.mjs";
7
+ import "./compatibility-rules-D7zYNVjC.mjs";
8
+ import "./install-dependencies-DDGF-zDG.mjs";
9
+ import "./generated-checks-DUvVXWId.mjs";
9
10
  import { EMBEDDED_TEMPLATES, TEMPLATE_COUNT, VirtualFileSystem, generateVirtualProject } from "@better-fullstack/template-generator";
10
11
 
11
12
  //#region src/index.ts