UNPKG

@salesforce/plugin-packaging

Version:

SF plugin that support Salesforce Packaging Platform

65 lines 2.68 kB
/* * Copyright 2026, Salesforce, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Flags, loglevel, orgApiVersionFlagWithDeprecations, SfCommand } from '@salesforce/sf-plugins-core'; import { Messages } from '@salesforce/core/messages'; import { PackageBundle } from '@salesforce/packaging'; import { requiredHubFlag } from '../../../utils/hubFlag.js'; Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); const messages = Messages.loadMessages('@salesforce/plugin-packaging', 'package_bundle_delete'); export class PackageBundleDeleteCommand extends SfCommand { static hidden = true; static state = 'beta'; static summary = messages.getMessage('summary'); static description = messages.getMessage('description'); static examples = messages.getMessages('examples'); static requiresProject = true; static flags = { loglevel, 'target-dev-hub': requiredHubFlag, 'api-version': orgApiVersionFlagWithDeprecations, 'no-prompt': Flags.boolean({ char: 'n', summary: messages.getMessage('flags.no-prompt.summary'), }), bundle: Flags.string({ char: 'b', summary: messages.getMessage('flags.bundle.summary'), required: true, }), }; async run() { const { flags } = await this.parse(PackageBundleDeleteCommand); const message = messages.getMessage('prompt-delete'); const accepted = flags['no-prompt'] || flags.json ? true : await this.confirm({ message }); if (!accepted) { throw messages.createError('prompt-delete-deny'); } const connection = flags['target-dev-hub'].getConnection(flags['api-version']); const result = await PackageBundle.delete(connection, this.project, flags.bundle); this.display(result); return result; } display(result) { this.log(); if (result.success) { this.logSuccess(messages.getMessage('humanSuccess', [result.id])); } else { this.error(messages.getMessage('humanError')); } } } //# sourceMappingURL=delete.js.map