Giter Club home page Giter Club logo

mo-dx-plugin's Introduction

mo-dx-plugin

A plugin for Salesforce DX CLI that provides ability to save Apex Classes, Apex Triggers, Visualforce Page, Visualforce Components ,AuraBundle(Lightning Components) and Static Resource to Salesforce org (Scratch/Non-Scratch orgs) using Tooling API.

Plugin also provides a retrieve command that can retrieve metadata in salesforceDx and traditional source format from salesforce unmanaged/managed package or changesets.

The commands in this plugin are used within the DX Code Companion extension (https://marketplace.visualstudio.com/items?itemName=MohithShrivastava.dx-code-companion).

If you are Visual Studio Code user then recommend installing the extension along with the plugin to avoid having to remember the commands.

Setup

Install as plugin (Recommended approach for Installing)

Install plugin using command : sfdx plugins:install mo-dx-plugin

Install from source(Preferred approach for debugging and enhancing the plugin)

  1. Install the SDFX CLI.

  2. Clone the repository: git clone [email protected]:msrivastav13/mo-dx-plugin.git

  3. Install using yarn: yarn install

  4. Link the plugin: sfdx plugins:link .

Commands

sfdx retrieve:dxsource

Retrieves soure code from Managed/Unmamaged package or Changesets.This command works for only Non-scratch orgs .If you are trying to convert a traditional project in Managed/Unmanaged package , this command can help convert the sourcecode to DX format.

USAGE
  $ sfdx retrieve:dxsource

OPTIONS
  -n, --packagename=packagename                   (required) the name of the package you want to retrieve.The package parameter value must be enclosed in double quotes.Example if you have a package named HR App the command would be sfdx retrieve:dxsource -n "HR App"

  -p, --pathname=pathname                         [default: force-app] where to convert the result to...defaults to
                                                  force-app

  -u, --targetusername=targetusername             username or alias for the target org; overrides default target org

  -m, --retainmetadata                            provide a random string to retain the mdapiout folder that has source code in mdapi format

  --apiversion=apiversion                         override the api version used for api requests made by this command

  --json                                          format output as json

  --loglevel=(trace|debug|info|warn|error|fatal)  logging level for this command invocation

EXAMPLES
  $ sfdx retrieve:dxsource -n <package/changeset> // Default authorized org is used as username or org alias
  $ sfdx retrieve:dxsource -u [email protected] -n <package/changeset> -p <[pathName]>

See code: src/commands/retrieve/dxsource.ts

sfdx retrieve:pkgsource

Retrieves soure code from Managed/Unmamaged package or Changesets.This command works for only Non-scratch orgs.This retrieves metadata in traditional source format.

USAGE
  $ sfdx retrieve:pkgsource

OPTIONS
  -n, --packagename=packagename                   (required) the name of the package you want to retrieve.The package parameter value must be enclosed in double quotes.Example if you have a package named HR App the command would be sfdx retrieve:pkgsource -n "HR App"

EXAMPLES
  $ sfdx retrieve:pkgsource -n <package/changeset> // Default authorized org is used as username or org alias

See code: src/commands/retrieve/pkgsource.ts

sfdx deploy:apex

Deploys apex code to the Salesforce Org using Tooling API.

USAGE
  $ sfdx deploy:apex

OPTIONS
  --p, --pathname=pathname                   (required) the file path of the apex class you want to save to salesforce. Note you can run pwd command on terminal to obtain the path easily.

EXAMPLES
  $ sfdx deploy:apex -p <pathname> // Default authorized org is used for the deploy .The pathname parameter must be enclosed in double quotes. Example if your path is /Users/mohith/Desktop/ForceProjects/TestApp/force-app/main/default/classes/Constants.cls then the command to save this class will be sfdx deploy:apex -p "/Users/mohith/Desktop/ForceProjects/TestApp/force-app/main/default/classes/Constants.cls"

See code: src/commands/deploy/apex.ts

sfdx deploy:trigger

Deploys apex trigger code to the Salesforce Org using Tooling API.

USAGE
  $ sfdx deploy:trigger

OPTIONS
  --p, --pathname=pathname                   (required) the file path of the apex trigger you want to save to salesforce. Note you can run pwd command on terminal to obtain the path easily

EXAMPLES
  $ sfdx deploy:trigger -p <pathname> // Default authorized org is used for the deploy

See code: src/commands/deploy/trigger.ts

sfdx deploy:vf

Deploys visualforce page to the Salesforce Org using Tooling API.

USAGE
  $ sfdx deploy:vf

OPTIONS
  --p, --pathname=pathname                   (required) the file path of the vf page you want to save to salesforce . Note you can run pwd command on terminal to obtain the path.

EXAMPLES
  $ sfdx deploy:vf -p <pathname> // Default authorized org is used for the deploy

See code: src/commands/deploy/vf.ts

sfdx deploy:vfcomponent

Deploys visualforce components to the Salesforce Org using Tooling API.

USAGE
  $ sfdx deploy:vfcomponent

OPTIONS
  --p, --pathname=pathname                   (required) the file path of the vf component you want to save

EXAMPLES
  $ sfdx deploy:vfcomponent -p <pathname> // file path used to save the component to Salesforce.

See code: src/commands/deploy/vfcomponent.ts

sfdx deploy:aura

Deploys aura lightning bundle to the Salesforce Org using Tooling API.

Supports deploying whole aura bundle as well individual files .To deploy the AuraBundle provide the directory path in path(p) parameter

USAGE
  $ sfdx deploy:aura

OPTIONS
  --p, --pathname=pathname                   (required) the file path of the aura bundle you want to save to Salesforce.

EXAMPLES
  $ sfdx deploy:aura -p <pathname> // Default authorized org is used for the deploy

See code: src/commands/deploy/aura.ts

sfdx deploy:lwc

Deploys lighnting web component bundle to the Salesforce Org using Tooling API.

Supports deploying lwc bundle as well individual files in lwc bundle .To deploy the Lightning Bundle as a whole provide the directory path in path(p) parameter

USAGE
  $ sfdx deploy:lwc

OPTIONS
  --p, --pathname=pathname                   (required) the file path of the lightning web components bundle you want to save to Salesforce.

EXAMPLES
  $ sfdx deploy:lwc -p <pathname> // Default authorized org is used for the deploy

See code: src/commands/deploy/lwc.ts

sfdx deploy:staticresource

Deploys Static Resources to the Salesforce Org using Tooling API.

Supports deploying staticresource folder (It zips it up) as well individual files in staticresource folder.

USAGE
  $ sfdx deploy:staticresource

OPTIONS
  --p, --pathname=pathname                   (required) the file path of the lightning web components bundle you want to save to Salesforce.

EXAMPLES
  $ sfdx deploy:staticresource -p <pathname> // Default authorized org is used for the deploy
  $ sfdx deploy:staticresource -p <pathname> --resourcefolder <name of the folder where you have app>' // Default authorized org is used for the deploy
  $ sfdx deploy:staticresource -p <pathname> --resourcefolder <name of the folder where you have app>' --cachecontrol public //makes the cache control of static resource public

See code: src/commands/deploy/staticresource.ts

sfdx metadata:rename

Renames a single metadata using the salesforce Metadata API.

Salesforce allows to rename some types of metadata (CRUD based) using the Metadata API.This commands provides sfdx version

USAGE
  $ sfdx metadata:rename

OPTIONS
  -t, --metadatatype=metadatatype                   (required) the type of the metadata (Ex CustomObject for customobject, CustomField for custom field)

  -o, --oldfullname=oldfullname                         (required) Full API name of the current component that will be overriden with the new name

  -n, --newfullname=newfullname             (required) Full API name that will override the existing component name

EXAMPLES
   '$ sfdx metadata:rename -t <metadatatype> -n <newname> -o <oldname>',
    '$ sfdx metadata:rename -t CustomObject -n MyCustomObject1New__c -o MyCustomObject1__c' // here Custom Object MyCustomObject1__c is renamed to MyCustomObject1New__c

See code: src/commands/metadata/rename.ts

Important Note When Using these Commands With Non-Scratch Org

These commands do not maintain history and files are overriden on server .Make sure you have source control for the project setup so you can recover code if you accidently overwrite anything

mo-dx-plugin's People

Contributors

msrivastav13 avatar

Watchers

 avatar

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.