Gulp tasks for deploying metadata to and refreshing metadata from Force.com in a git-friendly manner.
-
Copy the following files into your Force.com project directory:
- package.json
- config.json
- sfpackage.json
- gulpfile.js
-
Ensure that node/npm is installed:
-
npm install
-
gulp <task_name>
Credentials can be specified either via environment variables:
export SF_USERNAME=<username>
export SF_PASSWORD=<password>
Or via the included task which will encrypt and store them in a file in the current directory:
gulp addCredentials
The deploy task will default to using credentials from environment variables if they exist, or will prompt for which stored credentials to use otherwise.
There are a few options that are configurable via config.json.
This is the path to the root directory of the Force.com project (one level above the "src" directory). The contents of the directory should be structured similar to the following:
.
+-- resource-bundles
| +-- MyApp
| | +-- js
| | +-- css
+-- src
| +-- package.xml
| +-- classes
| | +-- MyClass.cls
| | +-- MyClass.cls-meta.xml
| +-- pages
| | +-- MyPage.page
| | +-- MyPage.page-meta.xml
| +-- staticresources
| | +-- MyApp.resource
| | +-- MyApp.resource-meta.xml
This is the Force.com login endpoint. For production/dev this should be https://login.salesforce.com, and for sandbox should be https://test.salesforce.com.
This option is only used when the SF_USERNAME
& SF_PASSWORD
environment variables have been set.
This is the directory path that metadata retrieved via gulp retrieve
task gets saved into. If the directory path does not exist it will be created.
Updates static resources by compressing each subdirectory in resource-bundles folder.
Compresses all resource bundles then deploys all project metadata to Force.com.
Retrieves metadata from Force.com that is specified in sfpackage.json, and saves it into a new subdirectory. The path of the subdirectory is determined by the retrievedPkgPath
option in config.json.