torch-glare 1.1.8 → 1.1.9

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 (149) hide show
  1. package/dist/bin/index.d.ts +3 -0
  2. package/dist/bin/index.d.ts.map +1 -0
  3. package/dist/bin/index.js +44 -0
  4. package/dist/bin/index.js.map +1 -0
  5. package/dist/src/commands/add.d.ts +7 -0
  6. package/dist/src/commands/add.d.ts.map +1 -0
  7. package/dist/src/commands/add.js +62 -0
  8. package/dist/src/commands/add.js.map +1 -0
  9. package/dist/src/commands/hook.d.ts +7 -0
  10. package/dist/src/commands/hook.d.ts.map +1 -0
  11. package/dist/src/commands/hook.js +69 -0
  12. package/dist/src/commands/hook.js.map +1 -0
  13. package/dist/src/commands/init.d.ts +3 -0
  14. package/dist/src/commands/init.d.ts.map +1 -0
  15. package/dist/src/commands/init.js +16 -0
  16. package/dist/src/commands/init.js.map +1 -0
  17. package/dist/src/commands/layout.d.ts +7 -0
  18. package/dist/src/commands/layout.d.ts.map +1 -0
  19. package/dist/src/commands/layout.js +69 -0
  20. package/dist/src/commands/layout.js.map +1 -0
  21. package/dist/src/commands/provider.d.ts +7 -0
  22. package/dist/src/commands/provider.d.ts.map +1 -0
  23. package/dist/src/commands/provider.js +69 -0
  24. package/dist/src/commands/provider.js.map +1 -0
  25. package/dist/src/commands/update.d.ts +5 -0
  26. package/dist/src/commands/update.d.ts.map +1 -0
  27. package/dist/src/commands/update.js +113 -0
  28. package/dist/src/commands/update.js.map +1 -0
  29. package/dist/src/commands/utils.d.ts +7 -0
  30. package/dist/src/commands/utils.d.ts.map +1 -0
  31. package/dist/src/commands/utils.js +71 -0
  32. package/dist/src/commands/utils.js.map +1 -0
  33. package/dist/src/shared/copyComponentsRecursively.d.ts +13 -0
  34. package/dist/src/shared/copyComponentsRecursively.d.ts.map +1 -0
  35. package/dist/src/shared/copyComponentsRecursively.js +44 -0
  36. package/dist/src/shared/copyComponentsRecursively.js.map +1 -0
  37. package/dist/src/shared/detectPackageManager.d.ts +6 -0
  38. package/dist/src/shared/detectPackageManager.d.ts.map +1 -0
  39. package/dist/src/shared/detectPackageManager.js +20 -0
  40. package/dist/src/shared/detectPackageManager.js.map +1 -0
  41. package/dist/src/shared/ensureDirectoryExists.d.ts +2 -0
  42. package/dist/src/shared/ensureDirectoryExists.d.ts.map +1 -0
  43. package/dist/src/shared/ensureDirectoryExists.js +11 -0
  44. package/dist/src/shared/ensureDirectoryExists.js.map +1 -0
  45. package/dist/src/shared/getAvailableFiles.d.ts +7 -0
  46. package/dist/src/shared/getAvailableFiles.d.ts.map +1 -0
  47. package/dist/src/shared/getAvailableFiles.js +11 -0
  48. package/dist/src/shared/getAvailableFiles.js.map +1 -0
  49. package/dist/src/shared/getConfig.d.ts +2 -0
  50. package/dist/src/shared/getConfig.d.ts.map +1 -0
  51. package/dist/src/shared/getConfig.js +15 -0
  52. package/dist/src/shared/getConfig.js.map +1 -0
  53. package/dist/src/shared/getCurrentInstalledDependencies.d.ts +7 -0
  54. package/dist/src/shared/getCurrentInstalledDependencies.d.ts.map +1 -0
  55. package/dist/src/shared/getCurrentInstalledDependencies.js +24 -0
  56. package/dist/src/shared/getCurrentInstalledDependencies.js.map +1 -0
  57. package/dist/src/shared/getDependenciesAndInstallNestedComponents.d.ts +8 -0
  58. package/dist/src/shared/getDependenciesAndInstallNestedComponents.d.ts.map +1 -0
  59. package/dist/src/shared/getDependenciesAndInstallNestedComponents.js +50 -0
  60. package/dist/src/shared/getDependenciesAndInstallNestedComponents.js.map +1 -0
  61. package/dist/src/shared/getInstallCommand.d.ts +8 -0
  62. package/dist/src/shared/getInstallCommand.d.ts.map +1 -0
  63. package/dist/src/shared/getInstallCommand.js +18 -0
  64. package/dist/src/shared/getInstallCommand.js.map +1 -0
  65. package/dist/src/shared/getInstallPaths.d.ts +14 -0
  66. package/dist/src/shared/getInstallPaths.d.ts.map +1 -0
  67. package/dist/src/shared/getInstallPaths.js +16 -0
  68. package/dist/src/shared/getInstallPaths.js.map +1 -0
  69. package/dist/src/shared/installDependencies.d.ts +6 -0
  70. package/dist/src/shared/installDependencies.d.ts.map +1 -0
  71. package/dist/src/shared/installDependencies.js +36 -0
  72. package/dist/src/shared/installDependencies.js.map +1 -0
  73. package/dist/src/shared/isFileExists.d.ts +7 -0
  74. package/dist/src/shared/isFileExists.d.ts.map +1 -0
  75. package/dist/src/shared/isFileExists.js +10 -0
  76. package/dist/src/shared/isFileExists.js.map +1 -0
  77. package/dist/src/shared/tailwindInit.d.ts +2 -0
  78. package/dist/src/shared/tailwindInit.d.ts.map +1 -0
  79. package/dist/src/shared/tailwindInit.js +76 -0
  80. package/dist/src/shared/tailwindInit.js.map +1 -0
  81. package/dist/src/types/main.d.ts +8 -0
  82. package/dist/src/types/main.d.ts.map +1 -0
  83. package/dist/src/types/main.js +2 -0
  84. package/dist/src/types/main.js.map +1 -0
  85. package/lib/components/ActionButton.tsx +65 -0
  86. package/lib/components/ActionsGroup.tsx +38 -0
  87. package/lib/components/AlertDialog.tsx +222 -0
  88. package/lib/components/Avatar.tsx +49 -0
  89. package/lib/components/Badge.tsx +116 -0
  90. package/lib/components/BadgeField.tsx +203 -0
  91. package/lib/components/Button.tsx +265 -0
  92. package/lib/components/Calendar.tsx +102 -0
  93. package/lib/components/Card.tsx +64 -0
  94. package/lib/components/Checkbox.tsx +49 -0
  95. package/lib/components/CountBadge.tsx +54 -0
  96. package/lib/components/DataTable.tsx +233 -0
  97. package/lib/components/DatePicker.tsx +223 -0
  98. package/lib/components/Dialog.tsx +129 -0
  99. package/lib/components/Divider.tsx +31 -0
  100. package/lib/components/Drawer.tsx +118 -0
  101. package/lib/components/DropdownMenu.tsx +399 -0
  102. package/lib/components/FieldHint.tsx +76 -0
  103. package/lib/components/Form.tsx +191 -0
  104. package/lib/components/ImageAttachment.tsx +196 -0
  105. package/lib/components/InnerLabelField.tsx +150 -0
  106. package/lib/components/Input.tsx +207 -0
  107. package/lib/components/InputField.tsx +149 -0
  108. package/lib/components/InputOTP.tsx +85 -0
  109. package/lib/components/Label.tsx +126 -0
  110. package/lib/components/LabelField.tsx +77 -0
  111. package/lib/components/LabeledCheckBox.tsx +55 -0
  112. package/lib/components/LabeledRadio.tsx +49 -0
  113. package/lib/components/LinkButton.tsx +93 -0
  114. package/lib/components/LoginButton.tsx +56 -0
  115. package/lib/components/PasswordLevel.tsx +58 -0
  116. package/lib/components/Popover.tsx +274 -0
  117. package/lib/components/ProfileMenu.tsx +90 -0
  118. package/lib/components/Radio.tsx +66 -0
  119. package/lib/components/RadioCard.tsx +67 -0
  120. package/lib/components/ScrollArea.tsx +52 -0
  121. package/lib/components/SearchField.tsx +52 -0
  122. package/lib/components/Select.tsx +419 -0
  123. package/lib/components/SimpleSelect.tsx +216 -0
  124. package/lib/components/Skeleton.tsx +15 -0
  125. package/lib/components/SlideDatePicker.tsx +193 -0
  126. package/lib/components/SpinLoading.tsx +190 -0
  127. package/lib/components/Switch.tsx +82 -0
  128. package/lib/components/TabFormItem.tsx +162 -0
  129. package/lib/components/Table.tsx +398 -0
  130. package/lib/components/Test.tsx +11 -0
  131. package/lib/components/Textarea.tsx +96 -0
  132. package/lib/components/Toast.tsx +87 -0
  133. package/lib/components/Toggle.tsx +127 -0
  134. package/lib/components/Tooltip.tsx +111 -0
  135. package/lib/components/TransparentLabel.tsx +72 -0
  136. package/lib/components/TreeDropDown.tsx +69 -0
  137. package/lib/hooks/useActiveTreeItem.ts +61 -0
  138. package/lib/hooks/useClickOutside.ts +26 -0
  139. package/lib/hooks/useResize.ts +78 -0
  140. package/lib/hooks/useTagSelection.ts +214 -0
  141. package/lib/layouts/CNLayout.tsx +331 -0
  142. package/lib/layouts/FieldSection.tsx +64 -0
  143. package/lib/layouts/TreeSubLayout.tsx +187 -0
  144. package/lib/providers/ThemeProvider.tsx +99 -0
  145. package/lib/utils/cn.ts +6 -0
  146. package/lib/utils/dateFormat.ts +98 -0
  147. package/lib/utils/resize.ts +35 -0
  148. package/lib/utils/types.ts +12 -0
  149. package/package.json +1 -1
