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

salesforce-documentator

v1.2.5

Published

Salesforce npm tool to create automatic documentation

Downloads

12

Readme

Permission Processor CLI

Permission Processor CLI is a command-line tool designed to process Salesforce Permission Sets and Profiles files and generate an Excel report. The report provides a detailed view of object and field permissions, helping administrators and developers effectively analyze and document permissions.

Features

  • Process Permission Sets or Profiles: Reads Salesforce XML files of Permission Sets or Profiles and extracts object and field permissions.
  • Generate Excel Reports: Creates an Excel file with organized tables containing permission data.
  • Use Labels Instead of API Names: Optionally replaces API names with object and field labels for better readability.
  • Customizable Icons: Allows customization of the icons representing true and false values in the report.
  • Configurable Paths: Supports custom paths for permission and metadata files.
  • Flexible Command-Line Options: Provides several options to customize the tool's output and behavior.

Table of Contents

Requirements

  • Node.js: Version 14 or higher is required due to the use of ES Modules and modern JavaScript features.

Installation

You can install the tool globally using npm:

npm install -g salesforce-documentator

Usage

Once installed, you can run the tool from the command line using the sfdoc command.

Command-Line Options

sfdoc [options]

CLI tool to process permission files (Permission Sets or Profiles) and generate an Excel report

Options:
  -V, --version                      Output the version number (1.2.5)
  -p, --path <path>                  Path to permission files (default: "./permissionsets")
  -g, --glob <pattern>               Glob pattern to select permission files (default: "**/*-meta.xml")
  -o, --output <file>                Output Excel file (default: "./sfdocs/permissions.xlsx")
  -t, --true-icon <icon>             Icon representing true value (default: "✔")
  -f, --false-icon <icon>            Icon representing false value (default: "✖")
  -c, --config <file>                Configuration file in JSON format
  -l, --use-labels                   Use labels instead of API names (default: false)
  --object-meta-path <path>          Path to custom object metadata files (default: "./objects")
  --type <type>                      Type of permission files to process ("permissionsets" or "profiles", default: "permissionsets")
  -h, --help                         Display help for command

Configuration File

You can use a JSON configuration file to specify options:

{
  "path": "./permissionsets",
  "glob": "**/*.permissionset-meta.xml",
  "output": "./sfdocs/permissions.xlsx",
  "trueIcon": "Yes",
  "falseIcon": "No",
  "useLabels": true,
  "objectMetaPath": "./objects",
  "type": "permissionsets"
}

To run the tool with a configuration file:

sfdoc --config config.json

Note: Command-line options override options specified in the configuration file.

Examples

Basic Usage

Process Permission Sets using default options:

sfdoc

Process Profiles

Process Profiles by specifying the type:

sfdoc --type profiles --path ./profiles

Specify Custom Paths

Process permission files from a custom directory and generate output in a specific file:

sfdoc --path ./myPermissions --output ./output/permissions.xlsx

Use Labels Instead of API Names

Include labels for objects and fields in the report:

sfdoc --use-labels --object-meta-path ./force-app/main/default/objects

Customize True and False Icons

Change the icons that represent true and false values:

sfdoc --true-icon "✅" --false-icon "❌"

Use a Configuration File

Run the tool with options specified in a configuration file:

sfdoc --config config.json

Metadata Format Support

The tool supports both Metadata API Format and SFDX Source Format for Salesforce metadata files.

  • Metadata API Format: Custom object metadata files contain field definitions within them.
  • SFDX Source Format: Custom fields are stored in separate files under the fields directory within each object folder.

Ensure that the --object-meta-path option points to the correct directory containing your object metadata files.

Handling Standard Objects and Fields

Standard Salesforce objects and fields may not have complete metadata files in your project, which could cause parsing issues.

The tool includes a mechanism to skip standard objects and fields during label collection to avoid warnings.

If you want to customize labels for standard objects and fields, you can modify the tool to include a hardcoded mapping.

Notes

  • Default Behavior: If the tool cannot find a label for an object or field, it defaults to the API name.
  • Paths and Glob Patterns: Ensure paths and glob patterns are correct and use forward slashes (/) for cross-platform compatibility.
  • Excel Spreadsheet Limitations: Sheet names are sanitized to remove invalid characters and truncated to 31 characters to comply with Excel limitations.
  • Cross-Platform Compatibility: The tool is designed to work on Windows, macOS, and Linux systems.

Contributions

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.