function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mattpopeftusamattpopeftusa 

JavaScript App Local Development Workflow

Hello, we're embarking on a SPA AngularJS application development project that will be hosted on the force.com platform and are working to get the development and deployment process as streamlined as possible.  

We are possibly going to use Kevin Poorman's ngForce library and will likely going to leverage JavaScript Remoting which will give us a blend of Apex Classes, at least 1 Visualforce page and a bunch of JavaScript, CSS and HTML files wrapped up in a static resource.  

I'm tryting to sort out the local development experience and am concerned that even a streamlined ANT/Grunt/etc package and deploy to force.com process will make the development process frustrating for developers. As I understand it, even a simple CSS or JS change will require a package and deploy and then a browser refresh to see reflected.  

Has anyone seen any development or DevOps models that are ideal for rapid JS development on the force.com platform? We're still looking at the REST API option since that would allow developers to run the application on their machine and see changes very quickly, but are interested in leveraging all that we can from the force.com platform (seamless authentication, JavaScript Remoting, no API calls, etc) if possible.  

Thanks for any input and tips on how to best support rapid JS application development on force.com.

Matt

PS: Seems like there should be a JavaScript devlopment category in the forum since there is a lot of interest around these topics.
pconpcon
We use Grunt and Solenopsis [1] to deploy our stuff to sandboxes and it works well.  As for actively developing stuff, I've found that it's much easier to stand up a local HTTPS server that you can do your JavaScript work on in realtime (just refresh Visualforce page) and include that as part of the page.  We have code in our pages like:
 
public class PageController {
    public static Map<String, String> jsPath = new Map<String, String>{
        'pcon' => 'https://192.168.0.18/salesforce/js'
    };

    public String getEnvironment() {
        if (UserInfo.getOrganizationId() == 'xxxxx') {
            return 'prod';
        }

        List<String> parts = UserInfo.getUsername().split('.');
        return parts.get(parts.size() - 1);
    }

    public String getResourcePath() {
        if (jsPath.hasKey(getEnvironment())) {
            return jsPath.get(getEnvironment());
        }

        List<StaticResource> resourceList = [
            select Name, NamespacePrefix, SystemModStamp
            from StaticResource
            where Name = 'js'
        ];

        if (resourceList.isEmpty()) {
            return '';
        }

        return namespace = resourceList[0].NamespacePrefix;
            return '/resource/' +
                resourceList.get(0).SystemModStamp.getTime() + '/' +
                (namespace != null && namespace != '' ? namespace + '__' : '') +
                resourceName;
    }
}
NOTE: This code has not been tested and may contain typographical or logical errors

Then in your Visualforce page do
 
<apex:includeScript value="{!resourcePath}/foo.js" />