@@ -3,6 +3,7 @@ import type {
33 CommandPaletteContextCommandInput ,
44 CommandPalettePackageContext ,
55} from '~/types/command-palette'
6+ import { downloadPackageTarball } from '~/utils/package-download'
67
78function activeLabel ( isCurrentRoute : boolean , label : string ) {
89 return isCurrentRoute ? label : null
@@ -104,6 +105,28 @@ export function useCommandPalettePackageCommands(
104105 } ,
105106 ]
106107
108+ if ( resolvedContext . tarballUrl ) {
109+ commands . push ( {
110+ id : 'package-download' ,
111+ group : 'package' ,
112+ label : t ( 'command_palette.package.download' ) ,
113+ keywords : [
114+ resolvedContext . packageName ,
115+ t ( 'package.download.button' ) ,
116+ t ( 'package.download.tarball' ) ,
117+ ] ,
118+ iconClass : 'i-lucide:download' ,
119+ action : ( ) => {
120+ void downloadPackageTarball ( resolvedContext . packageName , {
121+ version : resolvedContext . resolvedVersion ! ,
122+ dist : {
123+ tarball : resolvedContext . tarballUrl ! ,
124+ } ,
125+ } )
126+ } ,
127+ } )
128+ }
129+
107130 if (
108131 resolvedContext . latestVersion &&
109132 resolvedContext . latestVersion !== resolvedContext . resolvedVersion
0 commit comments