npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sfdx-destruction

v1.0.0-beta.5

Published

Destructive changes support for sfdx force:source:deploy

Downloads

73

Readme

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.