npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

broccoli-salesforce-deploy

v1.0.10

Published

A broccoli plugin to deploy files to a salesforce org using the tooling ap

Downloads

13

Readme

broccoli-salesforce-deploy

A broccoli plugin to deploy files to a salesforce org using the tooling api

an example Brocfile.js for deploying a resource dir as a salesforce staticresource

// Brocfile.js
//
// This setup will deploy the directory MyResource.resource 
// as a static resource called MyResource.
// You can download the produced zip file from http://localhost:4200
// when broccoli is running.
//

var funnel = require('broccoli-funnel');
var zip = require('broccoli-zip-js');
var deploy = require('broccoli-salesforce-deploy');
var mergeNodes = require('broccoli-merge-trees');

deploy.setLogLevel('info');

// Give you're directory name here - the actual directory looked for will be 'MyResource.resource'
var resourceName = 'MyReource';

// zip the directory into 'MyResource.zip'
resource = zip(resourceName + '.resource', { name: resourceName + '.zip' });

// deploy the resource to salesforce
deployed = deploy(resource, {
  // in general you don't want to deploy every time you start broccoli so its better to skip the first
  // build unless you're building for production
  skipFirstBuild: true,
  file: resourceName + '.zip',
  type: 'StaticResource',
  loginUrl: 'https://test.salesforce.com',
  username: '[email protected]',
  password: 'somePassword',
  securityToken: 'someSecurityToken'
});

module.exports = mergeNodes([ deployed ]);

visualforce page and lightning bundles

You can also deploy a visualforce page like so:

var isProduction = false;
var pagesPath = './pages';
var fileName = 'MyPage.page';
var pageName = 'MyPage';
page = deploy(pickFiles(pagesPath, { include: [ fileName ] }), {
  // in general you don't want to deploy every time you start broccoli so its better to skip the first
  // build unless you're building for production
  skipFirstBuild: !isProduction,
  type: 'ApexPage',
  apiVersion: '37.0',
  file: fileName,
  name: pageName,
  username: sfCreds.username,
  password: sfCreds.password,
  securityToken: sfCreds.securityToken
});

and lightning bundle files

var isProduction = false;
var bundlePath = './auraBundles';
var bundleName = 'MyLightningBundle';
var sfCreds = {
  username: '[email protected]',
  password: 'somePassword',
  securityToken: 'someSecurityToken'
};

var deploymentDefaults = {
  // in general you don't want to deploy every time you start broccoli so its better to skip the first
  // build unless you're building for production
  skipFirstBuild: !isProduction,
  type: 'AuraDefinition',
  apiVersion: '37.0',
  // below are the available definition types
  // defType: 'APPLICATION', 'DESIGN', 'HELPER', 'CONTROLLER', 'RENDERER', 'DOCUMENTATION', 'STYLE', 'COMPONENT', 'SVG'
  name: bundleName,
  username: sfCreds.username,
  password: sfCreds.password,
  securityToken: sfCreds.securityToken
};

var appName = 'MyApp.app';
var app = deploy(pickFiles(bundlePath, { include: [ appName ] }), 
  Object.assign({}, deploymentDefaults, { 
  file: appName,
  defType: 'APPLICATION',
  format: 'XML' 
}));

var auradocName = 'MyComponent.auradoc';
var auradoc = deploy(pickFiles(bundlePath, { include: [ auradocName ] }), 
  Object.assign({}, deploymentDefaults, { 
  file: auradocName,
  defType: 'DOCUMENTATION',
  format: 'XML' 
}));

var componentName = 'MyComponent.cmp'
var component = deploy(pickFiles(bundlePath, { include: [ componentName ] }), 
  Object.assign({}, deploymentDefaults, { 
  file: componentName,
  defType: 'COMPONENT',
  format: 'XML' 
}));

var designName = 'MyComponent.design';
var design = deploy(pickFiles(bundlePath, { include: [ designName ] }), 
  Object.assign({}, deploymentDefaults, { 
  file: designName,
  defType: 'DESIGN',
  format: 'XML' 
}));

var svgName = 'MyComponent.svg';
var svg = deploy(pickFiles(bundlePath, { include: [ svgName ] }), 
  Object.assign({}, deploymentDefaults, { 
  file: svgName,
  defType: 'SVG',
  format: 'SVG' 
}));

var styleName = 'MyComponent.css';
var style = deploy(pickFiles(bundlePath, { include: [ styleName ] }), 
  Object.assign({}, deploymentDefaults, { 
  file: styleName,
  defType: 'STYLE',
  format: 'css' 
}));
	
var controllerName = 'MyComponentController.js';
var controller = deploy(pickFiles(tool, { include: [ controllerName ] }), 
  Object.assign({}, deploymentDefaults, { 
  file: controllerName,
  defType: 'CONTROLLER',
  format: 'JS' 
}));

var helperName = 'MyComponentHelper.js';
var helper = deploy(pickFiles(tool, { include: [ helperName ] }), 
  Object.assign({}, deploymentDefaults, { 
  file: helperName,
  defType: 'HELPER',
  format: 'JS' 
}));

var rendererName = 'MyComponentRenderer.js';
var renderer = deploy(pickFiles(tool, { include: [ rendererName ] }), 
  Object.assign({}, deploymentDefaults, { 
  file: rendererName,
  defType: 'RENDERER',
  format: 'JS' 
}));