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## Getting Started
11
12To use, install the [Salesforce CLI](https://developer.salesforce.com/tools/sfdxcli) and run the following commands.
13
14```
15Verify the CLI is installed
16 $ sfdx (-v | --version)
17Install the salesforcedx plugin
18 $ sfdx plugins:install salesforcedx
19To run a command
20 $ sfdx [command]
21```
22
23To build the plugin locally, make sure to have yarn installed and run the following commands:
24
25```
26Clone the repository
27 $ git clone git@github.com:forcedotcom/salesforcedx-templates.git
28Install the dependencies and compile
29 $ yarn install
30 $ yarn prepack
31Link your plugin to the sfdx cli
32 $ sfdx plugins:link .
33To verify
34 $ sfdx plugins
35 salesforcedx-templates 0.0.0 (link) /Users/a.jha/Documents/repos/salesforcedx-templates
36```
37
38## Commands
39
40- [`sfdx force:apex:class:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forceapexclasscreate)
41- [`sfdx force:apex:trigger:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forceapextriggercreate)
42- [`sfdx force:lightning:app:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forcelightningappcreate)
43- [`sfdx force:lightning:component:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forcelightningcomponentcreate)
44- [`sfdx force:lightning:event:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forcelightningeventcreate)
45- [`sfdx force:lightning:interface:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forcelightninginterfacecreate)
46- [`sfdx force:lightning:test:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forcelightningtestcreate)
47- [`sfdx force:project:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forceprojectcreate)
48- [`sfdx force:visualforce:component:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forcevisualforcecomponentcreate)
49- [`sfdx force:visualforce:page:create`](https://github.com/forcedotcom/salesforcedx-templates/blob/master/COMMANDS.md#sfdx-forcevisualforcepagecreate)
50
51## Debugging your plugin
52
53We 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.
54
55To debug the `hello:org` command:
56
57If you linked your plugin to the sfdx cli, call your command with the `dev-suspend` switch:
58
59```sh-session
60$ sfdx hello:org -u myOrg@example.com --dev-suspend
61```
62
63Alternatively, to call your command using the `bin/run` script, set the `NODE_OPTIONS` environment variable to `--inspect-brk` when starting the debugger:
64
65```sh-session
66$ NODE_OPTIONS=--inspect-brk bin/run hello:org -u myOrg@example.com
67```
68
692. Set some breakpoints in your command code
703. Click on the Debug icon in the Activity Bar on the side of VS Code to open up the Debug view.
714. In the upper left hand corner of VS Code, verify that the "Attach to Remote" launch configuration has been chosen.
725. 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.
736. 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).
74 <br><img src=".images/vscodeScreenshot.png" width="480" height="278"><br>
75 Congrats, you are debugging!