Giter Club home page Giter Club logo

sfdc-generate-package's Introduction

sfdc-generate-package

generate package.xml from source

Getting Started

Works in Windows and Unix like systems.

Installing

npm install -g sfdc-generate-package

or

yarn globally add sfdc-generate-package

Usage

Command Line

$ sgp -h

  Usage: sgp [options]

  generate package.xml from source

  Options:

    -h, --help                   output usage information
    -V, --version                output the version number
    -s, --src                    salesforce src directory path [./src]
    -a, --api-version            salesforce API version [40.0]
    -o, --output                 salesforce package.xml directory path [.]

Module

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

  sgp({
    'src':'', // salesforce src directory path : ./src
    'apiVersion':'40.0', // salesforce API verion : 40.0
    'output':'', // salesforce src directory path : ./src
    'indent':'  ' // the number of space for the xml indentation (optionnal attibute)
  }, console.log);

Module

Add CLI parameters to build package.xml for only certain types

Built With

  • commander - The complete solution for node.js command-line interfaces, inspired by Ruby's commander.
  • xml2js - XML to JavaScript object converter.
  • directory-tree - Creates a JavaScript object representing a directory tree..
  • xml2js - Ever had the urge to parse XML? And wanted to access the data in some sane, easy way? Don't want to compile a C parser, for whatever reason? Then xml2js is what you're looking for!

Versioning

SemVer is used for versioning.

Authors

License

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

sfdc-generate-package's People

Contributors

ancpawel avatar ariels1 avatar benbozou avatar colin-julien avatar dependabot[bot] avatar donpablom avatar enriquedurango avatar scolladon avatar scolladon-sfdc avatar wadewegner 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sfdc-generate-package's Issues

Request for adding additional Metadata : NavigationMenu and Audience

Hi Sebastien,

Thank you for the tool for generating package,
We would like to add few more metadata on for project.

"navigationMenus": {
"xmlName": "NavigationMenu",
"minApiVersion": 27.0,
"maxApiVersion": 52.0
},
"audience": {
"xmlName": "Audience",
"minApiVersion": 27.0,
"maxApiVersion": 52.0
},

Kindly consider.

Translations

Hi,

Translations files are ignored and cannot be found in the package.xml after running the script.
examples:
src\translations\en_US.transltion
src\standardValueSetTranslaions\CaseStatus-en_US.standardValueSetTranslation

API Version: 43.0

Thanks!

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

Metadata Type: TopicsForObjects

Hi Sebastien.
I've noticed that your package doesn't handle a Metadata Type TopicsForObjects.
Could you please resolve this small issue?
Thanks.

(node:77781) UnhandledPromiseRejectionWarning: Error: Non-whitespace before first tag.

Hi Sebastien.

I've faced issue:

(node:77781) UnhandledPromiseRejectionWarning: Error: Non-whitespace before first tag.
Line: 0
Column: 1
Char: 
    at error (/usr/local/lib/node_modules/sfdc-generate-package/node_modules/sax/lib/sax.js:651:10)
    at strictFail (/usr/local/lib/node_modules/sfdc-generate-package/node_modules/sax/lib/sax.js:677:7)
    at beginWhiteSpace (/usr/local/lib/node_modules/sfdc-generate-package/node_modules/sax/lib/sax.js:951:7)
    at SAXParser.write (/usr/local/lib/node_modules/sfdc-generate-package/node_modules/sax/lib/sax.js:1006:11)
    at Parser.exports.Parser.Parser.parseString (/usr/local/lib/node_modules/sfdc-generate-package/node_modules/xml2js/lib/parser.js:322:31)
    at Parser.parseString (/usr/local/lib/node_modules/sfdc-generate-package/node_modules/xml2js/lib/parser.js:5:59)
    at Promise (/usr/local/lib/node_modules/sfdc-generate-package/lib/utils/async-xml-parser.js:6:12)
    at new Promise (<anonymous>)
    at parseStringAsync (/usr/local/lib/node_modules/sfdc-generate-package/lib/utils/async-xml-parser.js:4:19)
(node:77781) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:77781) [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.

Looks like an issue in libraries that you've used.
But maybe you know how to resolve it quickly.

Thanks! :)

