SalesforceXyTools Support SFDX develop

[SalesforceXytoolsForSublime](https://github.com/exiahuang/SalesforceXyTools) is Rapid development tools for Salesforce Development.

From `SalesforceXytools For Sublime` v2.1.6(2019/06/15) Support [Sfdx Deveopment](https://github.com/exiahuang/SalesforceXyTools/wiki/SalesforceXyTools-Support-SFDX-develop).

Let us talk about using `SalesforceXytools For Sublime` for Salesforce SFDX Development.


# start sfdx development

## SFDX Command Palette
use `ctrl+alt+o` or `SFDX`->`SFDX Command` to open `SFDX Command Palette`

## Create Project

`force:project:create`

![force:project:create](https://raw.githubusercontent.com/exiahuang/mystatic/master/media/XyToolsSfdx/Image001.jpg)

Input your workspaceFolder

![force:project:create](https://raw.githubusercontent.com/exiahuang/mystatic/master/media/XyToolsSfdx/Image002.jpg)


![force:project:create](https://raw.githubusercontent.com/exiahuang/mystatic/master/media/XyToolsSfdx/Image003.jpg)

```bash
[2019-06-15 15:56:30][info] sfdx force:project:create -n "D:\Sfdx-Hello" --template standard
[2019-06-15 15:56:30][info] ********************************************************************************
target dir = D:\Sfdx-Hello
   create sfdx-project.json
   create README.md
   create .forceignore
   create .gitignore
   create config\project-scratch-def.json
   create .vscode\settings.json
   create .vscode\launch.json
   create .vscode\extensions.json
   create .prettierrc
   create .prettierignore
   create force-app\main\default\lwc\.eslintrc.json
```


## Authorize an Org

`force:auth:web:login`

Select test or product.

Input your Alias.

![force:project:create](https://raw.githubusercontent.com/exiahuang/mystatic/master/media/XyToolsSfdx/Image004.jpg)

![force:project:create](https://raw.githubusercontent.com/exiahuang/mystatic/master/media/XyToolsSfdx/Image005.jpg)

![force:project:create](https://raw.githubusercontent.com/exiahuang/mystatic/master/media/XyToolsSfdx/Image006.jpg)

```bash
[2019-06-15 15:58:00][info] sfdx force:auth:web:login --instanceurl https://login.salesforce.com --setalias Dev1
```

## Test Login

![force:project:create](https://raw.githubusercontent.com/exiahuang/mystatic/master/media/XyToolsSfdx/Image007.jpg)

![force:project:create](https://raw.githubusercontent.com/exiahuang/mystatic/master/media/XyToolsSfdx/Image008.jpg)

```bash
[2019-06-15 15:59:36][info] sfdx force:org:open -p /home/home.jsp -u Dev1
[2019-06-15 15:59:36][info] ********************************************************************************
Access org 00DXXXXXXXX as user exiaxxxxxxxxxxxxxxxxxxx@xxxxxxxxxxx.com with the following URL: https://xxxxxxxxxxx.my.salesforce.com/secur/frontdoor.jsp?sid=xxxxxxxxxx
```


## Set default username

`force:config:set:defaultusername`

![force:project:create](https://raw.githubusercontent.com/exiahuang/mystatic/master/media/XyToolsSfdx/Image006.jpg)

```bash
[2019-06-15 15:59:58][info] sfdx force:config:set defaultusername=Dev1
[2019-06-15 15:59:58][info] ********************************************************************************
=== Set Config
NAME             VALUE
───────────────  ─────
defaultusername  Dev1
```

Set default username

## Retrieve Source from Org
```bash
force:source:retrieve:metadata:base
"ApexClass, ApexPage, ApexComponent, ApexTrigger, LightningComponentBundle, AuraDefinitionBundle, CustomObject"
```

![force:project:create](https://raw.githubusercontent.com/exiahuang/mystatic/master/media/XyToolsSfdx/Image009.jpg)

## Create Apex, Trigger, Aura, LWC

### create apex

```bash
[2019-06-15 16:05:59][info] sfdx force:apex:class:create -n Hello1 --outputdir "./force-app/main/default/classes" --template DefaultApexClass
[2019-06-15 16:05:59][info] ********************************************************************************
target dir = D:\Sfdx-Hello\force-app\main\default\classes
   create Hello1.cls
   create Hello1.cls-meta.xml
```

change your code.
```java
public with sharing class Hello1 {
    public Hello1() {
    	System.debug('hello world');
    }
}
```

### Deploy Source from Org

```bash
[2019-06-15 16:07:48][info] sfdx force:source:deploy --loglevel fatal --sourcepath "D:\Sfdx-Hello\force-app\main\default\classes\Hello1.cls" --targetusername=Dev1
[2019-06-15 16:07:48][info] ********************************************************************************
=== Deployed Source
FULL NAME  TYPE       PROJECT PATH
─────────  ─────────  ──────────────────────────────────────────────────
Hello1     ApexClass  force-app\main\default\classes\Hello1.cls
Hello1     ApexClass  force-app\main\default\classes\Hello1.cls-meta.xml
```

![force:project:create](https://raw.githubusercontent.com/exiahuang/mystatic/master/media/XyToolsSfdx/Image010.jpg)

# Document

Know more sfdx command.
The office document about 

[Salesforce CLI Command Reference](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference.htm)

[Salesforce CLI](https://developer.salesforce.com/ja/tools/sfdxcli).

sfdx base command

## List 
```bash
sfdx force:alias:list
sfdx force:org:list
```

## SFDX: Create Project with Manifest
```bash
sfdx force:project:create -n ProjectName
```

## SFDX: Authorize an Org
```bash
sfdx force:auth:web:login --setalias MyDevOrg --setdefaultusername
```

## SFDX: Retrieve Source from Org
```bash
sfdx force:source:retrieve --manifest ./manifest/package.xml
sfdx force:source:retrieve --metadata "ApexClass, ApexPage, ApexComponent, ApexTrigger, LightningComponentBundle, AuraDefinitionBundle, CustomObject"
```

## SFDC: Deploy Source to Org
```bash
sfdx force:source:deploy --json --loglevel fatal --sourcepath ./force-app/main/default/classes/APEX_NAME.cls
sfdx force:source:deploy -p ./force-app/main/src
```