New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sfdx-destruction

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sfdx-destruction

Destructive changes support for sfdx force:source:deploy

  • 1.0.0-beta.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Important Announcement

SFDX now contains destructive changes support. You no longer need to use this plugin.

Use the following arguments:

--predestructivechanges <filepath>

--postdestructivechanges <filepath>



sfdx-destruction

Destructive changes support for sfdx force:source:deploy via a predeploy hook.

At time of writing, the sfdx force:source:deploy command doesn't support destructive changes files out of the box. Therefore if deletions are required, either source metadata needs to be converted for use with sfdx force:mdapi:deploy or there'll need to be multiple deployments (with downtime, difficult rollbacks and multiple unit test cycles).

This simple plugin hooks into source deploy and drops destructiveChangesPre.xml and/or destructiveChangesPost.xml deletions manifests into the package before the deployment initiates.

Version Known Vulnerabilities Downloads/week License

Installation

$ sfdx plugins:install sfdx-destruction

Usage

$ SFDX_DESTRUCTION_ENABLE=true sfdx force:source:deploy

Configuration

Destructive changes functionality is disabled by default and therefore must be enabled by environment variable or in the project configuration file.

If the SFDX_DESTRUCTION_ENABLE environment variable is set, it will be used to determine whether to run the plugin (true or false and regardless of configuration file settings).
Else the plugins -> sfdx-destruction -> enabledByDefault variable in the project configuration file will be used (if set).
If neither is configured, the plugin will remain disabled.

The locations of the pre and post destructive changes files can also be specified by environment variable and/or configuration file. Environment variables take precedence over the configuration file. If neither is present, the plugin will have no effect.

Recommended usage is to use the configuration file to store the locations of the destructive changes files and the environment variable to enable at build time.

Environment Variables

SFDX_DESTRUCTION_ENABLE - true or false to enable or disable the plugin

SFDX_DESTRUCTION_PRE_FILE - path to the destructive changes pre file i.e. deletions that will occur before the deployment

SFDX_DESTRUCTION_POST_FILE - path to the destructive changes post file i.e. deletions that will occur after the deployment

Project Configuration File (sfdx-project.json)

enabledByDefault - true or false - will be used to determine whether the plugin should run if no environment variable is present (default: false - disabled)

preFile - path to the destructive changes pre file i.e. deletions that will occur before the deployment

postFile - path to the destructive changes post file i.e. deletions that will occur after the deployment

Example:

{
  "packageDirectories": [
    {
      "default": true,
      "path": "force-app"
    }
  ],
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "50.0",
  "plugins": {
    "sfdx-destruction": {
      "enabledByDefault": false,
      "preFile": "{path-to-destructiveChangesPre.xml}",
      "postFile": "{path-to-destructiveChangesPost.xml}"
    }
  }
}

Can I enable the plugin by command line argument?

No, unfortunately not.

This functionality is implemented as a hook and although it is possible to access argv, it doesn't seem to be possible to define additional arguments. Passing in an extra argument will return an error of Unexpected argument.

Keywords

FAQs

Package last updated on 23 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc