Skip to content

Commit

Permalink
refactor: use getInstallCmd function
Browse files Browse the repository at this point in the history
  • Loading branch information
selemondev committed Nov 19, 2023
1 parent 7d8faa8 commit f1e4f58
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
3 changes: 1 addition & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as vscode from "vscode";
import {
getInitCmd,
getInstallCmd,
getInstallMultipleComponents,
getComponentDocLink,
getRegistry,
shadCnDocUrl,
Expand Down Expand Up @@ -80,7 +79,7 @@ export function activate(context: vscode.ExtensionContext) {

const selectedComponent = selectedComponents.map((component) => component.label);

const installCmd = await getInstallMultipleComponents(selectedComponent.join(' '));
const installCmd = await getInstallCmd(selectedComponent);
executeCommand(installCmd);

await logCmd(installCmd);
Expand Down
14 changes: 0 additions & 14 deletions src/utils/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,6 @@ export const getInstallCmd = async (components: string[]) => {
return `npx shadcn-vue@latest add ${componentStr}`;
};

export const getInstallMultipleComponents = async (component: string) => {
const packageManager = await detectPackageManager();

if (packageManager === "bun") {
return `bunx shadcn-vue add ${component}`;
}

if (packageManager === "pnpm") {
return `pnpm dlx shadcn-vue@latest add ${component}`;
}

return `npx shadcn-vue@latest add ${component}`;
};

export const getInitCmd = async () => {
const packageManager = await detectPackageManager();

Expand Down

0 comments on commit f1e4f58

Please sign in to comment.