Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: pkg manager option in install script #173

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ tsconfig.tsbuildinfo
tsconfig.*.tsbuildinfo
vocs.config.ts.timestamp-*
.vercel
.vocs
.vocs
*.timestamp-*
_
42 changes: 25 additions & 17 deletions src/app/components/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,37 @@ export function Button(props: ButtonProps) {
return <Button_ {...props} className={clsx(styles.button, props.className)} />
}

type NoRepetition<U extends string, ResultT extends any[] = []> =
| ResultT
| {
[k in U]: NoRepetition<Exclude<U, k>, [k, ...ResultT]>
}[U]

export function InstallPackage({
name,
type = 'install',
}: { children: ReactNode; className?: string; name: string; type?: 'install' | 'init' }) {
packageManager = ['npm', 'pnpm', 'yarn'],
}: {
className?: string
name: string
type?: 'install' | 'init'
packageManager?: NoRepetition<'npm' | 'pnpm' | 'yarn' | 'bun'>
}) {
return (
<Tabs.Root className={styles.tabs} defaultValue="npm">
<Tabs.Root className={styles.tabs} defaultValue={packageManager[0]}>
<Tabs.List className={styles.tabsList}>
<Tabs.Trigger value="npm">npm</Tabs.Trigger>
<Tabs.Trigger value="pnpm">pnpm</Tabs.Trigger>
<Tabs.Trigger value="yarn">yarn</Tabs.Trigger>
{packageManager.map((manager) => (
<Tabs.Trigger key={manager} value={manager}>
{manager}
</Tabs.Trigger>
))}
</Tabs.List>
<Tabs.Content className={styles.tabsContent} value="npm">
<span className={styles.packageManager}>npm</span> {type === 'init' ? 'init' : 'install'}{' '}
{name}
</Tabs.Content>
<Tabs.Content className={styles.tabsContent} value="pnpm">
<span className={styles.packageManager}>pnpm</span> {type === 'init' ? 'create' : 'add'}{' '}
{name}
</Tabs.Content>
<Tabs.Content className={styles.tabsContent} value="yarn">
<span className={styles.packageManager}>yarn</span> {type === 'init' ? 'create' : 'add'}{' '}
{name}
</Tabs.Content>
{packageManager.map((manager) => (
<Tabs.Content key={manager} value={manager} className={styles.tabsContent}>
<span className={styles.packageManager}>{manager}</span>{' '}
{type === 'init' ? 'create' : 'add'} {name}
</Tabs.Content>
))}
</Tabs.Root>
)
}
Loading