torch-glare 1.1.14 → 1.2.7
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.
- package/lib/components/TreeDropDown.tsx +69 -0
- package/package.json +4 -5
- package/dist/bin/index.d.ts +0 -3
- package/dist/bin/index.d.ts.map +0 -1
- package/dist/bin/index.js +0 -44
- package/dist/bin/index.js.map +0 -1
- package/dist/src/commands/add.d.ts +0 -7
- package/dist/src/commands/add.d.ts.map +0 -1
- package/dist/src/commands/add.js +0 -62
- package/dist/src/commands/add.js.map +0 -1
- package/dist/src/commands/hook.d.ts +0 -7
- package/dist/src/commands/hook.d.ts.map +0 -1
- package/dist/src/commands/hook.js +0 -69
- package/dist/src/commands/hook.js.map +0 -1
- package/dist/src/commands/init.d.ts +0 -3
- package/dist/src/commands/init.d.ts.map +0 -1
- package/dist/src/commands/init.js +0 -16
- package/dist/src/commands/init.js.map +0 -1
- package/dist/src/commands/layout.d.ts +0 -7
- package/dist/src/commands/layout.d.ts.map +0 -1
- package/dist/src/commands/layout.js +0 -69
- package/dist/src/commands/layout.js.map +0 -1
- package/dist/src/commands/provider.d.ts +0 -7
- package/dist/src/commands/provider.d.ts.map +0 -1
- package/dist/src/commands/provider.js +0 -69
- package/dist/src/commands/provider.js.map +0 -1
- package/dist/src/commands/update.d.ts +0 -5
- package/dist/src/commands/update.d.ts.map +0 -1
- package/dist/src/commands/update.js +0 -113
- package/dist/src/commands/update.js.map +0 -1
- package/dist/src/commands/utils.d.ts +0 -7
- package/dist/src/commands/utils.d.ts.map +0 -1
- package/dist/src/commands/utils.js +0 -71
- package/dist/src/commands/utils.js.map +0 -1
- package/dist/src/shared/copyComponentsRecursively.d.ts +0 -13
- package/dist/src/shared/copyComponentsRecursively.d.ts.map +0 -1
- package/dist/src/shared/copyComponentsRecursively.js +0 -44
- package/dist/src/shared/copyComponentsRecursively.js.map +0 -1
- package/dist/src/shared/detectPackageManager.d.ts +0 -6
- package/dist/src/shared/detectPackageManager.d.ts.map +0 -1
- package/dist/src/shared/detectPackageManager.js +0 -20
- package/dist/src/shared/detectPackageManager.js.map +0 -1
- package/dist/src/shared/ensureDirectoryExists.d.ts +0 -2
- package/dist/src/shared/ensureDirectoryExists.d.ts.map +0 -1
- package/dist/src/shared/ensureDirectoryExists.js +0 -11
- package/dist/src/shared/ensureDirectoryExists.js.map +0 -1
- package/dist/src/shared/getAvailableFiles.d.ts +0 -7
- package/dist/src/shared/getAvailableFiles.d.ts.map +0 -1
- package/dist/src/shared/getAvailableFiles.js +0 -11
- package/dist/src/shared/getAvailableFiles.js.map +0 -1
- package/dist/src/shared/getConfig.d.ts +0 -2
- package/dist/src/shared/getConfig.d.ts.map +0 -1
- package/dist/src/shared/getConfig.js +0 -15
- package/dist/src/shared/getConfig.js.map +0 -1
- package/dist/src/shared/getCurrentInstalledDependencies.d.ts +0 -7
- package/dist/src/shared/getCurrentInstalledDependencies.d.ts.map +0 -1
- package/dist/src/shared/getCurrentInstalledDependencies.js +0 -24
- package/dist/src/shared/getCurrentInstalledDependencies.js.map +0 -1
- package/dist/src/shared/getDependenciesAndInstallNestedComponents.d.ts +0 -8
- package/dist/src/shared/getDependenciesAndInstallNestedComponents.d.ts.map +0 -1
- package/dist/src/shared/getDependenciesAndInstallNestedComponents.js +0 -50
- package/dist/src/shared/getDependenciesAndInstallNestedComponents.js.map +0 -1
- package/dist/src/shared/getInstallCommand.d.ts +0 -8
- package/dist/src/shared/getInstallCommand.d.ts.map +0 -1
- package/dist/src/shared/getInstallCommand.js +0 -18
- package/dist/src/shared/getInstallCommand.js.map +0 -1
- package/dist/src/shared/getInstallPaths.d.ts +0 -14
- package/dist/src/shared/getInstallPaths.d.ts.map +0 -1
- package/dist/src/shared/getInstallPaths.js +0 -16
- package/dist/src/shared/getInstallPaths.js.map +0 -1
- package/dist/src/shared/installDependencies.d.ts +0 -6
- package/dist/src/shared/installDependencies.d.ts.map +0 -1
- package/dist/src/shared/installDependencies.js +0 -36
- package/dist/src/shared/installDependencies.js.map +0 -1
- package/dist/src/shared/isFileExists.d.ts +0 -7
- package/dist/src/shared/isFileExists.d.ts.map +0 -1
- package/dist/src/shared/isFileExists.js +0 -10
- package/dist/src/shared/isFileExists.js.map +0 -1
- package/dist/src/shared/tailwindInit.d.ts +0 -2
- package/dist/src/shared/tailwindInit.d.ts.map +0 -1
- package/dist/src/shared/tailwindInit.js +0 -76
- package/dist/src/shared/tailwindInit.js.map +0 -1
- package/dist/src/types/main.d.ts +0 -8
- package/dist/src/types/main.d.ts.map +0 -1
- package/dist/src/types/main.js +0 -2
- package/dist/src/types/main.js.map +0 -1
- /package/{apps/lib → lib}/components/ActionButton.tsx +0 -0
- /package/{apps/lib → lib}/components/ActionsGroup.tsx +0 -0
- /package/{apps/lib → lib}/components/AlertDialog.tsx +0 -0
- /package/{apps/lib → lib}/components/Avatar.tsx +0 -0
- /package/{apps/lib → lib}/components/Badge.tsx +0 -0
- /package/{apps/lib → lib}/components/BadgeField.tsx +0 -0
- /package/{apps/lib → lib}/components/Button.tsx +0 -0
- /package/{apps/lib → lib}/components/Calendar.tsx +0 -0
- /package/{apps/lib → lib}/components/Card.tsx +0 -0
- /package/{apps/lib → lib}/components/Checkbox.tsx +0 -0
- /package/{apps/lib → lib}/components/CountBadge.tsx +0 -0
- /package/{apps/lib → lib}/components/DataTable.tsx +0 -0
- /package/{apps/lib → lib}/components/DatePicker.tsx +0 -0
- /package/{apps/lib → lib}/components/Dialog.tsx +0 -0
- /package/{apps/lib → lib}/components/Divider.tsx +0 -0
- /package/{apps/lib → lib}/components/Drawer.tsx +0 -0
- /package/{apps/lib → lib}/components/DropdownMenu.tsx +0 -0
- /package/{apps/lib → lib}/components/FieldHint.tsx +0 -0
- /package/{apps/lib → lib}/components/Form.tsx +0 -0
- /package/{apps/lib → lib}/components/ImageAttachment.tsx +0 -0
- /package/{apps/lib → lib}/components/InnerLabelField.tsx +0 -0
- /package/{apps/lib → lib}/components/Input.tsx +0 -0
- /package/{apps/lib → lib}/components/InputField.tsx +0 -0
- /package/{apps/lib → lib}/components/InputOTP.tsx +0 -0
- /package/{apps/lib → lib}/components/Label.tsx +0 -0
- /package/{apps/lib → lib}/components/LabelField.tsx +0 -0
- /package/{apps/lib → lib}/components/LabeledCheckBox.tsx +0 -0
- /package/{apps/lib → lib}/components/LabeledRadio.tsx +0 -0
- /package/{apps/lib → lib}/components/LinkButton.tsx +0 -0
- /package/{apps/lib → lib}/components/LoginButton.tsx +0 -0
- /package/{apps/lib → lib}/components/PasswordLevel.tsx +0 -0
- /package/{apps/lib → lib}/components/Popover.tsx +0 -0
- /package/{apps/lib → lib}/components/ProfileMenu.tsx +0 -0
- /package/{apps/lib → lib}/components/Radio.tsx +0 -0
- /package/{apps/lib → lib}/components/RadioCard.tsx +0 -0
- /package/{apps/lib → lib}/components/ScrollArea.tsx +0 -0
- /package/{apps/lib → lib}/components/SearchField.tsx +0 -0
- /package/{apps/lib → lib}/components/Select.tsx +0 -0
- /package/{apps/lib → lib}/components/SimpleSelect.tsx +0 -0
- /package/{apps/lib → lib}/components/Skeleton.tsx +0 -0
- /package/{apps/lib → lib}/components/SlideDatePicker.tsx +0 -0
- /package/{apps/lib → lib}/components/SpinLoading.tsx +0 -0
- /package/{apps/lib → lib}/components/Switch.tsx +0 -0
- /package/{apps/lib → lib}/components/TabFormItem.tsx +0 -0
- /package/{apps/lib → lib}/components/Table.tsx +0 -0
- /package/{apps/lib → lib}/components/Textarea.tsx +0 -0
- /package/{apps/lib → lib}/components/Toast.tsx +0 -0
- /package/{apps/lib → lib}/components/Toggle.tsx +0 -0
- /package/{apps/lib → lib}/components/Tooltip.tsx +0 -0
- /package/{apps/lib → lib}/components/TransparentLabel.tsx +0 -0
- /package/{apps/lib/components/TreeDropDown.tsx → lib/components/TreeDropDown-dev.tsx} +0 -0
- /package/{apps/lib → lib}/hooks/useActiveTreeItem.ts +0 -0
- /package/{apps/lib → lib}/hooks/useClickOutside.ts +0 -0
- /package/{apps/lib → lib}/hooks/useResize.ts +0 -0
- /package/{apps/lib → lib}/hooks/useTagSelection.ts +0 -0
- /package/{apps/lib → lib}/layouts/CNLayout.tsx +0 -0
- /package/{apps/lib → lib}/layouts/FieldSection.tsx +0 -0
- /package/{apps/lib → lib}/layouts/TreeSubLayout.tsx +0 -0
- /package/{apps/lib → lib}/providers/ThemeProvider.tsx +0 -0
- /package/{apps/lib → lib}/utils/cn.ts +0 -0
- /package/{apps/lib → lib}/utils/dateFormat.ts +0 -0
- /package/{apps/lib → lib}/utils/resize.ts +0 -0
- /package/{apps/lib → lib}/utils/types.ts +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { cn } from "../utils/cn";
|
|
3
|
+
import { cva, VariantProps } from "class-variance-authority";
|
|
4
|
+
import { HTMLAttributes, ReactNode, useEffect, useState } from "react";
|
|
5
|
+
|
|
6
|
+
const TreeDropDownVariants = cva(["cursor-pointer flex px-[6px] h-[40px] gap-2 justify-start items-center w-full",
|
|
7
|
+
"text-content-system-global-primary border-l-[2px] rtl:border-r-[2px] border-transparent outline-none",
|
|
8
|
+
"hover:bg-white-alpha-075 hover:border-black-300 hover:text-content-system-action-primary-hover hover:gap-[14px]",
|
|
9
|
+
"rounded-r-[4px] text-start whitespace-nowrap transition-all duration-150 ease-in-out",
|
|
10
|
+
], {
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
secondary: "",
|
|
14
|
+
default: ""
|
|
15
|
+
},
|
|
16
|
+
active: {
|
|
17
|
+
true: "hover:gap-[8px]"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
compoundVariants: [
|
|
21
|
+
{
|
|
22
|
+
active: true,
|
|
23
|
+
variant: "default",
|
|
24
|
+
className: [
|
|
25
|
+
"bg-background-system-action-primary-hover border-border-system-action-primary-hover [&_button]:bg-purple-alpha-15 hover:bg-background-system-action-primary-hover hover:border-border-system-action-primary-hover",
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
active: true,
|
|
30
|
+
variant: "secondary",
|
|
31
|
+
className: [
|
|
32
|
+
"bg-wavy-navy-1000 border-border-system-action-field-hover-selected [&_button]:bg-blue-sparkle-alpha-15 hover:bg-wavy-navy-1000 hover:border-border-system-action-field-hover-selected",
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
defaultVariants: {},//
|
|
37
|
+
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
interface Props extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof TreeDropDownVariants> {
|
|
41
|
+
theme?: "dark" | "light" | "default";
|
|
42
|
+
treeLabel: ReactNode;
|
|
43
|
+
open?: boolean;
|
|
44
|
+
variant?: "secondary" | "default";
|
|
45
|
+
childrenContainerClassName?: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const TreeDropDown = ({ childrenContainerClassName, className, variant = "secondary", treeLabel, open, theme, ...props }: Props) => {
|
|
49
|
+
const [isActive, setIsActive] = useState(open);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
setIsActive(open)
|
|
52
|
+
}, [open])
|
|
53
|
+
return (
|
|
54
|
+
<div {...props} className={cn("flex h-fit flex-col transition-all ease-in-out duration-500",)}>
|
|
55
|
+
<div onClick={() => setIsActive(!isActive)} data-theme={theme} className={cn(TreeDropDownVariants({ variant, active: isActive }), className)}>
|
|
56
|
+
<button className={cn("cursor-pointer outline-none border-none flex-0 leading-0 transition-transform ease-in-out flex justify-center items-center bg-background-system-body-tertiary h-[28px] w-[28px] rounded-full text-[20px] text-content-system-global-primary", { "rotate-180": isActive })}>
|
|
57
|
+
<i className={cn("leading-none ri-arrow-down-s-line ")}></i>
|
|
58
|
+
</button>
|
|
59
|
+
<div className={cn("text-content-system-global-primary typography-body-medium-medium transition-all ease-in-out duration-100 flex-1 cursor-pointer")}>{treeLabel}</div>
|
|
60
|
+
</div>
|
|
61
|
+
<div className={cn("mt-0 pl-[22px] relative overflow-auto scrollbar-hide transition-all duration-500 ease-in-out", {
|
|
62
|
+
"max-h-[20000px] mt-1": isActive, "max-h-0": !isActive,
|
|
63
|
+
})}>
|
|
64
|
+
<span className="h-full w-[1px] bg-border-system-global-primary absolute left-[21px] top-0 rounded-sm z-10" />
|
|
65
|
+
<div className={cn("h-full flex flex-col gap-1 w-full", childrenContainerClassName)}>{props.children}</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "torch-glare",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
8
|
-
"
|
|
9
|
-
"docs"
|
|
10
|
-
"!**/*-dev.*"
|
|
8
|
+
"lib",
|
|
9
|
+
"docs"
|
|
11
10
|
],
|
|
12
11
|
"bin": {
|
|
13
12
|
"torch-glare": "dist/bin/index.js"
|
|
@@ -17,7 +16,7 @@
|
|
|
17
16
|
},
|
|
18
17
|
"scripts": {
|
|
19
18
|
"build": "tsc -b",
|
|
20
|
-
"deploy": "
|
|
19
|
+
"deploy": "tsc && node ./scripts/bin/publish/index.js"
|
|
21
20
|
},
|
|
22
21
|
"dependencies": {
|
|
23
22
|
"commander": "^13.1.0",
|
package/dist/bin/index.d.ts
DELETED
package/dist/bin/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../cli/bin/index.ts"],"names":[],"mappings":""}
|
package/dist/bin/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
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
|
package/dist/bin/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../cli/bin/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,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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"}
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/src/commands/add.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
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, "../../../apps/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
|
|
@@ -1 +0,0 @@
|
|
|
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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AAC,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"}
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,69 +0,0 @@
|
|
|
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, "../../../apps/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
|
|
@@ -1 +0,0 @@
|
|
|
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,yBAAyB,CAAC,CAAC;AAErF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAa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AC3C;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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,69 +0,0 @@
|
|
|
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, "../../../apps/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
|
|
@@ -1 +0,0 @@
|
|
|
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,CA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AAE,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"}
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,69 +0,0 @@
|
|
|
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, "../../../apps/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
|
|
@@ -1 +0,0 @@
|
|
|
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,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,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