File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed
Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 3030 "vite" : " ^5.0.2" ,
3131 "vitest" : " ^0.34.6" ,
3232 "webdriverio" : " ^8.6.7"
33+ },
34+ "dependencies" : {
35+ "@huggingface/hub" : " link:packages/hub"
3336 }
3437}
Original file line number Diff line number Diff line change @@ -102,6 +102,8 @@ type Command = keyof typeof commands;
102102
103103async function run() {
104104 switch (command) {
105+ case undefined:
106+ case "--help":
105107 case "help": {
106108 const positionals = parseArgs({ allowPositionals: true, args }).positionals;
107109
@@ -117,11 +119,17 @@ async function run() {
117119 .map(([name, { description }]) => ` - $ { usage ( name ) } : ${ description } `)
118120 . join ( "\n" )
119121 ) ;
122+
123+ console . log ( "\nTo get help on a specific command, run `hfjs help <command>` or `hfjs <command> --help`" ) ;
124+
125+ if ( command === undefined ) {
126+ process . exitCode = 1 ;
127+ }
120128 break ;
121129 }
122130
123131 case "upload" : {
124- if ( args [ 1 ] === "--help" || args [ 1 ] === "-h" ) {
132+ if ( args [ 0 ] === "--help" || args [ 0 ] === "-h" ) {
125133 console . log ( usage ( "upload" ) ) ;
126134 break ;
127135 }
@@ -171,7 +179,7 @@ function usage(commandName: Command) {
171179 }
172180 return `[--${ arg . name } ${ arg . enum ? `{${ arg . enum . join ( "," ) } }` : arg . name . toLocaleUpperCase ( ) } ]` ;
173181 } )
174- . join ( "" ) } `. trim ( ) ;
182+ . join ( " " ) } `. trim ( ) ;
175183}
176184
177185function detailedUsage ( commandName : Command ) {
@@ -219,8 +227,9 @@ function advParseArgs<C extends Command>(
219227 . map ( ( arg ) => {
220228 const option = {
221229 name : arg . name ,
222- short : arg . short ,
230+ ... ( arg . short && { short : arg . short } ) ,
223231 type : arg . boolean ? "boolean" : "string" ,
232+ default : typeof arg . default === "function" ? arg . default ( ) : arg . default ,
224233 } as const ;
225234 return [ arg . name , option ] ;
226235 } )
Original file line number Diff line number Diff line change 11import type { Options } from "tsup" ;
22
3- const baseConfig : Options = {
3+ const baseConfig = {
44 entry : [ "./index.ts" ] ,
55 format : [ "cjs" , "esm" ] ,
66 outDir : "dist" ,
77 clean : true ,
8- } ;
8+ } satisfies Options ;
99
1010const nodeConfig : Options = {
1111 ...baseConfig ,
12+ entry : [ ...baseConfig . entry , "./cli.ts" ] ,
1213 platform : "node" ,
1314} ;
1415
You can’t perform that action at this time.
0 commit comments