starlight-package-managers
supports the following package managers:
Defaults
By default, starlight-package-managers
will use npm
, yarn
and pnpm
.
import { PackageManagers } from ' starlight-package-managers '
< PackageManagers pkg = " astro " />
The code above generates the following commands:
Customization
You can customize the package managers using the pkgManagers
prop.
import { PackageManagers } from ' starlight-package-managers '
< PackageManagers pkg = " astro " pkgManagers = { [ ' npm ' , ' bun ' ] } />
The code above generates the following commands:
Note
If only a single package manager is specified, the command will be displayed with no tabs.
import { PackageManagers } from ' starlight-package-managers '
< PackageManagers pkg = " astro " pkgManagers = { [ ' pnpm ' ] } />
The code above generates the following command:
Global Customization
Having to specify the pkgManagers
prop every time can be tedious. To avoid this, you can create a custom Astro component wrapping starlight-package-managers
:
type PackageManagersProps,
} from ' starlight-package-managers '
type Props = PackageManagersProps
{ /* Customize the package managers to use. */ }
pkgManagers = {[ ' npm ' , ' yarn ' , ' pnpm ' , ' bun ' , ' ni ' ]}
Now you can use the custom component instead of starlight-package-managers
:
import AllPackageManagers from ' @/components/AllPackageManagers.astro '
< AllPackageManagers pkg = " astro " />
The code above generates the following commands: