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

sf-jedi

v0.1.4

Published

Another Salesforce developer tool

Downloads

5

Readme

SF Jedi

This is a framework which abstracts the JSforce metadata retrieve and deploy functions. Essentially you can run a few commands per the below example.

Note: Currently this is not maintained as I am not working on any Salesforce system. Also there is a really nice project called dmc which I found out about later after implementing this and it is aiming to do a lot of what I wanted so you should check it out

'use strict'

// Require the module
var Force = require('sf-jedi');

// You MUST provide these 4. If you dont it will check the for env
// variables, SF_USERNAME, SF_PASSWORD, SF_TOKEN and SF_HOST
let options = {
  username: '[email protected]',
  password: 'somepassword',
  token: 'DSAddjsaddsadasda', // Annoying thing that salesforce sends you
  host: 'login.salesforce.com' // Or set some other domain
}

// Create the force object with the options
let force = new Force(options);

// Initialises a .force project folder
force.init();

// Pulls from from the org using some previously initialised setting
force.pull();

// Pushes the current src folder (or whatever you set it to) to the org
force.push();

// Obliterates the .force folder and whatever src folder, take care
force.reset();

Additionally you can set a number of options, if you take a look at the example in the repo, but it looks basically like this. Note that most of these are set for you and so are totally optional!

// Optionally create some options, the only ones you NEED to set are these
// first 4 connection related settings and they default to env variables
let options = {
  username: '[email protected]',
  password: 'somepassword',
  token: 'DSAddjsaddsadasda',   // Annoying thing that salesforce sends you
  host: 'login.salesforce.com', // Or set some other domain

  // apiVersion: '34.0', // Kind of not used but its available

  pollTimeout:60000, // Time in ms for jsforce retrieve / deploy
  pollInterval:1000, // Time between polls in ms for jsforce

  // Logging options
  logging: {
    level: 'debug', // For winston
    exitOnError: true
  },

  // Project specific options
  project: {
    src: './src', // Where the files will go (do not leave a trailing /)
    pullOnInit: false, // Set this true if you want to pull after initialising
    createMetaXml: true, // True if you want missing -meta.xml to be created
    deleteSrcOnReset: true, // Set to false if you dont want the src folder to be reset

    // You can set the whole package.xml, this is the default(which is set for you)
    package: {
      types: [
        { members: '*', name: 'ApexClass' },
        { members: '*', name: 'ApexComponent' },
        { members: '*', name: 'ApexPage' },
        { members: '*', name: 'ApexTrigger' },
        { members: '*', name: 'StaticResource' }
      ],
      version: version || '34.0' // if you change THIS version it will be used
    }
  }
}

Primarily this is used at the moment in conjunction with grunt-sf-jedi which exposes these functions

Planned Features

Clearly at the moment the project is fresh alpha, however, upcoming features are the following (in probable order):

  • Correct change tracking, push only locally changed files
  • Watch task / function
  • [Deleted] file tracking from git
  • Destructive push / single truth source
  • Command line interface

What Token?

Just a free tip here, the salesforce 'token' trolled me a bit since it wasn't sent in any email automatically. So, if you cant find the 'Reset My Security Token' option anywhere in 'Setup' try the following url. Of course you will need to change to your domain for the url

https://<SalesforceDomainHere>/_ui/system/security/ResetApiTokenEdit?retURL=%2Fui%2Fsetup%2FSetup%3Fsetupid%3DPersonalInfo&setupid=ResetApiToken

Full credit to the guy in this stackoverflow question.

Acknowledgements

  • JSForce - I am using this to retrieve Salesforce data
  • jsforce-metadata-tools - I used some of the logic for outputting results
  • grunt-sf-tooling - Never saw this till after i finished the first cut but props there its the same idea