@betterstart/cli 0.1.3 → 0.1.4

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 (234) hide show
  1. package/README.md +133 -0
  2. package/dist/cli.d.ts +1 -9
  3. package/dist/cli.js +13484 -367
  4. package/dist/cli.js.map +1 -1
  5. package/dist/index.d.ts +24 -266
  6. package/dist/index.js +4 -11378
  7. package/dist/index.js.map +1 -1
  8. package/package.json +29 -42
  9. package/templates/schema.json +959 -0
  10. package/templates/tiptap/hooks/use-composed-ref.ts +43 -0
  11. package/templates/tiptap/hooks/use-cursor-visibility.ts +68 -0
  12. package/templates/tiptap/hooks/use-element-rect.ts +166 -0
  13. package/templates/tiptap/hooks/use-is-breakpoint.ts +32 -0
  14. package/templates/tiptap/hooks/use-menu-navigation.ts +182 -0
  15. package/templates/tiptap/hooks/use-scrolling.ts +64 -0
  16. package/templates/tiptap/hooks/use-throttled-callback.ts +146 -0
  17. package/templates/tiptap/hooks/use-tiptap-editor.ts +46 -0
  18. package/templates/tiptap/hooks/use-unmount.ts +21 -0
  19. package/templates/tiptap/hooks/use-window-size.ts +87 -0
  20. package/templates/tiptap/lib/tiptap-utils.ts +587 -0
  21. package/templates/tiptap/styles/_keyframe-animations.scss +91 -0
  22. package/templates/tiptap/styles/_variables.scss +296 -0
  23. package/templates/tiptap/tiptap-extension/node-background-extension.ts +138 -0
  24. package/templates/tiptap/tiptap-icons/align-center-icon.tsx +38 -0
  25. package/templates/tiptap/tiptap-icons/align-justify-icon.tsx +38 -0
  26. package/templates/tiptap/tiptap-icons/align-left-icon.tsx +38 -0
  27. package/templates/tiptap/tiptap-icons/align-right-icon.tsx +38 -0
  28. package/templates/tiptap/tiptap-icons/arrow-left-icon.tsx +24 -0
  29. package/templates/tiptap/tiptap-icons/ban-icon.tsx +26 -0
  30. package/templates/tiptap/tiptap-icons/blockquote-icon.tsx +44 -0
  31. package/templates/tiptap/tiptap-icons/bold-icon.tsx +26 -0
  32. package/templates/tiptap/tiptap-icons/chevron-down-icon.tsx +26 -0
  33. package/templates/tiptap/tiptap-icons/close-icon.tsx +24 -0
  34. package/templates/tiptap/tiptap-icons/code-block-icon.tsx +38 -0
  35. package/templates/tiptap/tiptap-icons/code2-icon.tsx +32 -0
  36. package/templates/tiptap/tiptap-icons/corner-down-left-icon.tsx +26 -0
  37. package/templates/tiptap/tiptap-icons/external-link-icon.tsx +28 -0
  38. package/templates/tiptap/tiptap-icons/heading-five-icon.tsx +28 -0
  39. package/templates/tiptap/tiptap-icons/heading-four-icon.tsx +28 -0
  40. package/templates/tiptap/tiptap-icons/heading-icon.tsx +24 -0
  41. package/templates/tiptap/tiptap-icons/heading-one-icon.tsx +28 -0
  42. package/templates/tiptap/tiptap-icons/heading-six-icon.tsx +30 -0
  43. package/templates/tiptap/tiptap-icons/heading-three-icon.tsx +36 -0
  44. package/templates/tiptap/tiptap-icons/heading-two-icon.tsx +28 -0
  45. package/templates/tiptap/tiptap-icons/highlighter-icon.tsx +26 -0
  46. package/templates/tiptap/tiptap-icons/image-plus-icon.tsx +26 -0
  47. package/templates/tiptap/tiptap-icons/italic-icon.tsx +24 -0
  48. package/templates/tiptap/tiptap-icons/link-icon.tsx +28 -0
  49. package/templates/tiptap/tiptap-icons/list-icon.tsx +56 -0
  50. package/templates/tiptap/tiptap-icons/list-ordered-icon.tsx +56 -0
  51. package/templates/tiptap/tiptap-icons/list-todo-icon.tsx +50 -0
  52. package/templates/tiptap/tiptap-icons/moon-star-icon.tsx +30 -0
  53. package/templates/tiptap/tiptap-icons/redo2-icon.tsx +26 -0
  54. package/templates/tiptap/tiptap-icons/strike-icon.tsx +28 -0
  55. package/templates/tiptap/tiptap-icons/subscript-icon.tsx +38 -0
  56. package/templates/tiptap/tiptap-icons/sun-icon.tsx +58 -0
  57. package/templates/tiptap/tiptap-icons/superscript-icon.tsx +38 -0
  58. package/templates/tiptap/tiptap-icons/trash-icon.tsx +26 -0
  59. package/templates/tiptap/tiptap-icons/underline-icon.tsx +26 -0
  60. package/templates/tiptap/tiptap-icons/undo2-icon.tsx +26 -0
  61. package/templates/tiptap/tiptap-node/blockquote-node/blockquote-node.scss +37 -0
  62. package/templates/tiptap/tiptap-node/code-block-node/code-block-node.scss +54 -0
  63. package/templates/tiptap/tiptap-node/heading-node/heading-node.scss +45 -0
  64. package/templates/tiptap/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.ts +10 -0
  65. package/templates/tiptap/tiptap-node/horizontal-rule-node/horizontal-rule-node.scss +25 -0
  66. package/templates/tiptap/tiptap-node/image-node/image-node.scss +35 -0
  67. package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node-extension.ts +154 -0
  68. package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node.scss +249 -0
  69. package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node.tsx +522 -0
  70. package/templates/tiptap/tiptap-node/image-upload-node/index.tsx +1 -0
  71. package/templates/tiptap/tiptap-node/list-node/list-node.scss +208 -0
  72. package/templates/tiptap/tiptap-node/paragraph-node/paragraph-node.scss +273 -0
  73. package/templates/tiptap/tiptap-ui/blockquote-button/blockquote-button.tsx +104 -0
  74. package/templates/tiptap/tiptap-ui/blockquote-button/index.tsx +2 -0
  75. package/templates/tiptap/tiptap-ui/blockquote-button/use-blockquote.ts +252 -0
  76. package/templates/tiptap/tiptap-ui/code-block-button/code-block-button.tsx +106 -0
  77. package/templates/tiptap/tiptap-ui/code-block-button/index.tsx +2 -0
  78. package/templates/tiptap/tiptap-ui/code-block-button/use-code-block.ts +261 -0
  79. package/templates/tiptap/tiptap-ui/color-highlight-button/color-highlight-button.scss +49 -0
  80. package/templates/tiptap/tiptap-ui/color-highlight-button/color-highlight-button.tsx +153 -0
  81. package/templates/tiptap/tiptap-ui/color-highlight-button/index.tsx +2 -0
  82. package/templates/tiptap/tiptap-ui/color-highlight-button/use-color-highlight.ts +345 -0
  83. package/templates/tiptap/tiptap-ui/color-highlight-popover/color-highlight-popover.tsx +207 -0
  84. package/templates/tiptap/tiptap-ui/color-highlight-popover/index.tsx +1 -0
  85. package/templates/tiptap/tiptap-ui/heading-button/heading-button.tsx +107 -0
  86. package/templates/tiptap/tiptap-ui/heading-button/index.tsx +2 -0
  87. package/templates/tiptap/tiptap-ui/heading-button/use-heading.ts +314 -0
  88. package/templates/tiptap/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.tsx +131 -0
  89. package/templates/tiptap/tiptap-ui/heading-dropdown-menu/index.tsx +2 -0
  90. package/templates/tiptap/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.ts +130 -0
  91. package/templates/tiptap/tiptap-ui/image-upload-button/image-upload-button.tsx +114 -0
  92. package/templates/tiptap/tiptap-ui/image-upload-button/index.tsx +2 -0
  93. package/templates/tiptap/tiptap-ui/image-upload-button/use-image-upload.ts +192 -0
  94. package/templates/tiptap/tiptap-ui/link-popover/index.tsx +2 -0
  95. package/templates/tiptap/tiptap-ui/link-popover/link-popover.tsx +285 -0
  96. package/templates/tiptap/tiptap-ui/link-popover/use-link-popover.ts +286 -0
  97. package/templates/tiptap/tiptap-ui/list-button/index.tsx +2 -0
  98. package/templates/tiptap/tiptap-ui/list-button/list-button.tsx +108 -0
  99. package/templates/tiptap/tiptap-ui/list-button/use-list.ts +329 -0
  100. package/templates/tiptap/tiptap-ui/list-dropdown-menu/index.tsx +1 -0
  101. package/templates/tiptap/tiptap-ui/list-dropdown-menu/list-dropdown-menu.tsx +123 -0
  102. package/templates/tiptap/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.ts +203 -0
  103. package/templates/tiptap/tiptap-ui/mark-button/index.tsx +2 -0
  104. package/templates/tiptap/tiptap-ui/mark-button/mark-button.tsx +107 -0
  105. package/templates/tiptap/tiptap-ui/mark-button/use-mark.ts +206 -0
  106. package/templates/tiptap/tiptap-ui/text-align-button/index.tsx +2 -0
  107. package/templates/tiptap/tiptap-ui/text-align-button/text-align-button.tsx +118 -0
  108. package/templates/tiptap/tiptap-ui/text-align-button/use-text-align.ts +212 -0
  109. package/templates/tiptap/tiptap-ui/undo-redo-button/index.tsx +2 -0
  110. package/templates/tiptap/tiptap-ui/undo-redo-button/undo-redo-button.tsx +105 -0
  111. package/templates/tiptap/tiptap-ui/undo-redo-button/use-undo-redo.ts +173 -0
  112. package/templates/tiptap/tiptap-ui-primitive/badge/badge-colors.scss +395 -0
  113. package/templates/tiptap/tiptap-ui-primitive/badge/badge-group.scss +16 -0
  114. package/templates/tiptap/tiptap-ui-primitive/badge/badge.scss +99 -0
  115. package/templates/tiptap/tiptap-ui-primitive/badge/badge.tsx +46 -0
  116. package/templates/tiptap/tiptap-ui-primitive/badge/index.tsx +1 -0
  117. package/templates/tiptap/tiptap-ui-primitive/button/button-colors.scss +429 -0
  118. package/templates/tiptap/tiptap-ui-primitive/button/button-group.scss +22 -0
  119. package/templates/tiptap/tiptap-ui-primitive/button/button.scss +314 -0
  120. package/templates/tiptap/tiptap-ui-primitive/button/button.tsx +102 -0
  121. package/templates/tiptap/tiptap-ui-primitive/button/index.tsx +1 -0
  122. package/templates/tiptap/tiptap-ui-primitive/card/card.scss +77 -0
  123. package/templates/tiptap/tiptap-ui-primitive/card/card.tsx +59 -0
  124. package/templates/tiptap/tiptap-ui-primitive/card/index.tsx +1 -0
  125. package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/dropdown-menu.scss +63 -0
  126. package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/dropdown-menu.tsx +95 -0
  127. package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/index.tsx +1 -0
  128. package/templates/tiptap/tiptap-ui-primitive/input/index.tsx +1 -0
  129. package/templates/tiptap/tiptap-ui-primitive/input/input.scss +45 -0
  130. package/templates/tiptap/tiptap-ui-primitive/input/input.tsx +18 -0
  131. package/templates/tiptap/tiptap-ui-primitive/popover/index.tsx +1 -0
  132. package/templates/tiptap/tiptap-ui-primitive/popover/popover.scss +63 -0
  133. package/templates/tiptap/tiptap-ui-primitive/popover/popover.tsx +33 -0
  134. package/templates/tiptap/tiptap-ui-primitive/separator/index.tsx +1 -0
  135. package/templates/tiptap/tiptap-ui-primitive/separator/separator.scss +23 -0
  136. package/templates/tiptap/tiptap-ui-primitive/separator/separator.tsx +33 -0
  137. package/templates/tiptap/tiptap-ui-primitive/spacer/index.tsx +1 -0
  138. package/templates/tiptap/tiptap-ui-primitive/spacer/spacer.tsx +21 -0
  139. package/templates/tiptap/tiptap-ui-primitive/toolbar/index.tsx +1 -0
  140. package/templates/tiptap/tiptap-ui-primitive/toolbar/toolbar.scss +98 -0
  141. package/templates/tiptap/tiptap-ui-primitive/toolbar/toolbar.tsx +113 -0
  142. package/templates/tiptap/tiptap-ui-primitive/tooltip/index.tsx +1 -0
  143. package/templates/tiptap/tiptap-ui-primitive/tooltip/tooltip.scss +43 -0
  144. package/templates/tiptap/tiptap-ui-primitive/tooltip/tooltip.tsx +223 -0
  145. package/templates/ui/accordion.tsx +52 -0
  146. package/templates/ui/alert-dialog.tsx +116 -0
  147. package/templates/ui/alert.tsx +48 -0
  148. package/templates/ui/aspect-ratio.tsx +7 -0
  149. package/templates/ui/avatar.tsx +46 -0
  150. package/templates/ui/badge.tsx +32 -0
  151. package/templates/ui/breadcrumb.tsx +98 -0
  152. package/templates/ui/button-group.tsx +77 -0
  153. package/templates/ui/button.tsx +48 -0
  154. package/templates/ui/calendar.tsx +176 -0
  155. package/templates/ui/card.tsx +54 -0
  156. package/templates/ui/carousel.tsx +234 -0
  157. package/templates/ui/chart.tsx +349 -0
  158. package/templates/ui/checkbox.tsx +27 -0
  159. package/templates/ui/collapsible.tsx +11 -0
  160. package/templates/ui/command.tsx +142 -0
  161. package/templates/ui/context-menu.tsx +188 -0
  162. package/templates/ui/curriculum-editor.tsx +601 -0
  163. package/templates/ui/date-picker.tsx +70 -0
  164. package/templates/ui/dialog.tsx +103 -0
  165. package/templates/ui/drawer.tsx +99 -0
  166. package/templates/ui/dropdown-menu.tsx +185 -0
  167. package/templates/ui/dynamic-list-field.tsx +95 -0
  168. package/templates/ui/empty.tsx +90 -0
  169. package/templates/ui/field.tsx +231 -0
  170. package/templates/ui/file-upload-example.tsx +113 -0
  171. package/templates/ui/form.tsx +172 -0
  172. package/templates/ui/hover-card.tsx +28 -0
  173. package/templates/ui/icon-picker.tsx +435 -0
  174. package/templates/ui/icons-data.ts +6 -0
  175. package/templates/ui/image-upload-field.tsx +360 -0
  176. package/templates/ui/input-group.tsx +160 -0
  177. package/templates/ui/input-otp.tsx +70 -0
  178. package/templates/ui/input.tsx +21 -0
  179. package/templates/ui/item.tsx +171 -0
  180. package/templates/ui/kbd.tsx +28 -0
  181. package/templates/ui/label.tsx +20 -0
  182. package/templates/ui/logo.tsx +113 -0
  183. package/templates/ui/markdown-editor.tsx +303 -0
  184. package/templates/ui/markdown-utils.ts +128 -0
  185. package/templates/ui/media-upload-field.tsx +255 -0
  186. package/templates/ui/menubar.tsx +230 -0
  187. package/templates/ui/navigation-menu.tsx +119 -0
  188. package/templates/ui/pagination.tsx +96 -0
  189. package/templates/ui/placeholder.tsx +25 -0
  190. package/templates/ui/popover.tsx +32 -0
  191. package/templates/ui/progress.tsx +24 -0
  192. package/templates/ui/radio-group.tsx +37 -0
  193. package/templates/ui/resizable.tsx +41 -0
  194. package/templates/ui/rich-text-editor.tsx +374 -0
  195. package/templates/ui/scroll-area.tsx +45 -0
  196. package/templates/ui/select.tsx +151 -0
  197. package/templates/ui/separator.tsx +25 -0
  198. package/templates/ui/sheet.tsx +120 -0
  199. package/templates/ui/sidebar.tsx +684 -0
  200. package/templates/ui/skeleton.tsx +7 -0
  201. package/templates/ui/slider.tsx +24 -0
  202. package/templates/ui/sonner.tsx +29 -0
  203. package/templates/ui/spinner.tsx +15 -0
  204. package/templates/ui/switch.tsx +28 -0
  205. package/templates/ui/table.tsx +93 -0
  206. package/templates/ui/tabs.tsx +54 -0
  207. package/templates/ui/textarea.tsx +20 -0
  208. package/templates/ui/toast.tsx +127 -0
  209. package/templates/ui/toggle-group.tsx +56 -0
  210. package/templates/ui/toggle.tsx +43 -0
  211. package/templates/ui/tooltip.tsx +31 -0
  212. package/templates/ui/use-mobile.tsx +19 -0
  213. package/templates/ui/video-upload-field.tsx +368 -0
  214. package/dist/chunk-EIH4RRIJ.js +0 -183
  215. package/dist/chunk-EIH4RRIJ.js.map +0 -1
  216. package/dist/chunk-NKRQYAS6.js +0 -260
  217. package/dist/chunk-NKRQYAS6.js.map +0 -1
  218. package/dist/chunk-QLVSHP7X.js +0 -235
  219. package/dist/chunk-QLVSHP7X.js.map +0 -1
  220. package/dist/chunk-WY6BC55D.js +0 -357
  221. package/dist/chunk-WY6BC55D.js.map +0 -1
  222. package/dist/config/index.d.ts +0 -93
  223. package/dist/config/index.js +0 -58
  224. package/dist/config/index.js.map +0 -1
  225. package/dist/core/index.d.ts +0 -415
  226. package/dist/core/index.js +0 -906
  227. package/dist/core/index.js.map +0 -1
  228. package/dist/import-resolver-BaZ-rzkH.d.ts +0 -123
  229. package/dist/logger-awLb347n.d.ts +0 -81
  230. package/dist/plugins/index.d.ts +0 -213
  231. package/dist/plugins/index.js +0 -365
  232. package/dist/plugins/index.js.map +0 -1
  233. package/dist/types-ByX_gl6y.d.ts +0 -232
  234. package/dist/types-eI549DEG.d.ts +0 -331
