This boilerplate, which is still largely unifinished, combines the powers of Gulp, JSForce, Angular 2, and Salesforce and allows you to develop and test your Salesforce applications completely locally. Deploying is as easy as running gulp
or you can be more specific and just gulp deploy:classes
.
Setting up is super easy. First clone or fork this repository to your local machine with git clone https://github.com/iDev0urer/salesforce-angular2-boilerplate.git
or, if you forked the repo, do git clone YOUR-REPO-URL
. Then go to the salesforce-angular2-boilerplate directory with cd salesforce-angular2-boilerplate
.
You will need NodeJs in order to work with this so make sure you have that installed.
Once you're in the salesforce-angular2-boilerplate directory run npm install
. This project also uses gulp 4, so install that:
npm rm -g gulp
npm install -g gulp-cli
If everything worked gulp -v
should give you a version number over 4.
You will also need to copy the config.sample.js
file to config.js
and fill out the pertenent information. It should look like this:
module.exports = {
deploy: {
username: '[email protected]',
password: 'YourPasswordAndPossiblySecurityToken',
login_url: 'https://login.salesforce.com',
api_version: 36.0,
timeout: 120000,
poll_interval: 5000,
},
visualforce: {
template: 'index.page.html',
page: 'AngularApp',
controller: 'AngularAppController'
},
resources: {
app_resource_name: 'AngularApp',
node_module_resource_name: 'NodeModules',
},
options: {
}
}
This boilerplate comes with a working example of a contact management application. To get it running just run the gulp
command while in the salesforce-angular2-boilerplate directory. It will open a local server at http://localhost:8080 where you should be able to view the working application. When you're ready to deploy the application and test it in Salesforce just run gulp deploy
and wait for the application to finish deploying.
If you find something wrong or come up with a better way to do things please fork and pull request. I check Github several times daily and love seeing that little notification bubble.
So far things seem to be working well for the most part. Some things that I have noticed are:
- Visualforce Remoting and WebServices use different date formats. I have tried to compensate for those differences in the Salesforce service with the
parseSoapResult
andconvertDate
methods, but I may have missed an edge case.
The MIT License
Copyright (c) 2010-2016 Chris Watson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Added Gravatar directive to get use pictures rather than pulling them from Salesforce
- Updated Angular app to version 2.0.0-rc.6. See the Angular 2 Changelog for breaking changes.
- Restructured config files. Now using
config.js
rather thanyaml
- Took the
pxml.js
file which is used forpackage.xml
generation and refactored it out into it's own module - Refactored gulpfiles to fit with new config
- Fixed bug with
ngZone
causingexecute
method to fire twice when withinngOnInit
- Removed https requirement from local server. Use http://localhost:8080 now
- Added components to
app.module.ts
declarations - Made changes to forked version of jsforce and updated
salesforce.service.ts
to reflect those changes.
- Added SOQL class to build SOQL queries
- Refactored some methods in the Salesforce service
- Finished the ContactComponent (for now)
- Added a CreateContactComponent
- Fixed some bugs
- Added this repo to github