@@ -11,13 +11,14 @@ import { checkMinRequiredVersion } from "../checkMinRequiredVersion";
11
11
12
12
module . exports = new Command ( "ext:dev:unpublish <extensionRef>" )
13
13
. description ( "unpublish an extension" )
14
+ . withForce ( )
14
15
. help (
15
16
"use this command to unpublish an extension, and make it unavailable for developers to install or reconfigure. " +
16
17
"Specify the extension you want to unpublish using the format '<publisherId>/<extensionId>."
17
18
)
18
19
. before ( requireAuth )
19
20
. before ( checkMinRequiredVersion , "extDevMinVersion" )
20
- . action ( async ( extensionRef : string ) => {
21
+ . action ( async ( extensionRef : string , options : any ) => {
21
22
const { publisherId, extensionId, version } = refs . parse ( extensionRef ) ;
22
23
utils . logLabeledWarning (
23
24
logPrefix ,
@@ -35,15 +36,25 @@ module.exports = new Command("ext:dev:unpublish <extensionRef>")
35
36
) ;
36
37
}
37
38
await getExtension ( extensionRef ) ;
38
- const consent = await comfirmUnpublish ( publisherId , extensionId ) ;
39
+ const consent = await comfirmUnpublish ( publisherId , extensionId , options ) ;
39
40
if ( ! consent ) {
40
41
throw new FirebaseError ( "unpublishing cancelled." ) ;
41
42
}
42
43
await unpublishExtension ( extensionRef ) ;
43
44
utils . logLabeledSuccess ( logPrefix , "successfully unpublished all versions of this extension." ) ;
44
45
} ) ;
45
46
46
- async function comfirmUnpublish ( publisherId : string , extensionId : string ) : Promise < boolean > {
47
+ async function comfirmUnpublish (
48
+ publisherId : string ,
49
+ extensionId : string ,
50
+ options : any
51
+ ) : Promise < boolean > {
52
+ if ( options . nonInteractive && ! options . force ) {
53
+ throw new FirebaseError ( "Pass the --force flag to use this command in non-interactive mode" ) ;
54
+ }
55
+ if ( options . nonInteractive && options . force ) {
56
+ return true ;
57
+ }
47
58
const message = `You are about to unpublish ALL versions of ${ clc . green (
48
59
`${ publisherId } /${ extensionId } `
49
60
) } .\nDo you wish to continue? `;
0 commit comments