@@ -1,365 +0,0 @@
1
- import {
2
- PluginError,
3
- getLogger
4
- } from "../chunk-WY6BC55D.js";
5
-
6
- // src/plugins/types.ts
7
- function createPlugin(options) {
8
- const plugin = {
9
- name: options.name,
10
- version: options.version,
11
- description: options.description,
12
- hooks: {},
13
- generators: {},
14
- fieldTypes: {},
15
- commands: []
16
- };
17
- const builder = {
18
- onInit(handler) {
19
- plugin.hooks = plugin.hooks || {};
20
- plugin.hooks.onInit = handler;
21
- return builder;
22
- },
23
- onBeforeGenerate(handler) {
24
- plugin.hooks = plugin.hooks || {};
25
- plugin.hooks.onBeforeGenerate = handler;
26
- return builder;
27
- },
28
- onAfterGenerate(handler) {
29
- plugin.hooks = plugin.hooks || {};
30
- plugin.hooks.onAfterGenerate = handler;
31
- return builder;
32
- },
33
- addGenerator(name, description, generate) {
34
- plugin.generators = plugin.generators || {};
35
- plugin.generators[name] = { name, description, generate };
36
- return builder;
37
- },
38
- addFieldType(name, handler) {
39
- plugin.fieldTypes = plugin.fieldTypes || {};
40
- plugin.fieldTypes[name] = handler;
41
- return builder;
42
- },
43
- addCommand(name, description, options2, handler) {
44
- plugin.commands = plugin.commands || [];
45
- plugin.commands.push({ name, description, options: options2, handler });
46
- return builder;
47
- },
48
- build() {
49
- return plugin;
50
- }
51
- };
52
- return builder;
53
- }
54
- function hasHook(plugin, hook) {
55
- return plugin.hooks !== void 0 && typeof plugin.hooks[hook] === "function";
56
- }
57
- function hasGenerator(plugin, generatorName) {
58
- return plugin.generators !== void 0 && generatorName in plugin.generators;
59
- }
60
- function hasFieldType(plugin, fieldTypeName) {
61
- return plugin.fieldTypes !== void 0 && fieldTypeName in plugin.fieldTypes;
62
- }
63
- function hasCommand(plugin, commandName) {
64
- return plugin.commands?.some((cmd) => cmd.name === commandName) ?? false;
65
- }
66
- function getGeneratorNames(plugin) {
67
- return plugin.generators ? Object.keys(plugin.generators) : [];
68
- }
69
- function getFieldTypeNames(plugin) {
70
- return plugin.fieldTypes ? Object.keys(plugin.fieldTypes) : [];
71
- }
72
- function getCommandNames(plugin) {
73
- return plugin.commands ? plugin.commands.map((cmd) => cmd.name) : [];
74
- }
75
-
76
- // src/plugins/manager.ts
77
- var PluginManager = class {
78
- plugins = /* @__PURE__ */ new Map();
79
- initialized = false;
80
- /**
81
- * Register a plugin
82
- */
83
- register(plugin) {
84
- if (this.plugins.has(plugin.name)) {
85
- throw new PluginError(`Plugin "${plugin.name}" is already registered`, plugin.name);
86
- }
87
- const logger = getLogger();
88
- logger.debug(`Registering plugin: ${plugin.name}@${plugin.version}`);
89
- this.plugins.set(plugin.name, plugin);
90
- }
91
- /**
92
- * Register multiple plugins
93
- */
94
- registerAll(plugins) {
95
- for (const plugin of plugins) {
96
- this.register(plugin);
97
- }
98
- }
99
- /**
100
- * Unregister a plugin
101
- */
102
- unregister(pluginName) {
103
- return this.plugins.delete(pluginName);
104
- }
105
- /**
106
- * Get a registered plugin by name
107
- */
108
- get(pluginName) {
109
- return this.plugins.get(pluginName);
110
- }
111
- /**
112
- * Get all registered plugins
113
- */
114
- getAll() {
115
- return Array.from(this.plugins.values());
116
- }
117
- /**
118
- * Check if a plugin is registered
119
- */
120
- has(pluginName) {
121
- return this.plugins.has(pluginName);
122
- }
123
- /**
124
- * Initialize all plugins
125
- */
126
- async initialize(context) {
127
- if (this.initialized) {
128
- return;
129
- }
130
- const logger = getLogger();
131
- for (const plugin of this.plugins.values()) {
132
- if (hasHook(plugin, "onInit")) {
133
- try {
134
- logger.debug(`Initializing plugin: ${plugin.name}`);
135
- await plugin.hooks.onInit(context);
136
- } catch (error) {
137
- throw new PluginError(
138
- `Failed to initialize plugin "${plugin.name}": ${error instanceof Error ? error.message : String(error)}`,
139
- plugin.name,
140
- { originalError: error }
141
- );
142
- }
143
- }
144
- }
145
- this.initialized = true;
146
- }
147
- /**
148
- * Run beforeGenerate hooks on all plugins
149
- */
150
- async runBeforeGenerate(context, schema) {
151
- const logger = getLogger();
152
- for (const plugin of this.plugins.values()) {
153
- if (hasHook(plugin, "onBeforeGenerate")) {
154
- try {
155
- logger.debug(`Running beforeGenerate for plugin: ${plugin.name}`);
156
- await plugin.hooks.onBeforeGenerate(context, schema);
157
- } catch (error) {
158
- throw new PluginError(
159
- `Plugin "${plugin.name}" failed in beforeGenerate: ${error instanceof Error ? error.message : String(error)}`,
160
- plugin.name,
161
- { originalError: error }
162
- );
163
- }
164
- }
165
- }
166
- }
167
- /**
168
- * Run afterGenerate hooks on all plugins
169
- */
170
- async runAfterGenerate(context, files) {
171
- const logger = getLogger();
172
- for (const plugin of this.plugins.values()) {
173
- if (hasHook(plugin, "onAfterGenerate")) {
174
- try {
175
- logger.debug(`Running afterGenerate for plugin: ${plugin.name}`);
176
- await plugin.hooks.onAfterGenerate(context, files);
177
- } catch (error) {
178
- throw new PluginError(
179
- `Plugin "${plugin.name}" failed in afterGenerate: ${error instanceof Error ? error.message : String(error)}`,
180
- plugin.name,
181
- { originalError: error }
182
- );
183
- }
184
- }
185
- }
186
- }
187
- // ============================================================================
188
- // Generator Access
189
- // ============================================================================
190
- /**
191
- * Get a generator by name from any registered plugin
192
- */
193
- getGenerator(name) {
194
- for (const plugin of this.plugins.values()) {
195
- if (plugin.generators && name in plugin.generators) {
196
- return plugin.generators[name];
197
- }
198
- }
199
- return void 0;
200
- }
201
- /**
202
- * Get all generators from all plugins
203
- */
204
- getAllGenerators() {
205
- const generators = /* @__PURE__ */ new Map();
206
- for (const plugin of this.plugins.values()) {
207
- if (plugin.generators) {
208
- for (const [name, generator] of Object.entries(plugin.generators)) {
209
- generators.set(name, { plugin: plugin.name, generator });
210
- }
211
- }
212
- }
213
- return generators;
214
- }
215
- /**
216
- * Get all generator names
217
- */
218
- getGeneratorNames() {
219
- const names = [];
220
- for (const plugin of this.plugins.values()) {
221
- names.push(...getGeneratorNames(plugin));
222
- }
223
- return names;
224
- }
225
- // ============================================================================
226
- // Field Type Access
227
- // ============================================================================
228
- /**
229
- * Get a field type handler by name from any registered plugin
230
- */
231
- getFieldType(name) {
232
- for (const plugin of this.plugins.values()) {
233
- if (plugin.fieldTypes && name in plugin.fieldTypes) {
234
- return plugin.fieldTypes[name];
235
- }
236
- }
237
- return void 0;
238
- }
239
- /**
240
- * Get all field types from all plugins
241
- */
242
- getAllFieldTypes() {
243
- const fieldTypes = /* @__PURE__ */ new Map();
244
- for (const plugin of this.plugins.values()) {
245
- if (plugin.fieldTypes) {
246
- for (const [name, handler] of Object.entries(plugin.fieldTypes)) {
247
- fieldTypes.set(name, { plugin: plugin.name, handler });
248
- }
249
- }
250
- }
251
- return fieldTypes;
252
- }
253
- /**
254
- * Get all field type names
255
- */
256
- getFieldTypeNames() {
257
- const names = [];
258
- for (const plugin of this.plugins.values()) {
259
- names.push(...getFieldTypeNames(plugin));
260
- }
261
- return names;
262
- }
263
- // ============================================================================
264
- // Command Access
265
- // ============================================================================
266
- /**
267
- * Get a command by name from any registered plugin
268
- */
269
- getCommand(name) {
270
- for (const plugin of this.plugins.values()) {
271
- if (plugin.commands) {
272
- const command = plugin.commands.find((cmd) => cmd.name === name);
273
- if (command) {
274
- return command;
275
- }
276
- }
277
- }
278
- return void 0;
279
- }
280
- /**
281
- * Get all commands from all plugins
282
- */
283
- getAllCommands() {
284
- const commands = /* @__PURE__ */ new Map();
285
- for (const plugin of this.plugins.values()) {
286
- if (plugin.commands) {
287
- for (const command of plugin.commands) {
288
- commands.set(command.name, { plugin: plugin.name, command });
289
- }
290
- }
291
- }
292
- return commands;
293
- }
294
- /**
295
- * Get all command names
296
- */
297
- getCommandNames() {
298
- const names = [];
299
- for (const plugin of this.plugins.values()) {
300
- names.push(...getCommandNames(plugin));
301
- }
302
- return names;
303
- }
304
- // ============================================================================
305
- // Utility Methods
306
- // ============================================================================
307
- /**
308
- * Get plugin summary
309
- */
310
- getSummary() {
311
- const plugins = [];
312
- for (const plugin of this.plugins.values()) {
313
- plugins.push({
314
- name: plugin.name,
315
- version: plugin.version,
316
- description: plugin.description,
317
- generators: getGeneratorNames(plugin),
318
- fieldTypes: getFieldTypeNames(plugin),
319
- commands: getCommandNames(plugin)
320
- });
321
- }
322
- return {
323
- count: this.plugins.size,
324
- plugins
325
- };
326
- }
327
- /**
328
- * Clear all registered plugins
329
- */
330
- clear() {
331
- this.plugins.clear();
332
- this.initialized = false;
333
- }
334
- };
335
- var globalPluginManager = null;
336
- function getPluginManager() {
337
- if (!globalPluginManager) {
338
- globalPluginManager = new PluginManager();
339
- }
340
- return globalPluginManager;
341
- }
342
- function createPluginManager() {
343
- return new PluginManager();
344
- }
345
- function resetPluginManager() {
346
- if (globalPluginManager) {
347
- globalPluginManager.clear();
348
- }
349
- globalPluginManager = null;
350
- }
351
- export {
352
- PluginManager,
353
- createPlugin,
354
- createPluginManager,
355
- getCommandNames,
356
- getFieldTypeNames,
357
- getGeneratorNames,
358
- getPluginManager,
359
- hasCommand,
360
- hasFieldType,
361
- hasGenerator,
362
- hasHook,
363
- resetPluginManager
364
- };
365
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/plugins/types.ts","../../src/plugins/manager.ts"],"sourcesContent":["/**\n * Plugin system types for @betterstart/cli\n * Re-exports types from config and adds plugin-specific utilities\n */\n\n// Re-export plugin types from config\nexport type {\n BetterstartPlugin,\n CustomGenerator,\n FieldTypeHandler,\n GeneratedFile,\n PluginCommand,\n PluginContext,\n PluginHooks\n} from '../config/types'\n\nimport type { BetterstartPlugin, GeneratedFile, PluginContext } from '../config/types'\n\n// ============================================================================\n// Plugin Lifecycle Events\n// ============================================================================\n\n/**\n * Events emitted during plugin lifecycle\n */\nexport type PluginEvent =\n | 'init'\n | 'beforeGenerate'\n | 'afterGenerate'\n | 'beforeWrite'\n | 'afterWrite'\n | 'error'\n\n/**\n * Event handler type\n */\nexport type PluginEventHandler<T = unknown> = (context: PluginContext, data: T) => Promise<void>\n\n// ============================================================================\n// Plugin Builder\n// ============================================================================\n\n/**\n * Options for creating a plugin\n */\nexport interface CreatePluginOptions {\n name: string\n version: string\n description?: string\n}\n\n/**\n * Plugin builder for fluent API\n */\nexport interface PluginBuilder {\n /** Add an onInit hook */\n onInit(handler: (context: PluginContext) => Promise<void>): PluginBuilder\n\n /** Add an onBeforeGenerate hook */\n onBeforeGenerate(\n handler: (context: PluginContext, schema: unknown) => Promise<void>\n ): PluginBuilder\n\n /** Add an onAfterGenerate hook */\n onAfterGenerate(\n handler: (context: PluginContext, files: GeneratedFile[]) => Promise<void>\n ): PluginBuilder\n\n /** Add a custom generator */\n addGenerator(\n name: string,\n description: string,\n generate: (context: PluginContext, schema: unknown) => Promise<GeneratedFile[]>\n ): PluginBuilder\n\n /** Add a custom field type */\n addFieldType(\n name: string,\n handler: {\n zodType: (field: unknown) => string\n drizzleType: (field: unknown, imports: Set<string>) => string\n typescriptType: (field: unknown, mode: 'input' | 'output') => string\n formComponent?: (field: unknown) => string\n }\n ): PluginBuilder\n\n /** Add a CLI command */\n addCommand(\n name: string,\n description: string,\n options: Array<{ flags: string; description: string; default?: unknown }>,\n handler: (options: Record<string, unknown>) => Promise<void>\n ): PluginBuilder\n\n /** Build the plugin */\n build(): BetterstartPlugin\n}\n\n/**\n * Create a plugin using the builder pattern\n */\nexport function createPlugin(options: CreatePluginOptions): PluginBuilder {\n const plugin: BetterstartPlugin = {\n name: options.name,\n version: options.version,\n description: options.description,\n hooks: {},\n generators: {},\n fieldTypes: {},\n commands: []\n }\n\n const builder: PluginBuilder = {\n onInit(handler) {\n plugin.hooks = plugin.hooks || {}\n plugin.hooks.onInit = handler\n return builder\n },\n\n onBeforeGenerate(handler) {\n plugin.hooks = plugin.hooks || {}\n plugin.hooks.onBeforeGenerate = handler\n return builder\n },\n\n onAfterGenerate(handler) {\n plugin.hooks = plugin.hooks || {}\n plugin.hooks.onAfterGenerate = handler\n return builder\n },\n\n addGenerator(name, description, generate) {\n plugin.generators = plugin.generators || {}\n plugin.generators[name] = { name, description, generate }\n return builder\n },\n\n addFieldType(name, handler) {\n plugin.fieldTypes = plugin.fieldTypes || {}\n plugin.fieldTypes[name] = handler\n return builder\n },\n\n addCommand(name, description, options, handler) {\n plugin.commands = plugin.commands || []\n plugin.commands.push({ name, description, options, handler })\n return builder\n },\n\n build() {\n return plugin\n }\n }\n\n return builder\n}\n\n// ============================================================================\n// Plugin Utilities\n// ============================================================================\n\n/**\n * Check if a plugin has a specific hook\n */\nexport function hasHook(\n plugin: BetterstartPlugin,\n hook: keyof NonNullable<BetterstartPlugin['hooks']>\n): boolean {\n return plugin.hooks !== undefined && typeof plugin.hooks[hook] === 'function'\n}\n\n/**\n * Check if a plugin provides a specific generator\n */\nexport function hasGenerator(plugin: BetterstartPlugin, generatorName: string): boolean {\n return plugin.generators !== undefined && generatorName in plugin.generators\n}\n\n/**\n * Check if a plugin provides a specific field type\n */\nexport function hasFieldType(plugin: BetterstartPlugin, fieldTypeName: string): boolean {\n return plugin.fieldTypes !== undefined && fieldTypeName in plugin.fieldTypes\n}\n\n/**\n * Check if a plugin provides a specific command\n */\nexport function hasCommand(plugin: BetterstartPlugin, commandName: string): boolean {\n return plugin.commands?.some((cmd) => cmd.name === commandName) ?? false\n}\n\n/**\n * Get all generator names from a plugin\n */\nexport function getGeneratorNames(plugin: BetterstartPlugin): string[] {\n return plugin.generators ? Object.keys(plugin.generators) : []\n}\n\n/**\n * Get all field type names from a plugin\n */\nexport function getFieldTypeNames(plugin: BetterstartPlugin): string[] {\n return plugin.fieldTypes ? Object.keys(plugin.fieldTypes) : []\n}\n\n/**\n * Get all command names from a plugin\n */\nexport function getCommandNames(plugin: BetterstartPlugin): string[] {\n return plugin.commands ? plugin.commands.map((cmd) => cmd.name) : []\n}\n","/**\n * Plugin manager for @betterstart/cli\n * Handles plugin registration, lifecycle, and execution\n */\n\nimport type {\n BetterstartPlugin,\n CustomGenerator,\n FieldTypeHandler,\n GeneratedFile,\n PluginCommand,\n PluginContext\n} from '../config/types'\nimport { PluginError } from '../core/errors'\nimport { getLogger } from '../core/logger'\nimport { getCommandNames, getFieldTypeNames, getGeneratorNames, hasHook } from './types'\n\n// ============================================================================\n// Plugin Manager\n// ============================================================================\n\n/**\n * Plugin manager for handling plugin lifecycle and registration\n */\nexport class PluginManager {\n private plugins: Map<string, BetterstartPlugin> = new Map()\n private initialized = false\n\n /**\n * Register a plugin\n */\n register(plugin: BetterstartPlugin): void {\n if (this.plugins.has(plugin.name)) {\n throw new PluginError(`Plugin \"${plugin.name}\" is already registered`, plugin.name)\n }\n\n const logger = getLogger()\n logger.debug(`Registering plugin: ${plugin.name}@${plugin.version}`)\n\n this.plugins.set(plugin.name, plugin)\n }\n\n /**\n * Register multiple plugins\n */\n registerAll(plugins: BetterstartPlugin[]): void {\n for (const plugin of plugins) {\n this.register(plugin)\n }\n }\n\n /**\n * Unregister a plugin\n */\n unregister(pluginName: string): boolean {\n return this.plugins.delete(pluginName)\n }\n\n /**\n * Get a registered plugin by name\n */\n get(pluginName: string): BetterstartPlugin | undefined {\n return this.plugins.get(pluginName)\n }\n\n /**\n * Get all registered plugins\n */\n getAll(): BetterstartPlugin[] {\n return Array.from(this.plugins.values())\n }\n\n /**\n * Check if a plugin is registered\n */\n has(pluginName: string): boolean {\n return this.plugins.has(pluginName)\n }\n\n /**\n * Initialize all plugins\n */\n async initialize(context: PluginContext): Promise<void> {\n if (this.initialized) {\n return\n }\n\n const logger = getLogger()\n\n for (const plugin of this.plugins.values()) {\n if (hasHook(plugin, 'onInit')) {\n try {\n logger.debug(`Initializing plugin: ${plugin.name}`)\n await plugin.hooks!.onInit!(context)\n } catch (error) {\n throw new PluginError(\n `Failed to initialize plugin \"${plugin.name}\": ${error instanceof Error ? error.message : String(error)}`,\n plugin.name,\n { originalError: error }\n )\n }\n }\n }\n\n this.initialized = true\n }\n\n /**\n * Run beforeGenerate hooks on all plugins\n */\n async runBeforeGenerate(context: PluginContext, schema: unknown): Promise<void> {\n const logger = getLogger()\n\n for (const plugin of this.plugins.values()) {\n if (hasHook(plugin, 'onBeforeGenerate')) {\n try {\n logger.debug(`Running beforeGenerate for plugin: ${plugin.name}`)\n await plugin.hooks!.onBeforeGenerate!(context, schema)\n } catch (error) {\n throw new PluginError(\n `Plugin \"${plugin.name}\" failed in beforeGenerate: ${error instanceof Error ? error.message : String(error)}`,\n plugin.name,\n { originalError: error }\n )\n }\n }\n }\n }\n\n /**\n * Run afterGenerate hooks on all plugins\n */\n async runAfterGenerate(context: PluginContext, files: GeneratedFile[]): Promise<void> {\n const logger = getLogger()\n\n for (const plugin of this.plugins.values()) {\n if (hasHook(plugin, 'onAfterGenerate')) {\n try {\n logger.debug(`Running afterGenerate for plugin: ${plugin.name}`)\n await plugin.hooks!.onAfterGenerate!(context, files)\n } catch (error) {\n throw new PluginError(\n `Plugin \"${plugin.name}\" failed in afterGenerate: ${error instanceof Error ? error.message : String(error)}`,\n plugin.name,\n { originalError: error }\n )\n }\n }\n }\n }\n\n // ============================================================================\n // Generator Access\n // ============================================================================\n\n /**\n * Get a generator by name from any registered plugin\n */\n getGenerator(name: string): CustomGenerator | undefined {\n for (const plugin of this.plugins.values()) {\n if (plugin.generators && name in plugin.generators) {\n return plugin.generators[name]\n }\n }\n return undefined\n }\n\n /**\n * Get all generators from all plugins\n */\n getAllGenerators(): Map<string, { plugin: string; generator: CustomGenerator }> {\n const generators = new Map<string, { plugin: string; generator: CustomGenerator }>()\n\n for (const plugin of this.plugins.values()) {\n if (plugin.generators) {\n for (const [name, generator] of Object.entries(plugin.generators)) {\n generators.set(name, { plugin: plugin.name, generator })\n }\n }\n }\n\n return generators\n }\n\n /**\n * Get all generator names\n */\n getGeneratorNames(): string[] {\n const names: string[] = []\n for (const plugin of this.plugins.values()) {\n names.push(...getGeneratorNames(plugin))\n }\n return names\n }\n\n // ============================================================================\n // Field Type Access\n // ============================================================================\n\n /**\n * Get a field type handler by name from any registered plugin\n */\n getFieldType(name: string): FieldTypeHandler | undefined {\n for (const plugin of this.plugins.values()) {\n if (plugin.fieldTypes && name in plugin.fieldTypes) {\n return plugin.fieldTypes[name]\n }\n }\n return undefined\n }\n\n /**\n * Get all field types from all plugins\n */\n getAllFieldTypes(): Map<string, { plugin: string; handler: FieldTypeHandler }> {\n const fieldTypes = new Map<string, { plugin: string; handler: FieldTypeHandler }>()\n\n for (const plugin of this.plugins.values()) {\n if (plugin.fieldTypes) {\n for (const [name, handler] of Object.entries(plugin.fieldTypes)) {\n fieldTypes.set(name, { plugin: plugin.name, handler })\n }\n }\n }\n\n return fieldTypes\n }\n\n /**\n * Get all field type names\n */\n getFieldTypeNames(): string[] {\n const names: string[] = []\n for (const plugin of this.plugins.values()) {\n names.push(...getFieldTypeNames(plugin))\n }\n return names\n }\n\n // ============================================================================\n // Command Access\n // ============================================================================\n\n /**\n * Get a command by name from any registered plugin\n */\n getCommand(name: string): PluginCommand | undefined {\n for (const plugin of this.plugins.values()) {\n if (plugin.commands) {\n const command = plugin.commands.find((cmd) => cmd.name === name)\n if (command) {\n return command\n }\n }\n }\n return undefined\n }\n\n /**\n * Get all commands from all plugins\n */\n getAllCommands(): Map<string, { plugin: string; command: PluginCommand }> {\n const commands = new Map<string, { plugin: string; command: PluginCommand }>()\n\n for (const plugin of this.plugins.values()) {\n if (plugin.commands) {\n for (const command of plugin.commands) {\n commands.set(command.name, { plugin: plugin.name, command })\n }\n }\n }\n\n return commands\n }\n\n /**\n * Get all command names\n */\n getCommandNames(): string[] {\n const names: string[] = []\n for (const plugin of this.plugins.values()) {\n names.push(...getCommandNames(plugin))\n }\n return names\n }\n\n // ============================================================================\n // Utility Methods\n // ============================================================================\n\n /**\n * Get plugin summary\n */\n getSummary(): PluginSummary {\n const plugins: PluginInfo[] = []\n\n for (const plugin of this.plugins.values()) {\n plugins.push({\n name: plugin.name,\n version: plugin.version,\n description: plugin.description,\n generators: getGeneratorNames(plugin),\n fieldTypes: getFieldTypeNames(plugin),\n commands: getCommandNames(plugin)\n })\n }\n\n return {\n count: this.plugins.size,\n plugins\n }\n }\n\n /**\n * Clear all registered plugins\n */\n clear(): void {\n this.plugins.clear()\n this.initialized = false\n }\n}\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface PluginInfo {\n name: string\n version: string\n description?: string\n generators: string[]\n fieldTypes: string[]\n commands: string[]\n}\n\nexport interface PluginSummary {\n count: number\n plugins: PluginInfo[]\n}\n\n// ============================================================================\n// Singleton Instance\n// ============================================================================\n\nlet globalPluginManager: PluginManager | null = null\n\n/**\n * Get the global plugin manager instance\n */\nexport function getPluginManager(): PluginManager {\n if (!globalPluginManager) {\n globalPluginManager = new PluginManager()\n }\n return globalPluginManager\n}\n\n/**\n * Create a new plugin manager instance\n */\nexport function createPluginManager(): PluginManager {\n return new PluginManager()\n}\n\n/**\n * Reset the global plugin manager\n */\nexport function resetPluginManager(): void {\n if (globalPluginManager) {\n globalPluginManager.clear()\n }\n glob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;AACrC,mBAAS,IAAI,QAAQ,MAAM,EAAE,QAAQ,OAAO,MAAM,QAAQ,CAAC;AAAA,QAC7D;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,kBAA4B;AAC1B,UAAM,QAAkB,CAAC;AACzB,eAAW,UAAU,KAAK,QAAQ,OAAO,GAAG;AAC1C,YAAM,KAAK,GAAG,gBAAgB,MAAM,CAAC;AAAA,IACvC;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,aAA4B;AAC1B,UAAM,UAAwB,CAAC;AAE/B,eAAW,UAAU,KAAK,QAAQ,OAAO,GAAG;AAC1C,cAAQ,KAAK;AAAA,QACX,MAAM,OAAO;AAAA,QACb,SAAS,OAAO;AAAA,QAChB,aAAa,OAAO;AAAA,QACpB,YAAY,kBAAkB,MAAM;AAAA,QACpC,YAAY,kBAAkB,MAAM;AAAA,QACpC,UAAU,gBAAgB,MAAM;AAAA,MAClC,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,MACL,OAAO,KAAK,QAAQ;AAAA,MACpB;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,QAAc;AACZ,SAAK,QAAQ,MAAM;AACnB,SAAK,cAAc;AAAA,EACrB;AACF;AAwBA,IAAI,sBAA4C;AAKzC,SAAS,mBAAkC;AAChD,MAAI,CAAC,qBAAqB;AACxB,0BAAsB,IAAI,cAAc;AAAA,EAC1C;AACA,SAAO;AACT;AAKO,SAAS,sBAAqC;AACnD,SAAO,IAAI,cAAc;AAC3B;AAKO,SAAS,qBAA2B;AACzC,MAAI,qBAAqB;AACvB,wBAAoB,MAAM;AAAA,EAC5B;AACA,wBAAsB;AACxB;","names":["options"]}
@@ -1,232 +0,0 @@
1
- type FieldType = 'string' | 'number' | 'boolean' | 'date' | 'timestamp' | 'serial' | 'text' | 'markdown' | 'richtext' | 'decimal' | 'varchar' | 'image' | 'icon' | 'list' | 'group' | 'time' | 'select' | 'tabs' | 'relationship' | 'separator' | 'video' | 'media' | 'curriculum';
2
- type ColumnType = 'text' | 'badge' | 'date' | 'custom' | 'avatar' | 'link' | 'image' | 'email' | 'number' | 'boolean';
3
- interface SchemaField {
4
- name: string;
5
- type: FieldType;
6
- label?: string;
7
- required?: boolean;
8
- primaryKey?: boolean;
9
- default?: string | number | boolean;
10
- format?: string;
11
- length?: number;
12
- precision?: number;
13
- scale?: number;
14
- maxItems?: number;
15
- columns?: number;
16
- fields?: SchemaField[];
17
- items?: {
18
- name: string;
19
- type: FieldType;
20
- label?: string;
21
- required?: boolean;
22
- length?: number;
23
- };
24
- options?: {
25
- label: string;
26
- value: string;
27
- }[];
28
- tabs?: {
29
- name: string;
30
- label: string;
31
- fields: SchemaField[];
32
- }[];
33
- hint?: string;
34
- hidden?: boolean;
35
- hasIcon?: boolean;
36
- relationship?: string;
37
- multiple?: boolean;
38
- showWhen?: {
39
- field: string;
40
- value: boolean | string | number | (string | number)[];
41
- };
42
- }
43
- interface SchemaColumn {
44
- accessorKey: string;
45
- header: string;
46
- type: ColumnType;
47
- sortable?: boolean;
48
- component?: string;
49
- format?: string;
50
- }
51
- interface SchemaActions {
52
- create?: boolean;
53
- edit?: boolean;
54
- delete?: boolean;
55
- draft?: boolean;
56
- csvImport?: {
57
- enabled?: boolean;
58
- matchField?: string;
59
- };
60
- }
61
- /**
62
- * Search configuration for admin tables
63
- */
64
- interface SchemaSearch {
65
- /** Fields to search across (should be text-type columns) */
66
- fields: string[];
67
- }
68
- /**
69
- * Filter configuration for admin tables
70
- */
71
- interface SchemaFilter {
72
- /** Field name to filter by */
73
- field: string;
74
- /** Label for the filter dropdown */
75
- label: string;
76
- /** Filter type (currently only 'select' is supported) */
77
- type?: 'select';
78
- }
79
- /**
80
- * Auto-slugify configuration
81
- * Automatically generates URL-friendly slugs from another field
82
- */
83
- interface AutoSlugify {
84
- /** Whether auto-slugification is enabled */
85
- enabled: boolean;
86
- /** Source field to generate slug from */
87
- sourceField: string;
88
- /** Target field to store the slug */
89
- targetField: string;
90
- }
91
- /**
92
- * Nested slug lookup configuration
93
- * Generates functions to look up nested items by slug within a parent entity
94
- * Example: getChapterBySlug(tutorialSlug, chapterSlug) for chapters nested in tutorial modules
95
- */
96
- interface NestedSlugLookup {
97
- /** Name of the nested entity (e.g., "chapter") - used in function name */
98
- name: string;
99
- /** Path to the nested array using dot notation (e.g., "modules.chapters") */
100
- path: string;
101
- /** Field name containing the slug in the nested item (default: "slug") */
102
- slugField?: string;
103
- }
104
- interface Schema {
105
- name: string;
106
- label: string;
107
- description: string;
108
- icon: string;
109
- fields: SchemaField[];
110
- columns: SchemaColumn[];
111
- actions?: SchemaActions;
112
- /** Search configuration - when provided, enables backend search on the admin table */
113
- search?: SchemaSearch;
114
- /** Filter configuration - when provided, enables filters on the admin table */
115
- filters?: SchemaFilter[];
116
- /** Auto-slugify configuration - when provided, automatically generates slugs from specified field */
117
- autoSlugify?: AutoSlugify;
118
- /** Nested slug lookup configuration - generates functions to look up nested items by slug */
119
- nestedSlugLookups?: NestedSlugLookup[];
120
- }
121
- interface GeneratorOptions {
122
- skipMigration?: boolean;
123
- dummyCount?: number;
124
- force?: boolean;
125
- }
126
- interface GenerationResult {
127
- success: boolean;
128
- files: string[];
129
- errors?: string[];
130
- }
131
- /**
132
- * Paths configuration for the monorepo structure
133
- * All paths are absolute
134
- */
135
- interface MonorepoPaths {
136
- root: string;
137
- app: string;
138
- database: string;
139
- lib: string;
140
- hooks: string;
141
- schemas: string;
142
- data: string;
143
- }
144
- /**
145
- * Form field types supported by the form generator
146
- */
147
- type FormFieldType = 'text' | 'textarea' | 'email' | 'phone' | 'number' | 'url' | 'date' | 'select' | 'radio' | 'checkbox' | 'multiselect' | 'file' | 'upload' | 'group' | 'timezone' | 'list' | 'dynamicFields';
148
- /**
149
- * Form field definition
150
- */
151
- interface FormField {
152
- name?: string;
153
- type: FormFieldType;
154
- label: string;
155
- placeholder?: string;
156
- hint?: string;
157
- required?: boolean;
158
- defaultValue?: string | number | boolean;
159
- hidden?: boolean;
160
- urlParam?: string;
161
- condition?: string;
162
- showWhen?: {
163
- field: string;
164
- value: string | string[];
165
- };
166
- minLength?: number;
167
- maxLength?: number;
168
- min?: number;
169
- max?: number;
170
- pattern?: string;
171
- options?: Array<{
172
- label: string;
173
- value: string;
174
- }>;
175
- accept?: string;
176
- maxFileSize?: number;
177
- multiple?: boolean;
178
- columns?: number;
179
- fields?: FormField[];
180
- relationship?: string;
181
- relationshipField?: string;
182
- nuqsQueryParam?: string;
183
- source?: string;
184
- }
185
- /**
186
- * Form step definition for multi-step forms
187
- */
188
- interface FormStep {
189
- name: string;
190
- label: string;
191
- description?: string;
192
- fields: FormField[];
193
- }
194
- /**
195
- * Form actions configuration
196
- */
197
- interface FormActions {
198
- export?: boolean;
199
- delete?: boolean;
200
- edit?: boolean;
201
- }
202
- /**
203
- * Form column definition for admin table display
204
- */
205
- interface FormColumn {
206
- accessorKey: string;
207
- header: string;
208
- type?: 'text' | 'date' | 'email' | 'number' | 'badge';
209
- sortable?: boolean;
210
- }
211
- /**
212
- * Form schema definition for generating public forms
213
- */
214
- interface FormSchema {
215
- name: string;
216
- label: string;
217
- description: string;
218
- icon: string;
219
- submitButtonText?: string;
220
- successMessage?: string;
221
- redirectUrl?: string;
222
- notificationEmail?: string;
223
- fields?: FormField[];
224
- steps?: FormStep[];
225
- columns?: FormColumn[];
226
- actions?: FormActions;
227
- mailchimp?: boolean | {
228
- emailField?: string;
229
- };
230
- }
231
-
232
- export type { AutoSlugify as A, ColumnType as C, FormSchema as F, GeneratorOptions as G, MonorepoPaths as M, NestedSlugLookup as N, Schema as S, SchemaField as a, FieldType as b, SchemaColumn as c, SchemaActions as d, SchemaSearch as e, SchemaFilter as f, GenerationResult as g, FormFieldType as h, FormField as i, FormStep as j, FormActions as k, FormColumn as l };