Giter Club home page Giter Club logo

sfdc-git-package's Introduction

sfdc-git-package

Create Package.xml and destructiveChangesPre.xml from git diff between two commits

Getting Started

Works in Unix like system. Windows is not tested.

Prerequisites

Git command line is required on the system where the command line is running.

Installing

npm install -g sfdc-git-package

or

yarn globally add sfdc-git-package

Usage

Command Line

$ sgp -h

  Usage: sgp [options]

  Create Package.xml and destructiveChangesPre.xml from git

  Options:

    -h, --help                   output usage information
    -V, --version                output the version number
    -t, --to [sha]               commit sha to where the diff is done [HEAD]
    -f, --from [sha]             commit sha from where the diff is done [git rev-list --max-parents=0 HEAD]
    -o, --output [dir]           package.xml specific output [./output]
    -a, --api-version [version]  salesforce API version [37.0]
    -r, --repo [dir]             git repository location [./repo]

Module

  var sgp = require('sfdc-git-package');

  sgp({
    'to':'', // commit sha to where the diff is done. Default : HEAD
    'from':'', // commit sha from where the diff is done. Default : git rev-list --max-parents=0 HEAD
    'output':'', // package.xml & destructiveChangesPre.xml specific output. Default : ./output
    'apiVersion':'', // salesforce API version. Default : 39.0
    'repo':'' // git repository location. Default : ./repo
  }, console.log);

Built With

  • commander - The complete solution for node.js command-line interfaces, inspired by Ruby's commander.
  • nodegit-kit - Complementary NodeGit helpers returning native Promises, helps with git commands such as init, add, commit, status, diff.
  • xmlbuilder - An XML builder for node.js similar to java-xmlbuilder.

Versioning

SemVer is used for versioning.

Authors

  • Sebastien Colladon - Initial work - scolladon

License

This project is licensed under the MIT License - see the LICENSE.md file for details

sfdc-git-package's People

Contributors

scolladon avatar scolladon-sfdc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sfdc-git-package's Issues

identify the object that caused the package.xml not to be generated

Hi,
I encounter the following issue:
One of the build failed on:

(node:13526) UnhandledPromiseRejectionWarning: Unhandled Promise Rejection (rejection id: 2): Error Unexpected close tag Line 35581 Column 15 Char: >

(node:13256): [DEP0018] DeprecationWarning: Unhandled Promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The solution was running the sgp command on each folder (that contain the objects) ,until we found the directory that contain the failed object .Then inside the directory run the sgp until we found the object that cause the failure
Is it possible that the sgp command will print the file that cause the failure ?
regards

Is this tool restricted to only version 40?

Am getting following error when tried to deploy using ANT:

[sf:deploy] Component Failures:
[sf:deploy] 1.  objects/abc_Trigger_Apex_Switch__mdt.object (abc_Trigger_Apex_Switch__mdt.Method_Name__c) -- Error: Property 'businessStatus' not valid in version 40.0 

Inside package.xml its showing <version>40.0</version>

Usage Error?

I may be misunderstanding the usage for this tool. When I run any of the following, I'm getting this error: events.js:183
throw er; // Unhandled 'error' event

I've tried leaving out arguments that should have defaults, but still only getting back that error message. Can you provide a sample command that would generate a package?

Attempted usages:

sgp -t dedeb392bda33507f390095e3d08463235976712 -f 3ef855215f5b4536be7ee89c59cb32591c0c9517

sgp -t dedeb392bda33507f390095e3d08463235976712 -f 3ef855215f5b4536be7ee89c59cb32591c0c9517 -o manifest/temp.xml -a 45.0

sgp -t dedeb392bda33507f390095e3d08463235976712 -f 3ef855215f5b4536be7ee89c59cb32591c0c9517 -o manifest -a 45.0

sgp -t dedeb392bda33507f390095e3d08463235976712 -f 3ef855215f5b4536be7ee89c59cb32591c0c9517 -o manifest -a 45.0 -r StandForChildren/SFDC

Package this project as an sfdx plugin

Hi Sebastian
Very nice project. I m looking for a tool like this but something like an sfdx plugin. My idea is to pick up only diff and use sfdx:source:convert to generate the metadata. The only missing part is the destructive package.

What do you think about this approach? If this is something that your are interested in we can work together to build the plugin.

If it's not you can close the issue;-).

Issue with the parsing of emails.

As you probably know, in the email folder all emails can exist in separate folders.

I faced with an issue when your package does delete of all emails inside the email folder, but the package.xml file generates correctly: with folder prefix before an email name.

Issue with the parsing of aura components

I faced with the similar issue like this one: Issue with the parsing of emails.

The package does delete all files inside the aura folder.
Moreover, the package.xml generates something interesting: it specified a name of a component and then after '/' the name of a file.

Something like:

<members>MyComponent/MyComponentController</members>
<members>MyComponent/MyComponentHelper</members>

etc.

destructive packages handling

When you delete a whole Salesforce objetc, the destructive package is created, but the package.xml doesnt seem created - this causes the further deploy to fail.
A package xml including CustomObject and * is needed, as weel as the desctructive manifest.

The parsing of *.object files.

Hi Sebastien.

As I know, your tool sfdc-generate-package do the parsing of *.object files. I mean in a result package.xml file I've seen ActionOverride, CustomField, ListView, RecordType, etc. types of metadata. All to those store in the *.object files.

I tried to use sfdc-git-package and I faced the problem: in the package.xml file I don't see the metadata type sections stored in the *.object files.

Does exist any flag to do this type of parsing? Or it's a missing functionality?

Thanks! :)

Error - events.js:187 - Unhandled 'error' event

sgp -f fe6df99ec3e030c73e20cc620144c020b76d55b4 -o ./output
events.js:187
throw er; // Unhandled 'error' event
^

Error: spawn git ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn git',
path: 'git',
spawnargs: [
'diff',
'--name-status',
'fe6df99ec3e030c73e20cc620144c020b76d55b4',
'HEAD'
]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.