API Metadata issue ;( Please update to api48 and add lacking fields

Due to generating manifest, if some metadata exist in api and don't exist in soap api it not appear in metadata.js file. Hope you still care about this tool ;)

Lacking metadata - permissionsetgroups

After adding it it to file, works like charm, please add this metadata.

  "permissionsetgroups": {
    "xmlName": "PermissionSetGroup",
    "minApiVersion": 45.0,
    "maxApiVersion": 47.0
  },

P.S. and update to API 48

Retrieving metadata.js from Salesforce Metadata API

Hi,

I would like to consult with you about a change i want to make.
The idea is to run the metadata API each time to retrieve the version specific metadata so it will be future proof without having to update metadata.js manually in the repository each version release.

The user will have to input in the cli a username and password of an org (any org, since the metadata api result will be the same for every org) and build the metadata.js in memory instead of using metadata.js repository file.

The problem is that i guess not every company will be willing to make a callout from this package, or to input their org credentials.

So there are few options:

  1. Force everybody to work with metadata API to use this package (my favorite)
  2. Build some NodeJS app that will run on heroku/Google Cloud Functuin with a Trailhead Playground org credentials and the package will send a request to that endpoint and receive the metadata of a specific version, this way companies won't have to use their org credentials, but they will be allowed to choose if to use our endpoint or the real metadata api.
  3. use option 1 or 2 and still maintaining the metadata.js manually for companies that will still want to work offline with this package

Please tell me what is your preferred work of action and i'll try to implement.
If you would like to discuss further about it, you can get my email from Ben Bozou.

Best regards,

Ariel

EmailTemplate fails to deploy after building the package

Hello,

I use this module in a gulp task, calling it before the deploy task from "gulp-jsforce-deploy" module.
When deploying my package based on the generated package.xml, The deployment status on the instance fails because the module added a node with the name of the folder where my Email Templates are located.

Hereafter the gulp taks:

gulp.task('build-package', () => {
    sgp({
        apiVersion: forceConfig.apiVersion,
        src: forceConfig.src,
        output: forceConfig.src
    });
});

gulp.task('deploy', ['build-package'], () => {
    gulp.src('./' + forceConfig.src + '/**', { base: '.' })
      .pipe(zip('package.zip'))
      .pipe(forceDeploy({
          username: forceConfig.username,
          password: forceConfig.password,
          loginUrl: forceConfig.url,
          version: forceConfig.apiVersion,
          pollInterval: forceConfig.pollInterval,
          pollTimeout: forceConfig.pollTimeout
      }));
});

My folder structure is like this:
| emails
--| unfiled$public
----| myTemplate1
----| myTemplate2

Here is the generated package.xml file (EmailTemplate part):

<types>
    <members>unfiled$public</members>
    <members>unfiled$public/myTemplate1</members>
    <members>unfiled$public/myTemplate2</members>
    <name>EmailTemplate</name>
 </types>

The issue in the deployment status is An object 'unfiled$public' of type EmailTemplate was named in package.xml, but was not found in zipped directory.

I think you should juste escape the potential folder structure between the emails folder and the templates files.

Let me know if you need further details.

Issue when generating package with 2.2.4 version

sgp -s ./src -a 43.0 -o ./src

(node:11436) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'objects' of undefined

(node:11436) [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.

Version 2.2.4 - Cannot read property 'objects' of undefined

In the "subdefinition-type-strategy" file, on the line 26, there are "this.metadata" but the class aren't this attribute.
Prefer use "metadata" directly

Error:

TypeError: Cannot read property 'objects' of undefined
at result.forEach.aFile (C:\Users\baptiste.bieber\Documents\Dev\sfdc-extended-metadata\node_modules\sfdc-generate-package\lib\strategies\type-strategies\subdefinition-type-strategy.js:26:27)

Includes folders as members in generated package

Currently the package.xml script that is generated will include folders within a metadata type as members of that metadata type making the package.xml look for a file that does not exist.

We need to not include the folders as members e.g.

<types>
    <members>Folder</members>
    <members>Folder/Email_Template</members>
    <name>EmailTemplate</name>
</types>

The Folder member does not exist but is included in the package.xml. This should not be included as it is inferred from the path of the Email Template.

LightningComponentBundle is not generated

Hi guys when adding Lightning Web Components to the source (LWC folder), the "LightningComponentBundle" type is not generated on the package.xml file.

Thanks in advance

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.