UNPKG

zapier-platform-cli

Version:

The CLI for managing integrations in Zapier Developer Platform.

62 lines (52 loc) 1.89 kB
const BaseCommand = require('../ZapierBaseCommand'); const { Args, Flags } = require('@oclif/core'); const { buildFlags } = require('../buildFlags'); const { callAPI } = require('../../utils/api'); class LegacyCommand extends BaseCommand { async perform() { const app = await this.getWritableApp(); const { version } = this.args; if ( !this.flags.force && !(await this.confirm( 'Are you sure you want to mark this version as legacy? Existing Zaps and automations will continue to work, but users may not be able to create new Zaps or automations with this version.', )) ) { this.log('\nCancelled, version is not marked as legacy.'); return; } this.log( `\nPreparing to mark version ${version} your app "${app.title}" as legacy.\n`, ); const url = `/apps/${app.id}/versions/${version}/legacy`; this.startSpinner(`Making ${version} legacy`); await callAPI(url, { method: 'PUT', }); this.stopSpinner(); } } LegacyCommand.flags = buildFlags({ commandFlags: { force: Flags.boolean({ char: 'f', description: 'Skip confirmation prompt. Use with caution.', }), }, }); LegacyCommand.args = { version: Args.string({ description: 'The version to mark as legacy.', required: true, }), }; LegacyCommand.examples = ['zapier legacy 1.2.3']; LegacyCommand.description = `Mark a non-production version of your integration as legacy. Use this when an integration version is no longer recommended for new users, but you don't want to block existing users from using it. Reasons why you might want to mark a version as legacy: - this version may be discontinued in the future - this version has bugs - a newer version has been released and you want to encourage users to upgrade `; LegacyCommand.skipValidInstallCheck = true; module.exports = LegacyCommand;