torch-glare 1.1.2 → 1.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 (155) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +25 -25
  3. package/dist/bin/index.d.ts +3 -0
  4. package/dist/bin/index.d.ts.map +1 -0
  5. package/dist/bin/index.js +44 -0
  6. package/dist/bin/index.js.map +1 -0
  7. package/dist/src/commands/add.d.ts +7 -0
  8. package/dist/src/commands/add.d.ts.map +1 -0
  9. package/dist/src/commands/add.js +62 -0
  10. package/dist/src/commands/add.js.map +1 -0
  11. package/dist/src/commands/hook.d.ts +7 -0
  12. package/dist/src/commands/hook.d.ts.map +1 -0
  13. package/dist/src/commands/hook.js +69 -0
  14. package/dist/src/commands/hook.js.map +1 -0
  15. package/dist/src/commands/init.d.ts +3 -0
  16. package/dist/src/commands/init.d.ts.map +1 -0
  17. package/dist/src/commands/init.js +16 -0
  18. package/dist/src/commands/init.js.map +1 -0
  19. package/dist/src/commands/layout.d.ts +7 -0
  20. package/dist/src/commands/layout.d.ts.map +1 -0
  21. package/dist/src/commands/layout.js +69 -0
  22. package/dist/src/commands/layout.js.map +1 -0
  23. package/dist/src/commands/provider.d.ts +7 -0
  24. package/dist/src/commands/provider.d.ts.map +1 -0
  25. package/dist/src/commands/provider.js +69 -0
  26. package/dist/src/commands/provider.js.map +1 -0
  27. package/dist/src/commands/update.d.ts +5 -0
  28. package/dist/src/commands/update.d.ts.map +1 -0
  29. package/dist/src/commands/update.js +113 -0
  30. package/dist/src/commands/update.js.map +1 -0
  31. package/dist/src/commands/utils.d.ts +7 -0
  32. package/dist/src/commands/utils.d.ts.map +1 -0
  33. package/dist/src/commands/utils.js +71 -0
  34. package/dist/src/commands/utils.js.map +1 -0
  35. package/dist/src/shared/copyComponentsRecursively.d.ts +13 -0
  36. package/dist/src/shared/copyComponentsRecursively.d.ts.map +1 -0
  37. package/dist/src/shared/copyComponentsRecursively.js +44 -0
  38. package/dist/src/shared/copyComponentsRecursively.js.map +1 -0
  39. package/dist/src/shared/detectPackageManager.d.ts +6 -0
  40. package/dist/src/shared/detectPackageManager.d.ts.map +1 -0
  41. package/dist/src/shared/detectPackageManager.js +20 -0
  42. package/dist/src/shared/detectPackageManager.js.map +1 -0
  43. package/dist/src/shared/ensureDirectoryExists.d.ts +2 -0
  44. package/dist/src/shared/ensureDirectoryExists.d.ts.map +1 -0
  45. package/dist/src/shared/ensureDirectoryExists.js +11 -0
  46. package/dist/src/shared/ensureDirectoryExists.js.map +1 -0
  47. package/dist/src/shared/getAvailableFiles.d.ts +7 -0
  48. package/dist/src/shared/getAvailableFiles.d.ts.map +1 -0
  49. package/dist/src/shared/getAvailableFiles.js +11 -0
  50. package/dist/src/shared/getAvailableFiles.js.map +1 -0
  51. package/dist/src/shared/getConfig.d.ts +2 -0
  52. package/dist/src/shared/getConfig.d.ts.map +1 -0
  53. package/dist/src/shared/getConfig.js +15 -0
  54. package/dist/src/shared/getConfig.js.map +1 -0
  55. package/dist/src/shared/getCurrentInstalledDependencies.d.ts +7 -0
  56. package/dist/src/shared/getCurrentInstalledDependencies.d.ts.map +1 -0
  57. package/dist/src/shared/getCurrentInstalledDependencies.js +24 -0
  58. package/dist/src/shared/getCurrentInstalledDependencies.js.map +1 -0
  59. package/dist/src/shared/getDependenciesAndInstallNestedComponents.d.ts +8 -0
  60. package/dist/src/shared/getDependenciesAndInstallNestedComponents.d.ts.map +1 -0
  61. package/dist/src/shared/getDependenciesAndInstallNestedComponents.js +50 -0
  62. package/dist/src/shared/getDependenciesAndInstallNestedComponents.js.map +1 -0
  63. package/dist/src/shared/getInstallCommand.d.ts +8 -0
  64. package/dist/src/shared/getInstallCommand.d.ts.map +1 -0
  65. package/dist/src/shared/getInstallCommand.js +18 -0
  66. package/dist/src/shared/getInstallCommand.js.map +1 -0
  67. package/dist/src/shared/getInstallPaths.d.ts +14 -0
  68. package/dist/src/shared/getInstallPaths.d.ts.map +1 -0
  69. package/dist/src/shared/getInstallPaths.js +16 -0
  70. package/dist/src/shared/getInstallPaths.js.map +1 -0
  71. package/dist/src/shared/installDependencies.d.ts +6 -0
  72. package/dist/src/shared/installDependencies.d.ts.map +1 -0
  73. package/dist/src/shared/installDependencies.js +36 -0
  74. package/dist/src/shared/installDependencies.js.map +1 -0
  75. package/dist/src/shared/isFileExists.d.ts +7 -0
  76. package/dist/src/shared/isFileExists.d.ts.map +1 -0
  77. package/dist/src/shared/isFileExists.js +10 -0
  78. package/dist/src/shared/isFileExists.js.map +1 -0
  79. package/dist/src/shared/tailwindInit.d.ts +2 -0
  80. package/dist/src/shared/tailwindInit.d.ts.map +1 -0
  81. package/dist/src/shared/tailwindInit.js +76 -0
  82. package/dist/src/shared/tailwindInit.js.map +1 -0
  83. package/dist/src/types/main.d.ts +8 -0
  84. package/dist/src/types/main.d.ts.map +1 -0
  85. package/dist/src/types/main.js +2 -0
  86. package/dist/src/types/main.js.map +1 -0
  87. package/docs/README.md +207 -207
  88. package/lib/components/ActionButton.tsx +65 -63
  89. package/lib/components/ActionsGroup.tsx +38 -38
  90. package/lib/components/AlertDialog.tsx +222 -222
  91. package/lib/components/Avatar.tsx +49 -49
  92. package/lib/components/Badge.tsx +116 -116
  93. package/lib/components/BadgeField.tsx +196 -196
  94. package/lib/components/Button.tsx +265 -263
  95. package/lib/components/Calender.tsx +102 -0
  96. package/lib/components/Card.tsx +64 -64
  97. package/lib/components/Checkbox.tsx +49 -49
  98. package/lib/components/CountBadge.tsx +54 -54
  99. package/lib/components/DatePicker.tsx +178 -515
  100. package/lib/components/Dialog.tsx +129 -129
  101. package/lib/components/Divider.tsx +31 -31
  102. package/lib/components/Drawer.tsx +118 -118
  103. package/lib/components/DropdownMenu.tsx +399 -399
  104. package/lib/components/FieldHint.tsx +76 -76
  105. package/lib/components/Form.tsx +191 -191
  106. package/lib/components/ImageAttachment.tsx +198 -198
  107. package/lib/components/InnerLabelField.tsx +150 -150
  108. package/lib/components/Input.tsx +205 -205
  109. package/lib/components/InputField.tsx +145 -145
  110. package/lib/components/InputOTP.tsx +85 -85
  111. package/lib/components/Label.tsx +126 -126
  112. package/lib/components/LabelField.tsx +77 -77
  113. package/lib/components/LabeledCheckBox.tsx +55 -55
  114. package/lib/components/LabeledRadio.tsx +48 -48
  115. package/lib/components/LinkButton.tsx +93 -93
  116. package/lib/components/LoginButton.tsx +56 -56
  117. package/lib/components/PasswordLevel.tsx +58 -58
  118. package/lib/components/Popover.tsx +274 -274
  119. package/lib/components/ProfileMenu.tsx +90 -90
  120. package/lib/components/Radio.tsx +65 -65
  121. package/lib/components/RadioCard.tsx +66 -66
  122. package/lib/components/ScrollArea.tsx +52 -52
  123. package/lib/components/SearchField.tsx +48 -48
  124. package/lib/components/Select.tsx +418 -418
  125. package/lib/components/SimpleSelect.tsx +216 -0
  126. package/lib/components/Skeleton.tsx +15 -15
  127. package/lib/components/SlideDatePicker.tsx +187 -0
  128. package/lib/components/SpinLoading.tsx +190 -190
  129. package/lib/components/Switch.tsx +81 -81
  130. package/lib/components/TabFormItem.tsx +161 -161
  131. package/lib/components/Table.tsx +400 -400
  132. package/lib/components/Textarea.tsx +97 -97
  133. package/lib/components/Toggle.tsx +127 -127
  134. package/lib/components/Tooltip.tsx +111 -111
  135. package/lib/components/TransparentLabel.tsx +72 -72
  136. package/lib/components/TreeDropDown.tsx +69 -69
  137. package/lib/hooks/useActiveTreeItem.tsx +60 -60
  138. package/lib/hooks/useClickOutside.tsx +26 -24
  139. package/lib/hooks/useResize.tsx +78 -78
  140. package/lib/hooks/useTagSelection.tsx +214 -214
  141. package/lib/layouts/CNLayout.tsx +330 -330
  142. package/lib/layouts/FieldSection.tsx +63 -63
  143. package/lib/layouts/TreeSubLayout.tsx +187 -187
  144. package/lib/providers/ThemeProvider.tsx +98 -98
  145. package/lib/utils/cn.ts +6 -6
  146. package/lib/utils/dateFormat.ts +98 -0
  147. package/lib/utils/resize.ts +34 -34
  148. package/lib/utils/types.ts +12 -12
  149. package/package.json +29 -29
  150. package/lib/hooks/MobileSlidePicker/components/Picker.tsx +0 -218
  151. package/lib/hooks/MobileSlidePicker/components/PickerColumn.tsx +0 -238
  152. package/lib/hooks/MobileSlidePicker/components/PickerItem.tsx +0 -64
  153. package/lib/hooks/MobileSlidePicker/index.ts +0 -10
  154. package/lib/utils/convertImageFileToDataUrl.ts +0 -17
  155. package/lib/utils/convertImgToURL.ts +0 -17
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 TORCH corp.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 TORCH corp.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,25 +1,25 @@
1
- # TORCH Glare Components Library
2
-
3
- Welcome to the **TORCH Glare Components Library**! This library offers a comprehensive set of reusable React components designed to help you build modern, efficient user interfaces. It also includes a powerful CLI tool (**torch-glare CLI**) to simplify component management and integration.
4
-
5
- ![TORCH Glare Logo](docs/Cover.png)
6
-
7
- ## Documentation
8
- You can find the complete documentation at: [https://glare.torchcorp.com](https://glare.torchcorp.com)
9
-
10
- ## Contributing
11
- We’re excited to welcome contributors! To get started:
12
-
13
- 1. Fork the repository.
14
- 2. Create a new branch.
15
- 3. Implement your changes.
16
- 4. Commit with a descriptive message.
17
- 5. Push your branch and open a pull request.
18
-
19
- ### Contribution Guidelines
20
- - Adhere to the existing code style.
21
- - Update or add documentation where applicable.
22
-
23
- ## License
24
- This project is licensed under the **MIT License**.
25
-
1
+ # TORCH Glare Components Library
2
+
3
+ Welcome to the **TORCH Glare Components Library**! This library offers a comprehensive set of reusable React components designed to help you build modern, efficient user interfaces. It also includes a powerful CLI tool (**torch-glare CLI**) to simplify component management and integration.
4
+
5
+ ![TORCH Glare Logo](docs/Cover.png)
6
+
7
+ ## Documentation
8
+ You can find the complete documentation at: [https://glare.torchcorp.com](https://glare.torchcorp.com)
9
+
10
+ ## Contributing
11
+ We’re excited to welcome contributors! To get started:
12
+
13
+ 1. Fork the repository.
14
+ 2. Create a new branch.
15
+ 3. Implement your changes.
16
+ 4. Commit with a descriptive message.
17
+ 5. Push your branch and open a pull request.
18
+
19
+ ### Contribution Guidelines
20
+ - Adhere to the existing code style.
21
+ - Update or add documentation where applicable.
22
+
23
+ ## License
24
+ This project is licensed under the **MIT License**.
25
+
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../cli/bin/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ import { add } from "../src/commands/add.js";
4
+ import { initConfig } from "../src/commands/init.js";
5
+ import { addHook } from "../src/commands/hook.js";
6
+ import { addLayout } from "../src/commands/layout.js";
7
+ import { addUtil } from "../src/commands/utils.js";
8
+ import { addProvider } from "../src/commands/provider.js";
9
+ import { updateInstalledComponents } from "../src/commands/update.js";
10
+ const program = new Command();
11
+ program
12
+ .name("torch-glare")
13
+ .description("Torch Glare for managing React components")
14
+ .version("1.0.8");
15
+ program
16
+ .command("init")
17
+ .description("Initialize torch.json configuration file")
18
+ .action(() => initConfig());
19
+ program
20
+ .command("add [component]")
21
+ .description("Add a component interactively or install a specified one")
22
+ .action((component) => add(component && `${component}.tsx`));
23
+ program
24
+ .command("hook [hook]")
25
+ .description("Add a hook interactively or install a specified one")
26
+ .action((hook) => addHook(hook && `${hook}`));
27
+ program
28
+ .command("layout [layout]")
29
+ .description("Add a Layout interactively or install a specified one")
30
+ .action((layout) => addLayout(layout && `${layout}.tsx`));
31
+ program
32
+ .command("util [util]")
33
+ .description("Add a utils interactively or install a specified one")
34
+ .action((util) => addUtil(util && `${util}.ts`));
35
+ program
36
+ .command("provider [provider]")
37
+ .description("Add a provider interactively or install a specified one")
38
+ .action((provider) => addProvider(provider && `${provider}`));
39
+ program
40
+ .command("update")
41
+ .description("Update everything installed")
42
+ .action(() => updateInstalledComponents());
43
+ program.parse(process.argv);
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../cli/bin/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,aAAa,CAAC;KACnB,WAAW,CAAC,2CAA2C,CAAC;KACxD,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,0CAA0C,CAAC;KACvD,MAAM,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC,CAAC;AAE9B,OAAO;KACJ,OAAO,CAAC,iBAAiB,CAAC;KAC1B,WAAW,CAAC,0DAA0D,CAAC;KACvE,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,IAAI,GAAG,SAAS,MAAM,CAAC,CAAC,CAAC;AAE/D,OAAO;KACJ,OAAO,CAAC,aAAa,CAAC;KACtB,WAAW,CAAC,qDAAqD,CAAC;KAClE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;AAEhD,OAAO;KACJ,OAAO,CAAC,iBAAiB,CAAC;KAC1B,WAAW,CAAC,uDAAuD,CAAC;KACpE,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,CAAC,CAAC;AAE5D,OAAO;KACJ,OAAO,CAAC,aAAa,CAAC;KACtB,WAAW,CAAC,sDAAsD,CAAC;KACnE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC;AAEnD,OAAO;KACJ,OAAO,CAAC,qBAAqB,CAAC;KAC9B,WAAW,CAAC,yDAAyD,CAAC;KACtE,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,IAAI,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC;AAEhE,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,6BAA6B,CAAC;KAC1C,MAAM,CAAC,GAAG,EAAE,CAAC,yBAAyB,EAAE,CAAC,CAAC;AAE7C,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Main function to add a component and its dependencies.
3
+ * @param {string} component - The name of the component to add.
4
+ * @param {boolean} replace - Whether to replace the existing component.
5
+ */
6
+ export declare function add(component?: string, replace?: boolean): Promise<void>;
7
+ //# sourceMappingURL=add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/add.ts"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,wBAAsB,GAAG,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCrF"}
@@ -0,0 +1,62 @@
1
+ import path from "path";
2
+ import inquirer from "inquirer";
3
+ import { fileURLToPath } from "url";
4
+ import { ensureDirectoryExists } from "../shared/ensureDirectoryExists.js";
5
+ import { getInstallPaths } from "../shared/getInstallPaths.js";
6
+ import { copyComponentsRecursively } from "../shared/copyComponentsRecursively.js";
7
+ import { getAvailableFiles } from "../shared/getAvailableFiles.js";
8
+ import { isFileExists } from "../shared/isFileExists.js";
9
+ import { getConfig } from "../shared/getConfig.js";
10
+ import { CONFIG_FILE } from "./init.js";
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ // Get the current file and directory paths
13
+ const __dirname = path.dirname(__filename);
14
+ // Define the path to the templates directory
15
+ const templatesDir = path.resolve(__dirname, "../../../lib/components");
16
+ /**
17
+ * Main function to add a component and its dependencies.
18
+ * @param {string} component - The name of the component to add.
19
+ * @param {boolean} replace - Whether to replace the existing component.
20
+ */
21
+ export async function add(component, replace = false) {
22
+ const targetFile = getConfig(CONFIG_FILE);
23
+ const availableComponents = getAvailableFiles(templatesDir);
24
+ // If no component is provided, prompt the user to select one
25
+ if (!component) {
26
+ component = await promptComponentSelection(availableComponents);
27
+ }
28
+ // Validate if the component exists in the templates directory
29
+ if (!availableComponents.includes(component)) {
30
+ console.error(`❌ Component "${component}" not found.`);
31
+ return;
32
+ }
33
+ const { source, targetDir } = getInstallPaths(component, targetFile, templatesDir, "components");
34
+ // Check if component already exists
35
+ if (isFileExists(targetDir, component) && !replace) {
36
+ console.log(`⚠️ Component "${component}" already exists.`);
37
+ return;
38
+ }
39
+ // Ensure the target directory exists
40
+ // if the directory is not exists, create it
41
+ ensureDirectoryExists(targetDir);
42
+ // Copy the component (directory or file) and install dependencies
43
+ copyComponentsRecursively(source, targetDir);
44
+ console.log(`✅ ${component} has been added to ${targetFile.path}!`);
45
+ }
46
+ /**
47
+ * Prompt the user to select a component from a list.
48
+ * @param {string[]} availableComponents - Array of available components.
49
+ * @returns {string} - The selected component.
50
+ */
51
+ async function promptComponentSelection(availableComponents) {
52
+ const { selectedComponent } = await inquirer.prompt([
53
+ {
54
+ type: "list",
55
+ name: "selectedComponent",
56
+ message: "Which component would you like to add?",
57
+ choices: availableComponents,
58
+ },
59
+ ]);
60
+ return selectedComponent;
61
+ }
62
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../../cli/src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAElD,2CAA2C;AAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,6CAA6C;AAC7C,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC;AAIxE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,SAAkB,EAAE,UAAmB,KAAK;IAClE,MAAM,UAAU,GAAG,SAAS,CAAC,WAAW,CAAW,CAAC;IACpD,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAE5D,6DAA6D;IAC7D,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,SAAS,GAAG,MAAM,wBAAwB,CAAC,mBAAmB,CAAC,CAAC;IACpE,CAAC;IAED,8DAA8D;IAC9D,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3C,OAAO,CAAC,KAAK,CAAC,gBAAgB,SAAS,cAAc,CAAC,CAAC;QACvD,OAAO;IACX,CAAC;IAED,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,eAAe,CAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IAEjG,oCAAoC;IACpC,IAAI,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,iBAAiB,SAAS,mBAAmB,CAAC,CAAC;QAC3D,OAAO;IACX,CAAC;IAED,qCAAqC;IACrC,4CAA4C;IAE5C,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAEjC,kEAAkE;IAClE,yBAAyB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAE7C,OAAO,CAAC,GAAG,CAAC,KAAK,SAAS,sBAAsB,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC;AACxE,CAAC;AAID;;;;GAIG;AACH,KAAK,UAAU,wBAAwB,CAAC,mBAA6B;IACjE,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QAChD;YACI,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,mBAAmB;YACzB,OAAO,EAAE,wCAAwC;YACjD,OAAO,EAAE,mBAAmB;SAC/B;KACJ,CAAC,CAAC;IACH,OAAO,iBAAiB,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Main function to add a hook and its dependencies.
3
+ * @param {string} hook - The name of the hook to add.
4
+ * @param {boolean} replace - Whether to replace the existing hook.
5
+ */
6
+ export declare function addHook(hook?: string, replace?: boolean): Promise<void>;
7
+ //# sourceMappingURL=hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/hook.ts"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BpF"}
@@ -0,0 +1,69 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { fileURLToPath } from "url";
4
+ import inquirer from "inquirer";
5
+ import { ensureDirectoryExists } from "../shared/ensureDirectoryExists.js";
6
+ import { getInstallPaths } from "../shared/getInstallPaths.js";
7
+ import { copyComponentsRecursively } from "../shared/copyComponentsRecursively.js";
8
+ import { getConfig } from "../shared/getConfig.js";
9
+ import { CONFIG_FILE } from "./init.js";
10
+ import { isFileExists } from "../shared/isFileExists.js";
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+ // Define the path to the hooks templates directory
14
+ const hooksTemplatesDir = path.resolve(__dirname, "../../../lib/hooks");
15
+ /**
16
+ * Main function to add a hook and its dependencies.
17
+ * @param {string} hook - The name of the hook to add.
18
+ * @param {boolean} replace - Whether to replace the existing hook.
19
+ */
20
+ export async function addHook(hook, replace = false) {
21
+ const targetFile = getConfig(CONFIG_FILE);
22
+ const availableHooks = getAvailableHooks(hooksTemplatesDir);
23
+ // If no hook is provided, prompt the user to select one
24
+ if (!hook) {
25
+ hook = await promptHookSelection(availableHooks);
26
+ }
27
+ // Validate if the hook exists in the hooks templates directory
28
+ if (!availableHooks.includes(hook)) {
29
+ // console.error(`❌ Hook "${hook}" not found.`);
30
+ return;
31
+ }
32
+ // get the path and create the create the target directory
33
+ const { source, targetDir } = getInstallPaths(hook, targetFile, hooksTemplatesDir, "hooks");
34
+ // Ensure the target directory exists
35
+ ensureDirectoryExists(targetDir);
36
+ // Check if hook already exists
37
+ if (isFileExists(targetDir, hook) && !replace) {
38
+ console.log(`⚠️ Hook "${hook}" already exists.`);
39
+ return;
40
+ }
41
+ // Copy the hook (file) and install dependencies
42
+ copyComponentsRecursively(source, targetDir);
43
+ console.log(`✅ ${hook} has been added to ${targetFile.path}!`);
44
+ }
45
+ /**
46
+ * Get a list of available hooks from the hooks templates directory.
47
+ * @param {string} hooksTemplatesDir - Path to the hooks templates directory.
48
+ * @returns {string[]} - Array of hook names.
49
+ */
50
+ function getAvailableHooks(hooksTemplatesDir) {
51
+ return fs.readdirSync(hooksTemplatesDir).map((file) => path.basename(file));
52
+ }
53
+ /**
54
+ * Prompt the user to select a hook from a list.
55
+ * @param {string[]} availableHooks - Array of available hooks.
56
+ * @returns {string} - The selected hook.
57
+ */
58
+ async function promptHookSelection(availableHooks) {
59
+ const { selectedHook } = await inquirer.prompt([
60
+ {
61
+ type: "list",
62
+ name: "selectedHook",
63
+ message: "Which hook would you like to add?",
64
+ choices: availableHooks,
65
+ },
66
+ ]);
67
+ return selectedHook;
68
+ }
69
+ //# sourceMappingURL=hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook.js","sourceRoot":"","sources":["../../../cli/src/commands/hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,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iB,CAAC,iBAAyB;IAChD,OAAO,EAAE,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AACxF,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,mBAAmB,CAAC,cAAwB;IACvD,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QAC3C;YACI,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,mCAAmC;YAC5C,OAAO,EAAE,cAAc;SAC1B;KACJ,CAAC,CAAC;IACH,OAAO,YAAY,CAAC;AACxB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const CONFIG_FILE = "glare.json";
2
+ export declare function initConfig(): Promise<void>;
3
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/init.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,eAAe,CAAC;AAGxC,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAYhD"}
@@ -0,0 +1,16 @@
1
+ import fs from "fs";
2
+ import { tailwindInit } from "../shared/tailwindInit.js";
3
+ export const CONFIG_FILE = "glare.json";
4
+ export async function initConfig() {
5
+ const defaultConfig = { path: "./" };
6
+ if (!fs.existsSync(CONFIG_FILE)) {
7
+ fs.writeFileSync(CONFIG_FILE, JSON.stringify(defaultConfig, null, 2));
8
+ console.log("✅ Created glare.json configuration file");
9
+ }
10
+ else {
11
+ console.log("⚠️ glare.json already exists, skipping creation.");
12
+ }
13
+ // Initialize Tailwind CSS config if not exists
14
+ tailwindInit();
15
+ }
16
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../cli/src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAMzD,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC;AAGxC,MAAM,CAAC,KAAK,UAAU,UAAU;IAC5B,MAAM,aAAa,GAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAElD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC9B,EAAE,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACtE,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;IAC3D,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;IACpE,CAAC;IAED,+CAA+C;IAC/C,YAAY,EAAE,CAAC;AACnB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Main function to add a layout and its dependencies.
3
+ * @param {string} layout - The name of the layout to add.
4
+ * @param {boolean} replace - Whether to replace the existing layout.
5
+ */
6
+ export declare function addLayout(layout?: string, replace?: boolean): Promise<void>;
7
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/layout.ts"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BxF"}
@@ -0,0 +1,69 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { fileURLToPath } from "url";
4
+ import { copyComponentsRecursively } from "../shared/copyComponentsRecursively.js";
5
+ import inquirer from "inquirer";
6
+ import { getConfig } from "../shared/getConfig.js";
7
+ import { getInstallPaths } from "../shared/getInstallPaths.js";
8
+ import { ensureDirectoryExists } from "../shared/ensureDirectoryExists.js";
9
+ import { CONFIG_FILE } from "./init.js";
10
+ import { isFileExists } from "../shared/isFileExists.js";
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+ // Define the path to the layouts templates directory
14
+ const layoutsTemplatesDir = path.resolve(__dirname, "../../../lib/layouts");
15
+ /**
16
+ * Main function to add a layout and its dependencies.
17
+ * @param {string} layout - The name of the layout to add.
18
+ * @param {boolean} replace - Whether to replace the existing layout.
19
+ */
20
+ export async function addLayout(layout, replace = false) {
21
+ const targetFile = getConfig(CONFIG_FILE);
22
+ const availableLayouts = getAvailableLayouts(layoutsTemplatesDir);
23
+ // If no layout is provided, prompt the user to select one
24
+ if (!layout) {
25
+ layout = await promptLayoutSelection(availableLayouts);
26
+ }
27
+ // Validate if the layout exists in the layouts templates directory
28
+ if (!availableLayouts.includes(layout)) {
29
+ // console.error(`❌ Layout "${layout}" not found.`);
30
+ return;
31
+ }
32
+ // get the path and create the create the target directory
33
+ const { source, targetDir } = getInstallPaths(layout, targetFile, layoutsTemplatesDir, "layouts");
34
+ // Ensure the target directory exists
35
+ ensureDirectoryExists(targetDir);
36
+ // Check if layout already exists
37
+ if (isFileExists(targetDir, layout) && !replace) {
38
+ console.log(`⚠️ Layout "${layout}" already exists.`);
39
+ return;
40
+ }
41
+ // Copy the layout (file) and install dependencies
42
+ copyComponentsRecursively(source, targetDir);
43
+ console.log(`✅ ${layout} has been added to ${targetFile.path}!`);
44
+ }
45
+ /**
46
+ * Get a list of available layouts from the layouts templates directory.
47
+ * @param {string} layoutsTemplatesDir - Path to the layouts templates directory.
48
+ * @returns {string[]} - Array of layout names.
49
+ */
50
+ function getAvailableLayouts(layoutsTemplatesDir) {
51
+ return fs.readdirSync(layoutsTemplatesDir).map((file) => path.basename(file));
52
+ }
53
+ /**
54
+ * Prompt the user to select a layout from a list.
55
+ * @param {string[]} availableLayouts - Array of available layouts.
56
+ * @returns {string} - The selected layout.
57
+ */
58
+ async function promptLayoutSelection(availableLayouts) {
59
+ const { selectedLayout } = await inquirer.prompt([
60
+ {
61
+ type: "list",
62
+ name: "selectedLayout",
63
+ message: "Which layout would you like to add?",
64
+ choices: availableLayouts,
65
+ },
66
+ ]);
67
+ return selectedLayout;
68
+ }
69
+ //# sourceMappingURL=layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../cli/src/commands/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,qDAAqD;AACrD,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC;AAE5E;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAAe,EAAE,UAAmB,KAAK;IACrE,MAAM,UAAU,GAAG,SAAS,CAAC,WAAW,CAAW,CAAC;IACpD,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;IAElE,0DAA0D;I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,cAAc,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Main function to add a provider and its dependencies.
3
+ * @param {string} provider - The name of the provider to add.
4
+ * @param {boolean} replace - Whether to replace the existing provider.
5
+ */
6
+ export declare function addProvider(provider?: string, replace?: boolean): Promise<void>;
7
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/provider.ts"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA8B5F"}
@@ -0,0 +1,69 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { getConfig } from "../shared/getConfig.js";
4
+ import { CONFIG_FILE } from "./init.js";
5
+ import { fileURLToPath } from "url";
6
+ import { ensureDirectoryExists } from "../shared/ensureDirectoryExists.js";
7
+ import { getInstallPaths } from "../shared/getInstallPaths.js";
8
+ import { copyComponentsRecursively } from "../shared/copyComponentsRecursively.js";
9
+ import inquirer from "inquirer";
10
+ import { isFileExists } from "../shared/isFileExists.js";
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+ // Define the path to the provider templates directory
14
+ const providerTemplatesDir = path.resolve(__dirname, "../../../lib/providers");
15
+ /**
16
+ * Main function to add a provider and its dependencies.
17
+ * @param {string} provider - The name of the provider to add.
18
+ * @param {boolean} replace - Whether to replace the existing provider.
19
+ */
20
+ export async function addProvider(provider, replace = false) {
21
+ const targetFile = getConfig(CONFIG_FILE);
22
+ const availableProviders = getAvailableProviders(providerTemplatesDir);
23
+ // If no provider is provided, prompt the user to select one
24
+ if (!provider) {
25
+ provider = await promptProviderSelection(availableProviders);
26
+ }
27
+ // Validate if the provider exists in the provider templates directory
28
+ if (!availableProviders.includes(provider)) {
29
+ console.error(`❌ Provider "${provider}" not found.`);
30
+ return;
31
+ }
32
+ // Get the path and create the target directory
33
+ const { source, targetDir } = getInstallPaths(provider, targetFile, providerTemplatesDir, "providers");
34
+ // Ensure the target directory exists
35
+ ensureDirectoryExists(targetDir);
36
+ // Check if provider already exists
37
+ if (isFileExists(targetDir, provider) && !replace) {
38
+ console.log(`⚠️ Provider "${provider}" already exists.`);
39
+ return;
40
+ }
41
+ // Copy the provider (file or directory) and install dependencies
42
+ copyComponentsRecursively(source, targetDir);
43
+ console.log(`✅ ${provider} has been added to ${targetFile.path}!`);
44
+ }
45
+ /**
46
+ * Get a list of available providers from the provider templates directory.
47
+ * @param {string} providerTemplatesDir - Path to the provider templates directory.
48
+ * @returns {string[]} - Array of provider names.
49
+ */
50
+ function getAvailableProviders(providerTemplatesDir) {
51
+ return fs.readdirSync(providerTemplatesDir).map((file) => path.basename(file));
52
+ }
53
+ /**
54
+ * Prompt the user to select a provider from a list.
55
+ * @param {string[]} availableProviders - Array of available providers.
56
+ * @returns {string} - The selected provider.
57
+ */
58
+ async function promptProviderSelection(availableProviders) {
59
+ const { selectedProvider } = await inquirer.prompt([
60
+ {
61
+ type: "list",
62
+ name: "selectedProvider",
63
+ message: "Which provider would you like to add?",
64
+ choices: availableProviders,
65
+ },
66
+ ]);
67
+ return selectedProvider;
68
+ }
69
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../cli/src/commands/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAA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CAAC,CAAC;QACzD,OAAO;IACX,CAAC;IAED,iEAAiE;IACjE,yBAAyB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAE7C,OAAO,CAAC,GAAG,CAAC,KAAK,QAAQ,sBAAsB,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC;AACvE,CAAC;AAED;;;;GAIG;AACH,SAAS,qBAAqB,CAAC,oBAA4B;IACvD,OAAO,EAAE,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AACnF,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,uBAAuB,CAAC,kBAA4B;IAC/D,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QAC/C;YACI,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE,uCAAuC;YAChD,OAAO,EAAE,kBAAkB;SAC9B;KACJ,CAAC,CAAC;IACH,OAAO,gBAAgB,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Update all installed components, hooks, and utility files by syncing them with the latest templates.
3
+ */
4
+ export declare function updateInstalledComponents(): Promise<void>;
5
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/update.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAwC/D"}