UNPKG

4.53 kBMarkdownView Raw
1# salesforcedx-templates
2
3This repository provides a series of commands, templates, and generators for various metadata types. It is bundled with the [salesforcedx plugin](https://www.npmjs.com/package/salesforcedx).
4
5[![CircleCI](https://circleci.com/gh/forcedotcom/salesforcedx-templates/tree/master.svg?style=shield)](https://circleci.com/gh/forcedotcom/salesforcedx-templates/tree/master)
6[![Codecov](https://codecov.io/gh/forcedotcom/salesforcedx-templates/branch/master/graph/badge.svg)](https://codecov.io/gh/forcedotcom/salesforcedx-templates)
7[![Known Vulnerabilities](https://snyk.io/test/github/forcedotcom/salesforcedx-templates/badge.svg)](https://snyk.io/test/github/forcedotcom/salesforcedx-templates)
8[![License](https://img.shields.io/npm/l/salesforcedx-templates.svg)](https://github.com/forcedotcom/salesforcedx-templates/blob/master/package.json)
9
10
11## Getting Started
12
13To use, install the [Salesforce CLI](https://developer.salesforce.com/tools/sfdxcli) and run the following commands.
14
15```
16Verify the CLI is installed
17 $ sfdx (-v | --version)
18Install the salesforcedx plugin
19 $ sfdx plugins:install salesforcedx
20To run a command
21 $ sfdx [command]
22```
23
24To build the plugin locally, make sure to have yarn installed and run the following commands:
25
26```
27Clone the repository
28 $ git clone git@github.com:forcedotcom/salesforcedx-templates.git
29Install the dependencies and compile
30 $ yarn install
31 $ yarn prepack
32Link your plugin to the sfdx cli
33 $ sfdx plugins:link .
34To verify
35 $ sfdx plugins
36 salesforcedx-templates 0.0.0 (link) /Users/a.jha/Documents/repos/salesforcedx-templates
37```
38
39## Commands
40
41- [`sfdx force:apex:class:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forceapexclasscreate)
42- [`sfdx force:apex:trigger:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forceapextriggercreate)
43- [`sfdx force:lightning:app:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forcelightningappcreate)
44- [`sfdx force:lightning:component:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forcelightningcomponentcreate)
45- [`sfdx force:lightning:event:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forcelightningeventcreate)
46- [`sfdx force:lightning:interface:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forcelightninginterfacecreate)
47- [`sfdx force:lightning:test:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forcelightningtestcreate)
48- [`sfdx force:project:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forceprojectcreate)
49- [`sfdx force:visualforce:component:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forcevisualforcecomponentcreate)
50- [`sfdx force:visualforce:page:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forcevisualforcepagecreate)
51
52
53## Debugging your plugin
54
55We recommend using the Visual Studio Code (VS Code) IDE for your plugin development. Included in the `.vscode` directory of this plugin is a `launch.json` config file, which allows you to attach a debugger to the node process when running your commands.
56
57To debug the `hello:org` command:
58
59If you linked your plugin to the sfdx cli, call your command with the `dev-suspend` switch:
60
61```sh-session
62$ sfdx hello:org -u myOrg@example.com --dev-suspend
63```
64
65Alternatively, to call your command using the `bin/run` script, set the `NODE_OPTIONS` environment variable to `--inspect-brk` when starting the debugger:
66
67```sh-session
68$ NODE_OPTIONS=--inspect-brk bin/run hello:org -u myOrg@example.com
69```
70
712. Set some breakpoints in your command code
723. Click on the Debug icon in the Activity Bar on the side of VS Code to open up the Debug view.
734. In the upper left hand corner of VS Code, verify that the "Attach to Remote" launch configuration has been chosen.
745. Hit the green play button to the left of the "Attach to Remote" launch configuration window. The debugger should now be suspended on the first line of the program.
756. Hit the green play button at the top middle of VS Code (this play button will be to the right of the play button that you clicked in step #5).
76 <br><img src=".images/vscodeScreenshot.png" width="480" height="278"><br>
77 Congrats, you are debugging!