Wondering what’s next for npm?Check out our public roadmap! »

    sfcc-cartridge-diff

    1.1.0 • Public • Published

    Logo

    SFCC Cartridge Diff Tool

    Command Line Tool for Salesforce Commerce Cloud Cartridge Compare. SFCC Cartridge Diff Tool. Working with SFCC Cartridge overrides just got easier: Compare client cartridge against other cartridges, Generate diffs between override files & Filter using local git changes.

    demo

    Introduction

    Working with SFCC Cartridge overrides just got easier:

    • [X] Compare client cartridge against other cartridges
    • [X] Generate diffs between override files
    • [X] Filter using local git changes

    Install

    Requirements

    Install via NPM

    npm install -g sfcc-cartridge-diff

    Install via Clone

    git clone https://github.com/redvanworkshop/sfcc-cartridge-diff.git
    cd sfcc-cartridge-diff
    npm install -g

    Usage

    You can use this tool in any of your SFCC projects. Change to the directory that contains your dw.json file to run the terminal command.

    cd /path/to/sfcc/project
    sfcc-diff --cartridge app_client_name --options

    OPTIONS:

    Name Param Alias Definition
    Cartridge --cartridge -c Source Cartridge
    Diff --diff -d Show Full Diff
    Exclude --exclude -e List of Cartridges to Exclude
    Filter --filter -f Filter Results for Match
    Include --include -i List of Cartridges to Include
    Junk Only --junk-only -j Junk Files Only
    Modified Only --modified-only -m Modified Files Only

    Examples

    Comparing Client Cartridge to All Cartridges:

    This is the Default Behavior and will compare the provided cartridge to ALL cartridges in the current directory ( event nested ones ).

    sfcc-diff --cartridge app_client_name
    sfcc-diff -c app_client_name

    Comparing Client Cartridge to Specific Cartridges:

    If you only care about a couple of cartridges, you can speed things up by specifying which ones to compare against.

    sfcc-diff --cartridge app_client_name --include storefront-reference-architecture,rvw_autobahn_core
    sfcc-diff -c app_client_name -i storefront-reference-architecture,rvw_autobahn_core

    Comparing Client Cartridge to All Cartridges Except Specific Ones:

    For when you want to compare your client cartridge to ALL cartridges, but want to leave a couple out.

    sfcc-diff --cartridge app_client_name --exclude link_paypal,int_payeezy
    sfcc-diff -c app_client_name -e link_paypal,int_payeezy

    Comparing Client Cartridge to All Cartridges using Only Modified Files:

    Limit compare to just the modified files from your client --cartridge in your current git commit.

    sfcc-diff --cartridge app_client_name --modified-only
    sfcc-diff -c app_client_name -m

    Comparing Client Cartridge to All Cartridges and just show Junk Files:

    Sometimes a file gets copied over to override another cartridge, but ends up not being modified. These junk files are normally hard to catch via git since the file is technically new.

    sfcc-diff --cartridge app_client_name --junk-only
    sfcc-diff -c app_client_name -j

    Comparing Client Cartridge to All Cartridges and Filtering for ISML Files:

    If you want to limit the results to just what matches a filter, you can use the --filter flag. This will match on the entire relative URL, not just the file name.

    sfcc-diff --cartridge app_client_name --filter .isml
    sfcc-diff -c app_client_name -f .isml

    Comparing Client Cartridge to Specific Cartridge and Generate Diff:

    Want to actually see the changes between cartridge files? Just pass in a the Diff option and it will render it in your terminal window.

    sfcc-diff --cartridge app_client_name --include storefront-reference-architecture --diff
    sfcc-diff -c app_client_name -i storefront-reference-architecture -d

    Comparing Client Cartridge to Specific Cartridge and Generate Diff in External App:

    Want to use an existing Diff Tool to generate the diff instead of displaying it in your terminal window? Just pass in the name of a tool you already have configured with git.

    sfcc-diff --cartridge app_client_name --include storefront-reference-architecture --diff=ksdiff
    sfcc-diff -c app_client_name -i storefront-reference-architecture -d ksdiff

    NOTE: In order to use an external app, you will need to have one configured in your ~/.gitconfig file.

    Here are a couple of apps you can use for external diffs, and how to configure them.

    ksdiff - Kaleidoscope

    [difftool "ksdiff"]
      prompt = false
      trustExitCode = true
      cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"

    bcomp - Beyond Compare

    [difftool "bcomp"]
      prompt = false
      trustExitCode = true
      cmd = bcompare -solo \"$LOCAL\" \"$REMOTE\"

    meld - Meld

    [difftool "meld"]
      prompt = false
      trustExitCode = true
      cmd = meld --newtab --label=\"$MERGED\" \"$LOCAL\" \"$REMOTE\" &> /dev/null &

    kdiff3 - KDiff3

    [difftool "kdiff3"]
      prompt = false
      trustExitCode = true
      cmd = open -W -a kdiff3 -n --args \"$LOCAL\" \"$REMOTE\" &> /dev/null &

    Install

    npm i sfcc-cartridge-diff

    DownloadsWeekly Downloads

    0

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    42.1 kB

    Total Files

    26

    Last publish

    Collaborators

    • avatar