-
Notifications
You must be signed in to change notification settings - Fork 968
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate extensions commands to use registry APIs (#3273)
* Add publisher to registry file fields (#686) * Migrate ext:update ref-based flow to include update warnings + min extension version guard (#684) * Migrate ext:install flow to install via extension reference and remove EAP gating (#679) * Remove EAP-specific copy in ext:dev:register and ext:dev:publish command (#691) * Warn user that unpublishing is final in ext:dev:unpublish command (#693) * Add extMinVersion flag to ext:dev:unpublish command (#698) * Migrate ext:info flow to retrieve spec from Registry API (#683) * Migrate "author" terminology to use "publisher" in Extensions CLI commands (#694) * Fix bug in confirmInstallByReference and refactor ext:install error messages (#702) * Fix local path detection logic and refactor warnings logic in ext:update flow (#703) * Migrate extensions warnings relating to audiences to use (backend) launch stage and visibility fields (#705) * Only infer firebase if publisher not provided as part of user input in ext:info flow (#708) * Adds new warning prompt for non-trusted publishers during ext:install (#707) * add new warning prompt for non-trusted publishers during ext:install * clean up param namne * clean up comment * switch from author ulr to sourceUrl * no please * Update copy to link user to documentation on ext:install flow if input not found (#711) * Adds console install link to ext:dev:publish (#709) * Adds console install link to ext:dev:publish * formats * Add firebase ext:dev:delete command to CLI (#712) * adds changelog * formats Co-authored-by: huangjeff5 <[email protected]> Co-authored-by: Jeff Huang <[email protected]> Co-authored-by: Elvis Sun <[email protected]>
- Loading branch information
1 parent
e8c817c
commit 01610e0
Showing
23 changed files
with
694 additions
and
358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Migrates Firebase Extensions commands to use registry API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import * as utils from "../utils"; | ||
import * as clc from "cli-color"; | ||
|
||
import { Command } from "../command"; | ||
import { logPrefix } from "../extensions/extensionsHelper"; | ||
import { parseRef, getExtension, deleteExtension } from "../extensions/extensionsApi"; | ||
import { promptOnce } from "../prompt"; | ||
import { requireAuth } from "../requireAuth"; | ||
import { FirebaseError } from "../error"; | ||
import { checkMinRequiredVersion } from "../checkMinRequiredVersion"; | ||
|
||
module.exports = new Command("ext:dev:delete <extensionRef>") | ||
.description("delete an extension") | ||
.help( | ||
"use this command to delete an extension, and make it unavailable for developers to install or reconfigure. " + | ||
"Specify the extension you want to delete using the format '<publisherId>/<extensionId>." | ||
) | ||
.before(requireAuth) | ||
.before(checkMinRequiredVersion, "extDevMinVersion") | ||
.action(async (extensionRef: string) => { | ||
const { publisherId, extensionId, version } = parseRef(extensionRef); | ||
if (version) { | ||
throw new FirebaseError( | ||
`Deleting a single version is not currently supported. You can only delete ${clc.bold( | ||
"ALL versions" | ||
)} of an extension. To delete all versions, please remove the version from the reference.` | ||
); | ||
} | ||
utils.logLabeledWarning( | ||
logPrefix, | ||
"If you delete this extension, developers won't be able to install it. " + | ||
"For developers who currently have this extension installed, " + | ||
"it will continue to run and will appear as unpublished when " + | ||
"listed in the Firebase console or Firebase CLI." | ||
); | ||
utils.logLabeledWarning( | ||
"This is a permanent action", | ||
`Once deleted, you may never use the extension name '${clc.bold(extensionId)}' again.` | ||
); | ||
await getExtension(extensionRef); | ||
const consent = await confirmDelete(publisherId, extensionId); | ||
if (!consent) { | ||
throw new FirebaseError("deletion cancelled."); | ||
} | ||
await deleteExtension(extensionRef); | ||
utils.logLabeledSuccess(logPrefix, "successfully deleted all versions of this extension."); | ||
}); | ||
|
||
async function confirmDelete(publisherId: string, extensionId: string): Promise<string> { | ||
const message = `You are about to delete ALL versions of ${clc.green( | ||
`${publisherId}/${extensionId}` | ||
)}.\nDo you wish to continue? `; | ||
return await promptOnce({ | ||
type: "confirm", | ||
message, | ||
default: false, // Force users to explicitly type 'yes' | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.