7676 "Prepare the package for publishing performing all checks and validations without uploading." ,
7777 ] ,
7878 [ "--allow-slow-types" , "Allow publishing with slow types." ] ,
79+ [
80+ "--provenance" ,
81+ "From CI/CD system, publicly links the package to where it was built and published from." ,
82+ ] ,
7983 ] )
8084 }
8185
8286Environment variables:
8387${
8488 prettyPrintRow ( [
8589 [ "JSR_URL" , "Use a different registry URL for the publish command." ] ,
90+ [
91+ "DENO_BIN_PATH" ,
92+ "Use specified Deno binary instead of local downloaded one." ,
93+ ] ,
8694 ] )
8795 }
8896` ) ;
@@ -106,85 +114,98 @@ if (args.length === 0) {
106114 printHelp ( ) ;
107115 process . exit ( 0 ) ;
108116} else {
109- const options = parseArgs ( {
110- args,
111- allowPositionals : true ,
112- options : {
113- "save-prod" : { type : "boolean" , default : true , short : "P" } ,
114- "save-dev" : { type : "boolean" , default : false , short : "D" } ,
115- "save-optional" : { type : "boolean" , default : false , short : "O" } ,
116- "dry-run" : { type : "boolean" , default : false } ,
117- "allow-slow-types" : { type : "boolean" , default : false } ,
118- token : { type : "string" } ,
119- npm : { type : "boolean" , default : false } ,
120- yarn : { type : "boolean" , default : false } ,
121- pnpm : { type : "boolean" , default : false } ,
122- bun : { type : "boolean" , default : false } ,
123- debug : { type : "boolean" , default : false } ,
124- help : { type : "boolean" , default : false , short : "h" } ,
125- version : { type : "boolean" , default : false , short : "v" } ,
126- } ,
127- } ) ;
128-
129- if ( options . values . debug || process . env . DEBUG ) {
130- setDebug ( true ) ;
131- }
132-
133- if ( options . values . help ) {
134- printHelp ( ) ;
135- process . exit ( 0 ) ;
136- } else if ( options . values . version ) {
137- const version = JSON . parse (
138- fs . readFileSync ( path . join ( __dirname , ".." , "package.json" ) , "utf-8" ) ,
139- ) . version as string ;
140- console . log ( version ) ;
141- process . exit ( 0 ) ;
142- } else if ( options . positionals . length === 0 ) {
143- printHelp ( ) ;
144- process . exit ( 0 ) ;
145- }
146-
147- const pkgManagerName : PkgManagerName | null = options . values . pnpm
148- ? "pnpm"
149- : options . values . yarn
150- ? "yarn"
151- : options . values . bun
152- ? "bun"
153- : null ;
154-
155- const cmd = options . positionals [ 0 ] ;
156- if ( cmd === "i" || cmd === "install" || cmd === "add" ) {
157- run ( async ( ) => {
158- const packages = getPackages ( options . positionals ) ;
159- await install ( packages , {
160- mode : options . values [ "save-dev" ]
161- ? "dev"
162- : options . values [ "save-optional" ]
163- ? "optional"
164- : "prod" ,
165- pkgManagerName,
166- } ) ;
167- } ) ;
168- } else if ( cmd === "r" || cmd === "uninstall" || cmd === "remove" ) {
169- run ( async ( ) => {
170- const packages = getPackages ( options . positionals ) ;
171- await remove ( packages , { pkgManagerName } ) ;
172- } ) ;
173- } else if ( cmd === "publish" ) {
117+ const cmd = args [ 0 ] ;
118+ // Bypass cli argument validation for publish command. The underlying
119+ // `deno publish` cli is under active development and args may change
120+ // frequently.
121+ if (
122+ cmd === "publish" &&
123+ ! args . some ( ( arg ) =>
124+ arg === "-h" || arg === "--help" || arg === "--version" || arg === "-v"
125+ )
126+ ) {
174127 const binFolder = path . join ( __dirname , ".." , ".download" ) ;
175128 run ( ( ) =>
176129 publish ( process . cwd ( ) , {
177130 binFolder,
178- dryRun : options . values [ "dry-run" ] ?? false ,
179- allowSlowTypes : options . values [ "allow-slow-types" ] ?? false ,
180- token : options . values . token ,
131+ publishArgs : args . slice ( 1 ) ,
181132 } )
182133 ) ;
183134 } else {
184- console . error ( kl . red ( `Unknown command: ${ cmd } ` ) ) ;
185- console . log ( ) ;
186- printHelp ( ) ;
187- process . exit ( 1 ) ;
135+ const options = parseArgs ( {
136+ args,
137+ allowPositionals : true ,
138+ options : {
139+ "save-prod" : { type : "boolean" , default : true , short : "P" } ,
140+ "save-dev" : { type : "boolean" , default : false , short : "D" } ,
141+ "save-optional" : { type : "boolean" , default : false , short : "O" } ,
142+ "dry-run" : { type : "boolean" , default : false } ,
143+ "allow-slow-types" : { type : "boolean" , default : false } ,
144+ token : { type : "string" } ,
145+ config : { type : "string" , short : "c" } ,
146+ "no-config" : { type : "boolean" } ,
147+ check : { type : "string" } ,
148+ "no-check" : { type : "string" } ,
149+ quiet : { type : "boolean" , short : "q" } ,
150+ npm : { type : "boolean" , default : false } ,
151+ yarn : { type : "boolean" , default : false } ,
152+ pnpm : { type : "boolean" , default : false } ,
153+ bun : { type : "boolean" , default : false } ,
154+ debug : { type : "boolean" , default : false } ,
155+ help : { type : "boolean" , default : false , short : "h" } ,
156+ version : { type : "boolean" , default : false , short : "v" } ,
157+ } ,
158+ } ) ;
159+
160+ if ( options . values . debug || process . env . DEBUG ) {
161+ setDebug ( true ) ;
162+ }
163+
164+ if ( options . values . help ) {
165+ printHelp ( ) ;
166+ process . exit ( 0 ) ;
167+ } else if ( options . values . version ) {
168+ const version = JSON . parse (
169+ fs . readFileSync ( path . join ( __dirname , ".." , "package.json" ) , "utf-8" ) ,
170+ ) . version as string ;
171+ console . log ( version ) ;
172+ process . exit ( 0 ) ;
173+ } else if ( options . positionals . length === 0 ) {
174+ printHelp ( ) ;
175+ process . exit ( 0 ) ;
176+ }
177+
178+ const pkgManagerName : PkgManagerName | null = options . values . pnpm
179+ ? "pnpm"
180+ : options . values . yarn
181+ ? "yarn"
182+ : options . values . bun
183+ ? "bun"
184+ : null ;
185+
186+ if ( cmd === "i" || cmd === "install" || cmd === "add" ) {
187+ run ( async ( ) => {
188+ const packages = getPackages ( options . positionals ) ;
189+ await install ( packages , {
190+ mode : options . values [ "save-dev" ]
191+ ? "dev"
192+ : options . values [ "save-optional" ]
193+ ? "optional"
194+ : "prod" ,
195+ pkgManagerName,
196+ } ) ;
197+ } ) ;
198+ } else if ( cmd === "r" || cmd === "uninstall" || cmd === "remove" ) {
199+ run ( async ( ) => {
200+ const packages = getPackages ( options . positionals ) ;
201+ await remove ( packages , { pkgManagerName } ) ;
202+ } ) ;
203+ } else {
204+ console . error ( kl . red ( `Unknown command: ${ cmd } ` ) ) ;
205+ console . log ( ) ;
206+ printHelp ( ) ;
207+ process . exit ( 1 ) ;
208+ }
188209 }
189210}
190211
0 commit comments