stackkit 0.3.4 → 0.3.6

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 (203) hide show
  1. package/README.md +50 -42
  2. package/dist/cli/add.js +122 -56
  3. package/dist/cli/create.d.ts +2 -0
  4. package/dist/cli/create.js +271 -95
  5. package/dist/cli/doctor.js +1 -0
  6. package/dist/cli/list.d.ts +1 -1
  7. package/dist/cli/list.js +6 -4
  8. package/dist/index.js +234 -191
  9. package/dist/lib/constants.d.ts +4 -0
  10. package/dist/lib/constants.js +4 -0
  11. package/dist/lib/discovery/module-discovery.d.ts +4 -0
  12. package/dist/lib/discovery/module-discovery.js +56 -0
  13. package/dist/lib/generation/code-generator.d.ts +11 -2
  14. package/dist/lib/generation/code-generator.js +42 -3
  15. package/dist/lib/generation/generator-utils.js +3 -1
  16. package/dist/lib/pm/package-manager.js +16 -13
  17. package/dist/lib/ui/logger.js +3 -2
  18. package/dist/lib/utils/path-resolver.d.ts +2 -0
  19. package/dist/lib/utils/path-resolver.js +8 -0
  20. package/dist/meta.json +8312 -0
  21. package/modules/auth/better-auth/files/{shared → express}/config/env.ts +48 -52
  22. package/modules/auth/better-auth/files/express/middlewares/authorize.ts +20 -1
  23. package/modules/auth/better-auth/files/express/modules/auth.controller.ts +349 -0
  24. package/modules/auth/better-auth/files/express/modules/{auth/auth.route.ts → auth.route.ts} +12 -7
  25. package/modules/auth/better-auth/files/express/modules/auth.service.ts +664 -0
  26. package/modules/auth/better-auth/files/express/modules/{auth/auth.type.ts → auth.type.ts} +22 -9
  27. package/modules/auth/better-auth/files/{shared/mongoose/auth/constants.ts → express/mongo-modules/auth.constants.ts} +0 -1
  28. package/modules/auth/better-auth/files/{shared/mongoose/auth/helper.ts → express/mongo-modules/auth.helper.ts} +11 -1
  29. package/modules/auth/better-auth/files/express/types/express.d.ts +11 -0
  30. package/modules/auth/better-auth/files/nextjs/api-route.ts +74 -0
  31. package/modules/auth/better-auth/files/nextjs/dashboard/pages/(user)/page.tsx +6 -0
  32. package/modules/auth/better-auth/files/nextjs/dashboard/pages/admin/page.tsx +6 -0
  33. package/modules/auth/better-auth/files/nextjs/dashboard/pages/layout.tsx +48 -0
  34. package/modules/auth/better-auth/files/nextjs/dashboard/pages/my-profile/page.tsx +5 -0
  35. package/modules/auth/better-auth/files/nextjs/features/services/auth.service.ts +102 -0
  36. package/modules/auth/better-auth/files/nextjs/layout/layout.tsx +13 -0
  37. package/modules/auth/better-auth/files/nextjs/lib/axios/http.ts +158 -0
  38. package/modules/auth/better-auth/files/nextjs/lib/env.ts +35 -0
  39. package/modules/auth/better-auth/files/nextjs/lib/utils/auth.ts +75 -0
  40. package/modules/auth/better-auth/files/nextjs/lib/utils/cookie.ts +29 -0
  41. package/modules/auth/better-auth/files/nextjs/lib/utils/jwt.ts +28 -0
  42. package/modules/auth/better-auth/files/nextjs/lib/utils/token.ts +49 -0
  43. package/modules/auth/better-auth/files/nextjs/pages/forgot-password/page.tsx +5 -0
  44. package/modules/auth/better-auth/files/nextjs/pages/layout.tsx +11 -0
  45. package/modules/auth/better-auth/files/nextjs/pages/login/page.tsx +9 -0
  46. package/modules/auth/better-auth/files/nextjs/pages/register/page.tsx +5 -0
  47. package/modules/auth/better-auth/files/nextjs/pages/reset-password/page.tsx +10 -0
  48. package/modules/auth/better-auth/files/nextjs/pages/verify-email/page.tsx +10 -0
  49. package/modules/auth/better-auth/files/nextjs/proxy.ts +157 -22
  50. package/modules/auth/better-auth/files/nextjs/theme/providers/theme-provider.tsx +11 -0
  51. package/modules/auth/better-auth/files/nextjs/types/api.types.ts +18 -0
  52. package/modules/auth/better-auth/files/react/components/protected-route.tsx +39 -0
  53. package/modules/auth/better-auth/files/react/components/route-guards.tsx +13 -0
  54. package/modules/auth/better-auth/files/react/dashboard/admin/pages/overview.tsx +3 -0
  55. package/modules/auth/better-auth/files/react/dashboard/pages/overview.tsx +3 -0
  56. package/modules/auth/better-auth/files/react/features/pages/forgot-password.tsx +5 -0
  57. package/modules/auth/better-auth/files/react/features/pages/login.tsx +5 -0
  58. package/modules/auth/better-auth/files/react/features/pages/my-profile.tsx +5 -0
  59. package/modules/auth/better-auth/files/react/features/pages/oauth-callback.tsx +59 -0
  60. package/modules/auth/better-auth/files/react/features/pages/register.tsx +5 -0
  61. package/modules/auth/better-auth/files/react/features/pages/reset-password.tsx +10 -0
  62. package/modules/auth/better-auth/files/react/features/pages/verify-email.tsx +10 -0
  63. package/modules/auth/better-auth/files/react/layout/dashboard-layout.tsx +54 -0
  64. package/modules/auth/better-auth/files/react/lib/axios/http.ts +68 -0
  65. package/modules/auth/better-auth/files/react/lib/env.ts +25 -0
  66. package/modules/auth/better-auth/files/react/router.tsx +73 -0
  67. package/modules/auth/better-auth/files/react/theme/components/providers/theme-provider-context.ts +13 -0
  68. package/modules/auth/better-auth/files/react/theme/components/providers/theme-provider.tsx +51 -0
  69. package/modules/auth/better-auth/files/react/theme/hooks/use-theme.ts +8 -0
  70. package/modules/auth/better-auth/files/shared/features/components/change-password-dialog.tsx +113 -0
  71. package/modules/auth/better-auth/files/shared/features/components/forgot-password-form.tsx +84 -0
  72. package/modules/auth/better-auth/files/shared/features/components/login-form.tsx +134 -0
  73. package/modules/auth/better-auth/files/shared/features/components/my-profile.tsx +147 -0
  74. package/modules/auth/better-auth/files/shared/features/components/profile-form.tsx +205 -0
  75. package/modules/auth/better-auth/files/shared/features/components/register-form.tsx +100 -0
  76. package/modules/auth/better-auth/files/shared/features/components/reset-password-form.tsx +111 -0
  77. package/modules/auth/better-auth/files/shared/features/components/social-login-buttons.tsx +47 -0
  78. package/modules/auth/better-auth/files/shared/features/components/user-profile-menu.tsx +106 -0
  79. package/modules/auth/better-auth/files/shared/features/components/verify-email-form.tsx +110 -0
  80. package/modules/auth/better-auth/files/shared/features/queries/auth.mutations.tsx +312 -0
  81. package/modules/auth/better-auth/files/shared/features/queries/auth.querie.ts +19 -0
  82. package/modules/auth/better-auth/files/shared/features/services/auth.api.ts +81 -0
  83. package/modules/auth/better-auth/files/shared/features/types/auth.type.ts +47 -0
  84. package/modules/auth/better-auth/files/shared/features/validators/change-password.validator.ts +18 -0
  85. package/modules/auth/better-auth/files/shared/features/validators/forgot.validator.ts +7 -0
  86. package/modules/auth/better-auth/files/shared/features/validators/login.validator.ts +14 -0
  87. package/modules/auth/better-auth/files/shared/features/validators/profile.validator.ts +8 -0
  88. package/modules/auth/better-auth/files/shared/features/validators/register.validator.ts +9 -0
  89. package/modules/auth/better-auth/files/shared/features/validators/reset.validator.ts +9 -0
  90. package/modules/auth/better-auth/files/shared/features/validators/verify.validator.ts +8 -0
  91. package/modules/auth/better-auth/files/shared/lib/auth-client.ts +2 -1
  92. package/modules/auth/better-auth/files/shared/lib/auth.ts +10 -29
  93. package/modules/auth/better-auth/files/shared/lib/constant/dashboard.ts +90 -0
  94. package/modules/auth/better-auth/files/shared/prisma/enums.prisma +0 -1
  95. package/modules/auth/better-auth/files/shared/theme/mode-toggle.tsx +30 -0
  96. package/modules/auth/better-auth/files/shared/ui/shadcn/components/dashboard/dashboard-header.tsx +94 -0
  97. package/modules/auth/better-auth/files/shared/ui/shadcn/components/dashboard/dashboard-sidebar.tsx +255 -0
  98. package/modules/auth/better-auth/files/shared/ui/shadcn/components/footer.tsx +35 -0
  99. package/modules/auth/better-auth/files/shared/ui/shadcn/components/navbar.tsx +145 -0
  100. package/modules/auth/better-auth/files/shared/ui/shadcn/form-field/input-field.tsx +440 -0
  101. package/modules/auth/better-auth/files/shared/utils/email.ts +20 -18
  102. package/modules/auth/better-auth/generator.json +174 -53
  103. package/modules/auth/better-auth/module.json +2 -2
  104. package/modules/components/files/shared/hooks/use-file-upload.ts +412 -0
  105. package/modules/components/files/shared/lib/utils/url-helpers.ts +110 -0
  106. package/modules/components/files/shared/shadcn/dashboard/data-table-column-selector.tsx +52 -0
  107. package/modules/components/files/shared/shadcn/dashboard/data-table-footer.tsx +156 -0
  108. package/modules/components/files/shared/shadcn/dashboard/data-table.tsx +405 -0
  109. package/modules/components/files/shared/shadcn/global/form-field/input-field.tsx +440 -0
  110. package/modules/components/files/shared/shadcn/global/form-field/media-uploader-field.tsx +745 -0
  111. package/modules/components/files/shared/shadcn/global/form-field/multi-select-field.tsx +207 -0
  112. package/modules/components/files/shared/shadcn/global/form-field/select-field.tsx +247 -0
  113. package/modules/components/files/shared/shadcn/global/form-field/textarea-field.tsx +277 -0
  114. package/modules/components/files/shared/shadcn/global/form-field/tiptap-editor-field.tsx +35 -0
  115. package/modules/components/files/shared/shadcn/global/no-results.tsx +41 -0
  116. package/modules/components/files/shared/shadcn/tiptap-editor/editor-menu-bar.tsx +217 -0
  117. package/modules/components/files/shared/shadcn/tiptap-editor/tiptap-editor.tsx +104 -0
  118. package/modules/components/files/shared/url/load-more.tsx +93 -0
  119. package/modules/components/files/shared/url/search-bar.tsx +131 -0
  120. package/modules/components/files/shared/url/sort-select.tsx +118 -0
  121. package/modules/components/files/shared/url/url-tabs.tsx +77 -0
  122. package/modules/components/generator.json +109 -0
  123. package/modules/components/module.json +11 -0
  124. package/modules/database/mongoose/generator.json +3 -14
  125. package/modules/database/mongoose/module.json +2 -2
  126. package/modules/database/prisma/generator.json +6 -12
  127. package/modules/database/prisma/module.json +2 -2
  128. package/modules/storage/cloudinary/files/express/config/env.ts +65 -0
  129. package/modules/storage/cloudinary/files/express/config/media.ts +103 -0
  130. package/modules/storage/cloudinary/files/express/modules/media/media.controller.ts +59 -0
  131. package/modules/storage/cloudinary/files/express/modules/media/media.route.ts +29 -0
  132. package/modules/storage/cloudinary/files/express/modules/media/media.service.ts +113 -0
  133. package/modules/storage/cloudinary/files/express/modules/media/media.type.ts +32 -0
  134. package/modules/storage/cloudinary/generator.json +34 -0
  135. package/modules/storage/cloudinary/module.json +11 -0
  136. package/modules/ui/shadcn/generator.json +21 -0
  137. package/modules/ui/shadcn/module.json +11 -0
  138. package/package.json +24 -26
  139. package/templates/express/README.md +11 -16
  140. package/templates/express/src/config/env.ts +7 -5
  141. package/templates/nextjs/README.md +13 -18
  142. package/templates/nextjs/app/favicon.ico +0 -0
  143. package/templates/nextjs/app/layout.tsx +6 -4
  144. package/templates/nextjs/components/providers/query-provider.tsx +3 -0
  145. package/templates/nextjs/env.example +3 -1
  146. package/templates/nextjs/lib/axios/http.ts +23 -0
  147. package/templates/nextjs/lib/env.ts +7 -5
  148. package/templates/nextjs/package.json +2 -1
  149. package/templates/nextjs/template.json +1 -2
  150. package/templates/react/README.md +9 -14
  151. package/templates/react/index.html +1 -1
  152. package/templates/react/package.json +1 -1
  153. package/templates/react/src/assets/favicon.ico +0 -0
  154. package/templates/react/src/components/providers/query-provider.tsx +38 -0
  155. package/templates/react/src/{shared/components → components}/seo.tsx +4 -8
  156. package/templates/react/src/lib/axios/http.ts +24 -0
  157. package/templates/react/src/main.tsx +8 -11
  158. package/templates/react/src/{features/about/pages → pages}/about.tsx +1 -1
  159. package/templates/react/src/{features/home/pages → pages}/home.tsx +1 -1
  160. package/templates/react/src/router.tsx +6 -6
  161. package/templates/react/src/vite-env.d.ts +2 -1
  162. package/templates/react/template.json +0 -1
  163. package/templates/react/tsconfig.app.json +6 -0
  164. package/templates/react/tsconfig.json +7 -1
  165. package/templates/react/vite.config.ts +12 -0
  166. package/modules/auth/authjs/files/nextjs/api/auth/[...nextauth]/route.ts +0 -3
  167. package/modules/auth/authjs/files/nextjs/proxy.ts +0 -1
  168. package/modules/auth/authjs/files/shared/lib/auth.ts +0 -119
  169. package/modules/auth/authjs/files/shared/prisma/schema.prisma +0 -61
  170. package/modules/auth/authjs/generator.json +0 -64
  171. package/modules/auth/authjs/module.json +0 -13
  172. package/modules/auth/better-auth/files/express/modules/auth/auth.controller.ts +0 -264
  173. package/modules/auth/better-auth/files/express/modules/auth/auth.service.ts +0 -537
  174. package/modules/auth/better-auth/files/express/templates/google-redirect.ejs +0 -24
  175. package/modules/auth/better-auth/files/nextjs/api/auth/[...all]/route.ts +0 -4
  176. package/modules/auth/better-auth/files/nextjs/lib/auth/auth-guards.ts +0 -41
  177. package/modules/auth/better-auth/files/nextjs/templates/email-otp.tsx +0 -74
  178. package/templates/express/node_modules/.bin/acorn +0 -17
  179. package/templates/express/node_modules/.bin/eslint +0 -17
  180. package/templates/express/node_modules/.bin/tsc +0 -17
  181. package/templates/express/node_modules/.bin/tsserver +0 -17
  182. package/templates/express/node_modules/.bin/tsx +0 -17
  183. package/templates/nextjs/lib/api/http.ts +0 -40
  184. package/templates/nextjs/next-env.d.ts +0 -6
  185. package/templates/react/dist/assets/index-D4AHT4dU.js +0 -193
  186. package/templates/react/dist/assets/index-rpwj5ZOX.css +0 -1
  187. package/templates/react/dist/index.html +0 -14
  188. package/templates/react/dist/vite.svg +0 -1
  189. package/templates/react/public/vite.svg +0 -1
  190. package/templates/react/src/app/layouts/dashboard-layout.tsx +0 -8
  191. package/templates/react/src/app/layouts/public-layout.tsx +0 -5
  192. package/templates/react/src/app/providers.tsx +0 -20
  193. package/templates/react/src/app/router.tsx +0 -21
  194. package/templates/react/src/assets/react.svg +0 -1
  195. package/templates/react/src/shared/api/http.ts +0 -39
  196. package/templates/react/src/shared/components/loading.tsx +0 -8
  197. package/templates/react/src/shared/lib/query-client.ts +0 -12
  198. package/templates/react/src/utils/storage.ts +0 -35
  199. package/templates/react/src/utils/utils.ts +0 -3
  200. /package/templates/nextjs/app/{page.tsx → (public)/(root)/page.tsx} +0 -0
  201. /package/templates/react/src/{shared/components → components}/error-boundary.tsx +0 -0
  202. /package/templates/react/src/{shared/components → components}/layout.tsx +0 -0
  203. /package/templates/react/src/{shared/pages → pages}/not-found.tsx +0 -0
