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

@ds-sfdc/sfparty

v1.6.0

Published

Salesforce metadata XML splitter for CI/CD

Downloads

3,910

Readme

@ds-sfdc/sfparty

NPM Downloads/week License CI/CD

Why use sfparty?

Salesforce metadata is typically stored in large XML files, which can take some effort to work with. These XML files are hard to read, challenging to diff, and can lead to conflicts and corrupted XML when merging. sfparty is a utility that improves the developer and DevOps experience by splitting Salesforce metadata XML files into smaller YAML or JSON parts. This makes it much easier to understand and manage the metadata and eliminates the risk of conflicts and corrupted XML. Additionally, sfparty's ability to combine these parts back into XML files makes it an ideal solution for CI/CD needs. It allows for easy version control and streamlined deployment processes.

Install

npm i -g @ds-sfdc/sfparty

NPM Installation Issues

command not found: sfparty
sfparty is an executable that is meant to be installed globally.

EACCESS: permission denied There are several options on how to resolve the NPM EACCESS issue.The simplest way if you can is to use sudo

sudo npm i -g @ds-sfdc/sfparty

Depending on your system, you may have some issues installing sfparty using NPM. These are typically file system permission issues. Here are some links to various articles with suggestions on how to resolve the issue.

Fixing npm permission issue
Always use sudo to install global packages
Use npm config instead of using chown or chmod

Commands

Split

sfparty split

Combine

sfparty combine

Update

sfparty update

Options

-y, --type     type(s) of metadata to process
-n, --name     name of metadata file  
-f, --format   format to use yaml (default) or json
-s, --source   package directory path specified in sfdx-project.json  
-t, --target   target path to directory to create yaml/json files  
-g, --git      combine files based on git commits
-h, --help     Show help  
-v, --version  Show version

Combine Options

The following options are available when using the combine command:

git

-g, --git      process files based on git commits. This option does not require a value.
Git Options

The following options are available when using the combine command:

-a, --append      append package and destructive package instead of overwriting.
-l, --delta       when possible create delta metadata files for CI/CD deployment.
-p, --package     path to your change package XML file.
-x, --destructive path to your destructive change package XML file.

Examples

Custom Labels

sfparty split --type=label

Permission Set

sfparty split --type=permset
sfparty split --type=permset --name="My Permission Set"

Profile

sfparty split --type=profile
sfparty split --type=profile --name="My Profile"

Workflow

sfparty split --type=workflow
sfparty split --type=workflow --name="Workflow"

Multiple Types

sfparty split --type="workflow,label"

Source Directory

The source directory will use your default package folder as specified in the sfdx-project.json file, and therefore must be executed from your Salesforce project directory. It will create the main/default folders if they do not exist.

{
    "packageDirectories": [
        {
            "path": "force-app",
            "default": true
        },
        {
            "path": "my-package"
        }
    ],
    "namespace": "",
    "sfdcLoginUrl": "https://login.salesforce.com",
    "sourceApiVersion": "56.0"
}
sfparty split --source="my-package"

Target Directory

The source directory will use your default package folder as specified in the sfdx-project.json file, and append -party to the end. For example, if the default source path is force-app, then the default target directory will be force-app-party unless otherwise specified. The target does not need to be specified in the sfdx-project.json, however the combine command will not work on folders that are not specified in the sfdx-project.json.

sfparty split --target="test"

Husky Git Hooks

If you are using a git hook utility such as husky, you can add a post-merge hook to automate running the combine command whenever you execute a merge or git pull command.

post-merge

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

sfparty combine --git

CI/CD

sfparty is meant to be a supplemental addition to your CI/CD process. Your pipeline should already build out a package.xml and destructiveChanges.xml. When sfparty runs it will do a git diff and append changes to the files. You can use a utility like sfdx-git-delta to build out the package.

Command:
sfparty combine --git

Required:  
-g, --git         process files based on git commits. This option does not require a value.

Optional:  
-a, --append      append package and destructive package instead of overwriting.
-l, --delta       when possible create delta metadata files for CI/CD deployment.
-p, --package     path to your change package XML file.
-x, --destructive path to your destructive change package XML file.

Example

Previous Commit to Current

sfparty combine --git=HEAD~1..HEAD --append --delta --package=deploy/package.xml --destructive=deploy/destructiveChanges/destructiveChanges.xml

Previous Commit to Current and output to different target directory

The default target is the package file specified in the sfdx-project.json file. You can use the --target parameter if you want the files to be created in a different location. sfparty will create the /main/default/* directories accordingly.

sfparty combine --git=HEAD~1..HEAD --append --delta --package=deploy/package.xml --destructive=deploy/destructiveChanges/destructiveChanges.xml --target=deployDir/force-app