@@ -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,OA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AC,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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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,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,mDAAmD;AACnD,MAAM,iBAAiB,GAAW,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,oBAAoB,C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AwB;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,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;IAED,0DAA0D;IAC1D,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,SAAS,CAAC,CAAC;IAClG,qCAAqC;IACrC,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAEjC,iCAAiC;IACjC,IAAI,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,cAAc,MAAM,mBAAmB,CAAC,CAAC;QACrD,OAAO;IACX,CAAC;IAED,kDAAkD;IAClD,yBAAyB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAE7C,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,sBAAsB,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC;AACrE,CAAC;AAED;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,mBAA2B;IACpD,OAAO,EAAE,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAClF,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,qBAAqB,CAAC,gBAA0B;IAC3D,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QAC7C;YACI,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,qCAAqC;YAC9C,OAAO,EAAE,gBAAgB;SAC5B;KACJ,CAAC,CAAC;IACH,OAAO,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,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,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BAAqB,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"}
@@ -0,0 +1,113 @@
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 { tailwindInit } from "../shared/tailwindInit.js";
6
+ import readline from "readline";
7
+ import { getAvailableFiles } from "../shared/getAvailableFiles.js";
8
+ import { add } from "./add.js";
9
+ import { addHook } from "./hook.js";
10
+ import { addUtil } from "./utils.js";
11
+ import { addProvider } from "./provider.js";
12
+ import { addLayout } from "./layout.js";
13
+ /**
14
+ * Update all installed components, hooks, and utility files by syncing them with the latest templates.
15
+ */
16
+ export async function updateInstalledComponents() {
17
+ const targetFile = getConfig(CONFIG_FILE);
18
+ // Ask the user if they are sure about updating
19
+ const rl = readline.createInterface({
20
+ input: process.stdin,
21
+ output: process.stdout,
22
+ });
23
+ const answer = await new Promise((resolve) => {
24
+ rl.question("Are you sure you want to update all installed components, hooks, and utils? (y/n): ", (input) => {
25
+ resolve(input.trim().toLowerCase());
26
+ });
27
+ });
28
+ rl.close();
29
+ if (answer !== "y") {
30
+ console.log("Update cancelled.");
31
+ return;
32
+ }
33
+ // Update components
34
+ await updateItems("components", targetFile);
35
+ // Update hooks
36
+ await updateItems("hooks", targetFile);
37
+ // Update utils
38
+ await updateItems("utils", targetFile);
39
+ // Update providers
40
+ await updateItems("providers", targetFile);
41
+ // Update layouts
42
+ await updateItems("layouts", targetFile);
43
+ // Reinitialize Tailwind CSS configuration
44
+ tailwindInit();
45
+ console.log("✅ All installed items have been updated.");
46
+ }
47
+ /**
48
+ * Update items (components, hooks, or utils) by syncing them with the latest templates.
49
+ * @param {string} type - The type of items to update (e.g., "components", "hooks", "utils").
50
+ * @param {object} config - Configuration object.
51
+ */
52
+ async function updateItems(type, config) {
53
+ const installedItemsDir = getInstalledItemsDir(config, type);
54
+ // Exit if no installed items are found
55
+ if (!checkIfItemsExist(installedItemsDir, type)) {
56
+ return;
57
+ }
58
+ // Get the list of installed items
59
+ const installedItems = getAvailableFiles(installedItemsDir);
60
+ // Exit if there are no items to update
61
+ if (installedItems.length === 0) {
62
+ console.log(`✅ No ${type} to update.`);
63
+ return;
64
+ }
65
+ console.log(`🔄 Updating installed ${type}...`);
66
+ // Update each installed item
67
+ installedItems.forEach((item) => {
68
+ switch (type) {
69
+ case "components":
70
+ add(item, true);
71
+ break;
72
+ case "hooks":
73
+ addHook(item, true);
74
+ break;
75
+ case "utils":
76
+ addUtil(item, true);
77
+ break;
78
+ case "providers":
79
+ addProvider(item, true);
80
+ break;
81
+ case "layouts":
82
+ addLayout(item, true);
83
+ break;
84
+ default:
85
+ console.log(`❌ Unknown item type: ${type}`);
86
+ break;
87
+ }
88
+ });
89
+ }
90
+ /**
91
+ * Get the directory path for installed items (components, hooks, or utils).
92
+ * @param {object} config - Configuration object.
93
+ * @param {string} type - The type of items (e.g., "components", "hooks", "utils").
94
+ * @returns {string} - Path to the installed items directory.
95
+ */
96
+ function getInstalledItemsDir(config, type) {
97
+ const normalizedPath = config.path.replace("@/", "");
98
+ return path.join(process.cwd(), normalizedPath, type);
99
+ }
100
+ /**
101
+ * Check if the installed items directory exists.
102
+ * @param {string} installedItemsDir - Path to the installed items directory.
103
+ * @param {string} type - The type of items being checked.
104
+ * @returns {boolean} - True if the directory exists, false otherwise.
105
+ */
106
+ function checkIfItemsExist(installedItemsDir, type) {
107
+ if (!fs.existsSync(installedItemsDir)) {
108
+ console.log(`❌ No installed ${type} found.`);
109
+ return false;
110
+ }
111
+ return true;
112
+ }
113
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../cli/src/commands/update.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,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB;IAC3C,MAAM,UAAU,GAAG,SAAS,CAAC,WAAW,C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AAiB,CAAC,iBAAyB,EAAE,IAAY;IAC9D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,SAAS,CAAC,CAAC;QAC7C,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Main function to add a utility file and its dependencies.
3
+ * @param {string} util - The name of the utility file to add.
4
+ * @param {boolean} replace - Whether to replace the existing utility file.
5
+ */
6
+ export declare function addUtil(util?: string, replace?: boolean): Promise<void>;
7
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/utils.ts"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAkCpF"}