@@ -31,6 +31,8 @@ export declare const MODULE_CATEGORIES: {
31
31
  DATABASE: "database";
32
32
  AUTH: "auth";
33
33
  FRAMEWORK: "framework";
34
+ UI: "ui";
35
+ STORAGE: "storage";
34
36
  };
35
37
  export declare const DIRECTORY_NAMES: {
36
38
  readonly MODULES: "modules";
@@ -80,6 +82,8 @@ export declare const DISPLAY_NAMES: {
80
82
  readonly database: "Database";
81
83
  readonly auth: "Auth";
82
84
  readonly framework: "Framework";
85
+ readonly ui: "UI";
86
+ readonly storage: "Storage";
83
87
  };
84
88
  export declare const ERROR_MESSAGES: {
85
89
  readonly NO_PACKAGE_JSON: "No package.json found in current directory or any parent directory.";
@@ -27,6 +27,8 @@ exports.MODULE_CATEGORIES = {
27
27
  DATABASE: "database",
28
28
  AUTH: "auth",
29
29
  FRAMEWORK: "framework",
30
+ UI: "ui",
31
+ STORAGE: "storage",
30
32
  };
31
33
  exports.DIRECTORY_NAMES = {
32
34
  MODULES: "modules",
@@ -81,6 +83,8 @@ exports.DISPLAY_NAMES = {
81
83
  [exports.MODULE_CATEGORIES.DATABASE]: "Database",
82
84
  [exports.MODULE_CATEGORIES.AUTH]: "Auth",
83
85
  [exports.MODULE_CATEGORIES.FRAMEWORK]: "Framework",
86
+ [exports.MODULE_CATEGORIES.UI]: "UI",
87
+ [exports.MODULE_CATEGORIES.STORAGE]: "Storage",
84
88
  };
85
89
  exports.ERROR_MESSAGES = {
86
90
  NO_PACKAGE_JSON: "No package.json found in current directory or any parent directory.",
@@ -25,6 +25,9 @@ export interface DiscoveredModules {
25
25
  frameworks: ModuleMetadata[];
26
26
  databases: ModuleMetadata[];
27
27
  auth: ModuleMetadata[];
28
+ ui?: ModuleMetadata[];
29
+ storage?: ModuleMetadata[];
30
+ components?: ModuleMetadata[];
28
31
  }
29
32
  export declare function discoverModules(modulesDir: string): Promise<DiscoveredModules>;
30
33
  export declare function getValidDatabaseOptions(databases: ModuleMetadata[]): string[];
@@ -32,6 +35,7 @@ export declare function getValidAuthOptions(authModules: ModuleMetadata[]): stri
32
35
  export declare function getCompatibleAuthOptions(authModules: ModuleMetadata[], framework: string, database: string, frameworksMeta?: ModuleMetadata[]): Array<{
33
36
  name: string;
34
37
  value: string;
38
+ description?: string;
35
39
  }>;
36
40
  export declare function getDatabaseChoices(databases: ModuleMetadata[], framework: string): Array<{
37
41
  name: string;
@@ -100,6 +100,61 @@ async function discoverModules(modulesDir) {
100
100
  }
101
101
  }
102
102
  }
103
+ // discover UI modules (modules/ui)
104
+ const uiDir = path_1.default.join(modulesDir, "ui");
105
+ if (await fs_extra_1.default.pathExists(uiDir)) {
106
+ discovered.ui = [];
107
+ const uiModules = await fs_extra_1.default.readdir(uiDir);
108
+ for (const moduleName of uiModules) {
109
+ const modulePath = path_1.default.join(uiDir, moduleName);
110
+ const moduleJsonPath = path_1.default.join(modulePath, "module.json");
111
+ if (await fs_extra_1.default.pathExists(moduleJsonPath)) {
112
+ const metadata = await readJsonSafe(moduleJsonPath);
113
+ if (metadata) {
114
+ if (!metadata.name)
115
+ metadata.name = moduleName;
116
+ if (!metadata.displayName)
117
+ metadata.displayName = moduleName;
118
+ discovered.ui.push(metadata);
119
+ }
120
+ }
121
+ }
122
+ }
123
+ // discover storage/provider modules (modules/storage)
124
+ const storageDir = path_1.default.join(modulesDir, "storage");
125
+ if (await fs_extra_1.default.pathExists(storageDir)) {
126
+ discovered.storage = [];
127
+ const storageModules = await fs_extra_1.default.readdir(storageDir);
128
+ for (const moduleName of storageModules) {
129
+ const modulePath = path_1.default.join(storageDir, moduleName);
130
+ const moduleJsonPath = path_1.default.join(modulePath, "module.json");
131
+ if (await fs_extra_1.default.pathExists(moduleJsonPath)) {
132
+ const metadata = await readJsonSafe(moduleJsonPath);
133
+ if (metadata) {
134
+ if (!metadata.name)
135
+ metadata.name = moduleName;
136
+ if (!metadata.displayName)
137
+ metadata.displayName = moduleName;
138
+ discovered.storage.push(metadata);
139
+ }
140
+ }
141
+ }
142
+ }
143
+ // discover frontend components module (flat: modules/components/module.json)
144
+ const componentsDir = path_1.default.join(modulesDir, "components");
145
+ if (await fs_extra_1.default.pathExists(componentsDir)) {
146
+ const moduleJsonPath = path_1.default.join(componentsDir, "module.json");
147
+ if (await fs_extra_1.default.pathExists(moduleJsonPath)) {
148
+ const metadata = await readJsonSafe(moduleJsonPath);
149
+ if (metadata) {
150
+ if (!metadata.name)
151
+ metadata.name = "components";
152
+ if (!metadata.displayName)
153
+ metadata.displayName = "Components";
154
+ discovered.components = [metadata];
155
+ }
156
+ }
157
+ }
103
158
  return discovered;
104
159
  }
105
160
  function getValidDatabaseOptions(databases) {
@@ -154,6 +209,7 @@ function getCompatibleAuthOptions(authModules, framework, database, frameworksMe
154
209
  compatible.push({
155
210
  name: auth.displayName,
156
211
  value: auth.name,
212
+ description: auth.description || "",
157
213
  });
158
214
  }
159
215
  compatible.push({ name: "None", value: "none" });
@@ -6,6 +6,10 @@ export interface GenerationContext {
6
6
  features?: string[];
7
7
  combo?: string;
8
8
  prismaProvider?: string;
9
+ packageManager?: string;
10
+ ui?: string;
11
+ storageProvider?: string;
12
+ components?: boolean;
9
13
  [key: string]: unknown;
10
14
  }
11
15
  export interface TemplateCondition {
@@ -19,6 +23,10 @@ type SelectedModules = {
19
23
  database?: string;
20
24
  auth?: string;
21
25
  prismaProvider?: string;
26
+ ui?: string;
27
+ storageProvider?: string;
28
+ packageManager?: string;
29
+ components?: boolean;
22
30
  };
23
31
  export interface Operation {
24
32
  type: "create-file" | "patch-file" | "add-dependency" | "add-script" | "add-env" | "run-command";
@@ -48,7 +56,7 @@ export interface PatchOperation {
48
56
  }
49
57
  export interface GeneratorConfig {
50
58
  name: string;
51
- type: "framework" | "database" | "auth";
59
+ type: "framework" | "database" | "auth" | "ui" | "storage" | "components";
52
60
  priority: number;
53
61
  operations?: Operation[];
54
62
  dependencies?: Record<string, string>;
@@ -90,7 +98,8 @@ export declare class AdvancedCodeGenerator {
90
98
  frameworks: string[];
91
99
  databases: string[];
92
100
  auths: string[];
101
+ components: string[];
93
102
  };
94
- registerGenerator(type: "framework" | "database" | "auth", name: string, config: GeneratorConfig): void;
103
+ registerGenerator(type: "framework" | "database" | "auth" | "ui" | "storage" | "components", name: string, config: GeneratorConfig): void;
95
104
  }
96
105
  export {};
@@ -63,13 +63,29 @@ class AdvancedCodeGenerator {
63
63
  isGeneratorSelected(genType, name, selectedModules) {
64
64
  return ((genType === "framework" && name === selectedModules.framework) ||
65
65
  (genType === "database" && name === selectedModules.database) ||
66
- (genType === "auth" && name === selectedModules.auth));
66
+ (genType === "auth" && name === selectedModules.auth) ||
67
+ (genType === "ui" && name === selectedModules.ui) ||
68
+ (genType === "storage" && name === selectedModules.storageProvider) ||
69
+ (genType === "components" && selectedModules.components === true));
67
70
  }
68
71
  async loadGenerators(modulesPath) {
69
- const moduleTypes = ["auth", "database"];
72
+ const moduleTypes = ["auth", "database", "ui", "storage", "components"];
70
73
  for (const type of moduleTypes) {
71
74
  const typePath = path.join(modulesPath, type);
72
75
  if (await fs.pathExists(typePath)) {
76
+ // Check for flat module (generator.json at type root, e.g. modules/components/generator.json)
77
+ const flatGeneratorPath = path.join(typePath, "generator.json");
78
+ if (await fs.pathExists(flatGeneratorPath)) {
79
+ try {
80
+ const config = await fs.readJson(flatGeneratorPath);
81
+ await (0, generator_utils_1.mergeModuleIntoGeneratorConfig)(config, typePath);
82
+ this.generators.set(`${type}:${type}`, config);
83
+ }
84
+ catch {
85
+ // skip
86
+ }
87
+ continue; // skip subdir scanning for this type
88
+ }
73
89
  const modules = await fs.readdir(typePath);
74
90
  for (const moduleName of modules) {
75
91
  const generatorPath = path.join(typePath, moduleName, "generator.json");
@@ -218,6 +234,25 @@ class AdvancedCodeGenerator {
218
234
  .replace(/^\n+/, "")
219
235
  .replace(/\n+$/, "");
220
236
  }
237
+ const rawCond = condition.trim();
238
+ if (rawCond) {
239
+ if (rawCond.startsWith("!")) {
240
+ const varName = rawCond.slice(1).trim().replace(/['"]/g, "");
241
+ const val = context[varName];
242
+ const isTruthy = !!val && !(Array.isArray(val) && val.length === 0);
243
+ const contentToProcess = !isTruthy ? blockContent : elseContent || "";
244
+ return this.processTemplateRecursive(contentToProcess, context)
245
+ .replace(/^\n+/, "")
246
+ .replace(/\n+$/, "");
247
+ }
248
+ const varNameSimple = rawCond.replace(/['"]/g, "");
249
+ const val = context[varNameSimple];
250
+ const isTruthy = !!val && !(Array.isArray(val) && val.length === 0);
251
+ const contentToProcess = isTruthy ? blockContent : elseContent || "";
252
+ return this.processTemplateRecursive(contentToProcess, context)
253
+ .replace(/^\n+/, "")
254
+ .replace(/\n+$/, "");
255
+ }
221
256
  return "";
222
257
  });
223
258
  content = content.replace(/\{\{#switch\s+([^}]+)\}\}([\s\S]*?)\{\{\/switch\}\}/g, (match, varName, switchContent) => {
@@ -905,6 +940,7 @@ class AdvancedCodeGenerator {
905
940
  const frameworks = [];
906
941
  const databases = [];
907
942
  const auths = [];
943
+ const components = [];
908
944
  for (const [key] of this.generators) {
909
945
  const [type, name] = key.split(":");
910
946
  switch (type) {
@@ -917,9 +953,12 @@ class AdvancedCodeGenerator {
917
953
  case "auth":
918
954
  auths.push(name);
919
955
  break;
956
+ case "components":
957
+ components.push(name);
958
+ break;
920
959
  }
921
960
  }
922
- return { frameworks, databases, auths };
961
+ return { frameworks, databases, auths, components };
923
962
  }
924
963
  registerGenerator(type, name, config) {
925
964
  this.generators.set(`${type}:${name}`, config);
@@ -122,7 +122,9 @@ function locateOperationSource(generatorType, generatorName, sourceRel) {
122
122
  const templatesPath = path.join(packageRoot, "templates");
123
123
  const moduleBasePath = generatorType === "framework"
124
124
  ? path.join(templatesPath, generatorName)
125
- : path.join(modulesPath, generatorType, generatorName);
125
+ : generatorType === generatorName
126
+ ? path.join(modulesPath, generatorType)
127
+ : path.join(modulesPath, generatorType, generatorName);
126
128
  return path.join(moduleBasePath, "files", sourceRel);
127
129
  }
128
130
  exports.default = {
@@ -32,16 +32,13 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
36
  exports.detectPackageManager = detectPackageManager;
40
37
  exports.installDependencies = installDependencies;
41
38
  exports.addDependencies = addDependencies;
42
39
  exports.initGit = initGit;
43
40
  const detect_package_manager_1 = require("detect-package-manager");
44
- const execa_1 = __importDefault(require("execa"));
41
+ const execa_1 = require("execa");
45
42
  const fs = __importStar(require("fs-extra"));
46
43
  const path = __importStar(require("path"));
47
44
  const constants_1 = require("../constants");
@@ -77,7 +74,7 @@ async function installDependencies(cwd, pm, maxRetries = 2) {
77
74
  let lastError = null;
78
75
  async function isAvailable(pmCheck) {
79
76
  try {
80
- await (0, execa_1.default)(pmCheck, ["--version"], { cwd, stdio: "pipe", timeout: 2000 });
77
+ await (0, execa_1.execa)(pmCheck, ["--version"], { cwd, stdio: "pipe", timeout: 2000 });
81
78
  return true;
82
79
  }
83
80
  catch {
@@ -100,7 +97,7 @@ async function installDependencies(cwd, pm, maxRetries = 2) {
100
97
  logger_1.logger.debug(`Retry attempt ${attempt} for ${pmCandidate}`);
101
98
  await new Promise((resolve) => setTimeout(resolve, constants_1.TIMEOUTS.RETRY_DELAY_BASE * attempt));
102
99
  }
103
- await (0, execa_1.default)(pmCandidate, args, { cwd, stdio, timeout: packageInstallTimeout });
100
+ await (0, execa_1.execa)(pmCandidate, args, { cwd, stdio, timeout: packageInstallTimeout });
104
101
  succeeded = true;
105
102
  break;
106
103
  }
@@ -153,7 +150,7 @@ async function addDependencies(cwd, pm, packages, dev = false) {
153
150
  throw new Error(`Unsupported package manager: ${pm}`);
154
151
  }
155
152
  logger_1.logger.debug(`Running: ${pm} ${args.join(" ")}`);
156
- await (0, execa_1.default)(pm, args, { cwd, stdio, timeout: constants_1.TIMEOUTS.PACKAGE_INSTALL });
153
+ await (0, execa_1.execa)(pm, args, { cwd, stdio, timeout: constants_1.TIMEOUTS.PACKAGE_INSTALL });
157
154
  spinner.succeed(`Dependencies added successfully`);
158
155
  }
159
156
  catch (error) {
@@ -179,7 +176,7 @@ function isValidPackageName(packageName) {
179
176
  async function initGit(cwd) {
180
177
  const spinner = logger_1.logger.startSpinner("Initializing git repository...");
181
178
  try {
182
- await (0, execa_1.default)("git", ["--version"], { cwd, stdio: "pipe" });
179
+ await (0, execa_1.execa)("git", ["--version"], { cwd, stdio: "pipe" });
183
180
  }
184
181
  catch {
185
182
  spinner.fail("Git is not installed");
@@ -196,12 +193,18 @@ async function initGit(cwd) {
196
193
  return;
197
194
  }
198
195
  const run = async (stdio) => {
199
- await (0, execa_1.default)("git", ["init"], { cwd, stdio });
200
- await (0, execa_1.default)("git", ["add", "."], { cwd, stdio });
196
+ await (0, execa_1.execa)("git", ["init"], { cwd, stdio });
201
197
  try {
202
- await (0, execa_1.default)("git", ["config", "user.name"], { cwd, stdio: "pipe" });
203
- await (0, execa_1.default)("git", ["config", "user.email"], { cwd, stdio: "pipe" });
204
- await (0, execa_1.default)("git", ["commit", "-m", "Initial commit from StackKit"], { cwd, stdio });
198
+ await (0, execa_1.execa)("git", ["branch", "-M", "main"], { cwd, stdio });
199
+ }
200
+ catch {
201
+ // Ignore if branch rename fails (older git versions)
202
+ }
203
+ await (0, execa_1.execa)("git", ["add", "."], { cwd, stdio });
204
+ try {
205
+ await (0, execa_1.execa)("git", ["config", "user.name"], { cwd, stdio: "pipe" });
206
+ await (0, execa_1.execa)("git", ["config", "user.email"], { cwd, stdio: "pipe" });
207
+ await (0, execa_1.execa)("git", ["commit", "-m", "Initial commit from StackKit"], { cwd, stdio });
205
208
  }
206
209
  catch {
207
210
  logger_1.logger.debug("Git config not found, skipping initial commit");
@@ -30,8 +30,9 @@ class Logger {
30
30
  }
31
31
  error(message, error) {
32
32
  process.stderr.write(chalk_1.default.red("✖") + " " + message + "\n");
33
- if (error && this.debugMode) {
34
- this.debug(`Error stack: ${error.stack || error.message}`);
33
+ if (error) {
34
+ const stack = error.stack || error.message;
35
+ process.stderr.write(chalk_1.default.gray("[STACK]") + " " + stack + "\n");
35
36
  }
36
37
  }
37
38
  warn(message) {
@@ -7,3 +7,5 @@ export declare function getModuleFilesPath(category: string, moduleName: string)
7
7
  export declare function getTemplateJsonPath(frameworkName: string): string;
8
8
  export declare function getDatabaseModulesPath(): string;
9
9
  export declare function getAuthModulesPath(): string;
10
+ export declare function getUiModulesPath(): string;
11
+ export declare function getStorageModulesPath(): string;
@@ -12,6 +12,8 @@ exports.getModuleFilesPath = getModuleFilesPath;
12
12
  exports.getTemplateJsonPath = getTemplateJsonPath;
13
13
  exports.getDatabaseModulesPath = getDatabaseModulesPath;
14
14
  exports.getAuthModulesPath = getAuthModulesPath;
15
+ exports.getUiModulesPath = getUiModulesPath;
16
+ exports.getStorageModulesPath = getStorageModulesPath;
15
17
  const path_1 = __importDefault(require("path"));
16
18
  const constants_1 = require("../constants");
17
19
  const package_root_1 = require("./package-root");
@@ -42,3 +44,9 @@ function getDatabaseModulesPath() {
42
44
  function getAuthModulesPath() {
43
45
  return path_1.default.join(getModulesPath(), constants_1.MODULE_CATEGORIES.AUTH);
44
46
  }
47
+ function getUiModulesPath() {
48
+ return path_1.default.join(getModulesPath(), constants_1.MODULE_CATEGORIES.UI);
49
+ }
50
+ function getStorageModulesPath() {
51
+ return path_1.default.join(getModulesPath(), constants_1.MODULE_CATEGORIES.STORAGE);
52
+ }